Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: omegamit6zeichen on Tue 15/07/2014 18:02:28

Title: [Solved] Look at item in inventory disappears during execution of event
Post by: omegamit6zeichen on Tue 15/07/2014 18:02:28
Hi, i am using a slightly modified version of the TwoClickEventHandler
Code (ags) Select
function on_mouse_click(MouseButton button)
{
// when mouse is clicked, text label is cleared
//lblActionText.Text = "";

// when game is paused, clicks aren't processed
if (IsGamePaused())
{
return;
}

// Left Mouse Button on Object/Character/Hotspot/Location
// when no inventory is selected:
// - INTERACT with target
// - walk to location
// else
// - USE inventory on target
else if (button == eMouseLeft)
{
if (GetLocationType(mouse.x, mouse.y) != eLocationNothing)
{
if (player.ActiveInventory == null)
{
ProcessClick(mouse.x, mouse.y, eModeInteract);
}
else
{
        MovesToItem=false;
ProcessClick(mouse.x, mouse.y, eModeUseinv);
       
}

}
else
{
if (player.ActiveInventory == null)
{
        MovesToItem=false;
ProcessClick(mouse.x, mouse.y, eModeWalkto);
}
else
{
player.ActiveInventory = null;
}
}
}

// Right Mouse Button on Object/Character/Hotspot/Location
// when no inventory is selected:
// - EXAMINE target
// else
// - DESELECT inventory
else if (button == eMouseRight)
{
if (player.ActiveInventory != null)
{
player.ActiveInventory = null;
}

else if (GetLocationType(mouse.x, mouse.y) != eLocationNothing)
{
ProcessClick(mouse.x, mouse.y, eModeLookat);
}
}

// Left Mouse Button on Inventory Item
// when no inventory is selected:
// - INTERACT with target
// - SELECT target
// else
// - USE inventory on target
else if (button == eMouseLeftInv)
{
InventoryItem *i = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if (i != null)
{
if (i.GetProperty("propInstantUse") == true)
{
if (player.ActiveInventory == null)
{
i.RunInteraction(eModeInteract);
}
else
{
i.RunInteraction(eModeUseinv);
}
}
else
{
if (player.ActiveInventory == null)
{
player.ActiveInventory = i;
}
else
{
if (i.ID != player.ActiveInventory.ID)
{
i.RunInteraction(eModeUseinv);
}
}
}
}
}

// Right Mouse Button on Inventory Item
// when no inventory is selected:
// - EXAMINE target
// else
// - DESELECT INVENTORY
else if (button == eMouseRightInv)
{
if (player.ActiveInventory != null)
{
//player.ActiveInventory = null;
return;
}

InventoryItem *i = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if (i != null)
{
i.RunInteraction(eModeLookat);
}
}

}


when i rightclick the inventory item the following function is called:
Code (ags) Select
function iInvItem1_Look()
{
player.Say("this is an X");
}

but during the time the player says "this is an X" the item in the inventory disappears, and appears again afterwards
Title: Re: Look at item in inventory disappears during execution of event
Post by: Khris on Tue 15/07/2014 21:36:55
Can you confirm that this happens only to the inventory item that was clicked? If you have more than one item in your inventory, do they by any chance all disappear?
Does this happen during unrelated .Say commands?
Title: Re: Look at item in inventory disappears during execution of event
Post by: omegamit6zeichen on Tue 15/07/2014 22:02:06
i've checked, all items in the inventory disapear, and also when say commands unrelated to the inventory are done
Title: Re: Look at item in inventory disappears during execution of event
Post by: Ghost on Wed 16/07/2014 00:08:10
Completely disappear, or "grey out"? I wrote the TwoClick module and never had anything like this happen, so it must be something you changed- did you change the "Gui display style" in General Settings in some way? Or made a new game and just copied the script into it? By default AGS greys out GUI controls when a blocking/wait command is run.
Title: Re: Look at item in inventory disappears during execution of event
Post by: omegamit6zeichen on Wed 16/07/2014 08:16:43
okay i found it, i was completely overlooking it:
under visual is an option "when player interface is disabled, GUIs should" .. was set to hide all their control ...

just to anser your question .. yes i was starting with an empty template ..
Title: Re: Look at item in inventory disappears during execution of event
Post by: Ghost on Wed 16/07/2014 15:01:44
Quote from: omegamit6zeichen on Wed 16/07/2014 08:16:43
under visual is an option "when player interface is disabled, GUIs should" .. was set to hide all their control ...

Yes, that was what I meant. Good you got it solved :)