I want a
click ignored if a hook isn't present:
(click: ?Bunyon)[(if: $located is "Quicksand")[(goto: "Lakeside")]
This works when the hook is present, but when it isn't says -
The (click:) command should be assigned to a variable or attached to a hook.
So, I want to do something to test if the hook is present - like this:
(if: $inv contains "Rusty Axe")[(click: ? ... etc.]
Or maybe -
(if: $inv contains "Rusty Axe" and click: ? ... etc.]
But that doesn't work either.
Any help would be gratefully appreciated.
Comments
Hooks (both associated and named) are references, not variables and I can't think of a built-in way to determine if one has been defined of not. You can't check their 'value' like you can with a $variable using code like the following. note: In Harlowe v1.2.3 the above will just silently fail, where as in v2.0.0 it will result in a "Cannot convert undefined or null to object" error because named hooks can no longer be accessed like variables.
Why are you using (click:) macros combined with named hooks when you could do the same with the (link:) macros?
I'll try it with (link:) - It was old code I was finally getting around to revisiting. Whatever my rationale for using click: originally was has been lost in the mists of time.