'_anyClick' versus '_otherClick'

Started by Monsieur OUXX, Mon 18/03/2013 11:22:15

Previous topic - Next topic

Monsieur OUXX

Almost every single element in AGS (hotspots, characters, etc.) has the event "any click on" (related function: '_anyClick')available for scripting.

That event can replace every other event put together with one single function.

However, Inventory Items only have event "other click on inventory item" (related function: '_otherClick'). That event is triggered only when the player uses a cursor mode that is NOT interact,lookat,talk to or use on.

That doesn't seem very consistent and forces to split the script into all the built-in functions (_Talk, _UseInv, etc.).

Is there a way to circumvent this limitation? That is, to intercept any action on an inventory item?
 

Khris

#1
Sure, just use on_mouse_click and eMouseLeft/RightInv (and activate the option in General settings that inventory clicks are handled in script).
In there, use inventory[game.inv_activated] and mouse.Mode.

Edit: If you want to always run the inv item's OtherClick function, just call:
Code: ags
  inventory[game.inv_activated].RunInteraction(eModePickup);

(Not tested)

SMF spam blocked by CleanTalk