Hi, i am using a slightly modified version of the TwoClickEventHandler
Code: ags
when i rightclick the inventory item the following function is called:
Code: ags
but during the time the player says "this is an X" the item in the inventory disappears, and appears again afterwards
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:
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