Quote from: KhrisMUC on Fri 04/05/2007 22:13:03
This can be done by using unhandled_event.
Add it to the global script:Code: ags function unhandled_event (int what, int type) { if (type==3) { // use inv on InventoryItem*i=player.ActiveInventory; player.Say(i.GetPropertyText("unhandled"); } }
In the Custom properties editor, add a new string property with name "unhandled" and a default value of, say, "That doesn't work."
Now enter an appropriate message for every inv item.
This will work for every hotspot/char/object... with a blank "use inv on ..." interaction.
If there are actions in "use inv on ..." defined:Code: ags if (player.ActiveInventory==iKey) { // intended item(s) ... } else unhandled_event(1, 3);
If this doesn't work, try I'm- and exporting unhandled_event.
If it still doesn't work, add this below the declaration of unhandled_event:Code: ags function unhandled() { unhandled_event(1, 3); } export unhandled;
and import it in the script header, then call unhandled(); at the end of the interaction.
I've tried this quite a few times now, altering it and trying to get it to work, and keep getting an error:
"We're sorry, the AGS editor has encountered a serious error and must shut down...
(Exception 0.0000000 at EIP=0x0000000,
AGSEDIT v2.72.652, SIP=26)
Ideas on the reason? This happen when I put KhrisMUC's code into the global script and test the game. Something about is either wrong or then there's a problemn with something else.