Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Player-driven CSS changes

As part of my game I'd like players to be able to 'unlock' new CSS styles and switch between them at will. The implementation I'm using is a Style Menu page, accessible from anywhere on the main branches, with sub-pages for each unlocked style. Going to Style1's page sets $style1 to true and all other style variables to false. Then there's a big 'else if' block at the top of relevant pages that checks which style variable is true and adds a tag for that style, using L's addtag macro.

My questions are:
1) I can't get the addtag macro to fire for valid if statements right now. I'm useless with Javascript and don't understand how the macro works, so I'm not sure if the macro doesn't work for the latest version of Twine (I'm using Twine 1.41 under Sugarcane) or if I mucked up the implementation somehow. Other macros work for the same if statements, though.

2) The way I've come up with is fairly cumbersome since a) the game has a lot of pages I need to change if I want to tweak the else if block and b) ideally I want to give the players plenty of style options, a dozen or so. I haven't added a link to the Style Menu or the else if block to most of the game because of my difficulties with the addtag macro. So if there's an easier/cleaner/better way of doing this that I missed, I'd love to hear it! (I couldn't find anything similar on the google group or the forum.)

Thanks!
Sign In or Register to comment.