Not being able to cancel a "click" is very annoying
Posted: Wed Dec 24, 2014 6:18 pm
I am faced with the same problem I had when trying to get chests to unlock with keys and not lock picks. The major problem is how the Clickable component works. If an object has one and its enabled, there is a built-in behavior that executes after the onClick() function fires AND YOU CANNOT STOP IT. Well, we did make it cancel itself for the chest to get key unlocks to work. We faked-it-out basically by removing the held object so that when the built-in code executed it didn't do anything because the object was gone. I was amazed it worked to be honest.
So my current situation has no work around that I can find. I have a pull chain defined for a door (castle_door_button). I can add my own onClick() hook for the button but there is nothing I can do to stop it from calling open() on the door. Even in the door's onOpen() I cannot seem to stop that event either. Sure I can disable the clickable component but I want conditional logic so that I can decide whether I want the click to go through or not.
In any event-driven language like Java for example, you can cancel an event to stop it from bubbling. Now I know this is a game not a full-blown language but still, this functionality is sorely lacking.
So my current situation has no work around that I can find. I have a pull chain defined for a door (castle_door_button). I can add my own onClick() hook for the button but there is nothing I can do to stop it from calling open() on the door. Even in the door's onOpen() I cannot seem to stop that event either. Sure I can disable the clickable component but I want conditional logic so that I can decide whether I want the click to go through or not.
In any event-driven language like Java for example, you can cancel an event to stop it from bubbling. Now I know this is a game not a full-blown language but still, this functionality is sorely lacking.