[Solved] Look at item in inventory disappears during execution of event

Started by omegamit6zeichen, Tue 15/07/2014 18:02:28

Previous topic - Next topic

omegamit6zeichen

Hi, i am using a slightly modified version of the TwoClickEventHandler
Code: ags
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
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

Khris

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?

omegamit6zeichen

i've checked, all items in the inventory disapear, and also when say commands unrelated to the inventory are done

Ghost

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.

omegamit6zeichen

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 ..

Ghost

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 :)

SMF spam blocked by CleanTalk