As part of a menu sidebar, I'm trying to have the menu items open collapsible blocks of inline text - rather than go to a new passage. I was being stymied by the fact of hooks being single-use-only, but after ennead figured out
this workaround I've tried implementing it.
The problem is, instead of giving me a single link that I can click to either show or hide the block of text, it's making the entire block of text clickable and attaching the action to it. I'm not sure
why, since I'm only attaching the click macro to the menu-item hook, but it's attaching the click macro to the "big" hook.
I currently have three passages, which I've added whitespace to in order to make what I did more obvious.
"menu" passage:
<div id="statmenu">(display: "hide stats")
</div>
"show stats" passage:
[
|stats>[''Your Profile'']
Honesty: (print: $player's Honesty)
Bravery: (print: $player's Bravery)
Wits: (print: $player's Wits)
Kindness: (print: $player's Kindness)
]<statlist|
(click: ?stats)[
(replace: ?statlist)[]
(replace: ?stats)[(display: "hide stats")]
]
"hide stats" passage:
[''Your Stats'']<stats|
(click: ?stats)[
(replace: ?stats)[(display: "show stats")]
]
Is there something I'm missing, or a better way of doing this without resorting to Actual Javascript?
Comments
A (replace:) macro replaces the contents of a hook, not the hook itself.
I got it to work now! For posterity's sake:
"menu" "hide stats" "show stats"