Ahoy all,
So I'm taking a short break from the meat of my game and coming back to a small issue I've had since starting to develop my own GUI. I've managed to create null event handlers for standard interactions with a simple application of the IsInteractionAvailable function, but I am having trouble working out how to make a null event handler for when the player clicks an inventory item on a hotspot, character or object that is not an expected interaction. I attempted the following:
if (IsInteractionAvailable(MouseX, MouseY, eModeUseinv) == 0){
player.Phylactere("I can't use that there.");
}
else {
if (lt == eLocationCharacter) {
Character *c = Character.GetAtScreenXY(MouseX, MouseY);
c.RunInteraction(eModeUseinv);
}
...
}
And it works to a point, but it is also a dead giveaway that something has an item interaction, because if there is any item interaction available at all, it reverts back to no interaction at all. I tried Inventory.IsInteractionAvailable(), but that seems to be just the same as the above, when clicking on an item in the inventory itself. Not quite what I was looking for. Is there another function that I should know about?
If you want to obscure whether there's a meaningful interaction or not, you have to manually call an unhandled() function after checking for "player.ActiveInventory".
Either use the built-in unhandled_event() or write your own unhandled() function. The former, if it exists, will be called by AGS when no function is linked to an event (IsInteractionAvailable is usually used before clicks, to say, highlight the cursor).
I prefer writing my own (and "redirect" to it from unhandled_event), since AGS uses a really weird scheme when it comes to determining which action was used on what.