Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Mon 26/06/2006 14:51:56

Title: Simulate click on GUI?
Post by: on Mon 26/06/2006 14:51:56
Hello, i want to know if it's possible to simulate a clik on the GUI, becouse with process.mouseclick it doesn't do it in the GUI.
It's possible?
Title: Re: Simulate click on GUI?
Post by: Ashen on Mon 26/06/2006 15:03:06
AFAIK, not directly. It's possible to call the Control functions for the buttons (btnIconSave_Click(btnIconSave, eMouseLeft); would trigger the Save button from the Iconbar GUI, for example) - but obviously that's not practical for use in on_mouse_click. This might be one of the times where interface_click is preferable to the individual Control functions.

What exactly are you trying to do? There might be a way, but we need details.
Title: Re: Simulate click on GUI?
Post by: on Tue 27/06/2006 00:09:05
I want to simulate a click over a inventory item, becouse i made my own GUI and for interact with i used cursor 8.
In inventory object interactions I have for “ other click on inv. Item”  a run-script action with :
mouse.Mode=2; 
because I want to use that object with something (if I have a match, and I want to light it on will go there), but I have to click twice over the inventory item.
Is it a way to solve this?
Tell me if you don't understand.
Title: Re: Simulate click on GUI?
Post by: Ashen on Tue 27/06/2006 00:18:31
I'm not sure I do understand.
What do you want Mode 8 to do? Currently, I think it just changes the cursor mode to 2 (eModeInteract), so the second click runs that interaction - by default, this'll make the item the Active Inventory, allowing you to use it on things. If this is what you want, you might as well use mode 2 in the first place...
If it's not, you need to replace mouse.Mode=2; (in the 'Other click on item' interaction) with the coding for whatever you want to happen on the first click. (If I understand correctly, you'll want to either remove the match Item from the Inventory, and replace it with a lit one, or change the Item's graphic to a lit match.)

You can ignore my first post - I thought you were talking about simulating a click on a GUI Control (Buttons, etc), not an Inventory Item. (You can simulate Item clicks with InventoryItem.RunInteraction (http://www.adventuregamestudio.co.uk/manual/InventoryItem.RunInteraction.htm) - but I'm not sure that's actually what you want here.)

EDIT: Although, it might be ... By some odd quirk it seems like  actually clicking an item in eModeInteract will set it as the Active Inv, but using Item.RunInteraction(eModeInteract) will actually run any interactions under 'Interact inventory item'. Still seems like a pointlessly rounndaout way to do it, though.