Toggling Page Enchantments With A Variable And A Cycling Link: Is It Possible?
Second-time asker, still extremely new to coding. I am attempting to code a feature in a Harlowe project in which the player can click a cycling link on the sidebar that toggles the status of a variable, and that variable enchants the page depending on its status. I have stored this custom sidebar in a header, and the code in said header page goes as follows:
(replace: ?sidebar)[''Lights:'' (cycling-link: 2bind $lights, "off", "on")]
(if:$lights is "on")[(enchant:?page,(text-colour:black)+(bg:white))]
(if:$lights is "off")[(enchant:?page,(text-colour:white)+(bg:black))]
However, this does not create the desired effect of being able to toggle the enchantments via clicking the link. I have also tried deleting the enchantments from the header itself and simply attaching the two (if:) macros to the top of every page, but this doesn't work, either. If possible, although not necessary, I would also like to be able to incorporate a transitional animation into the process of changing the enchantment. I have done a fair amount of troubleshooting, but nothing seems to work the way I want it to. Is this actually something that can be done?