Hi! I am using 1.4.2 and Sugarcube 2.10.0, and I am a total newbie to Twine. I am writing a story in which one of the choices the player can make corrupts him gradually, distorting his perceptions. I would like to signal to the player that this is happening by changing the font of the passages encountered, so that the text of the game gets progressively harder to read as the corruption gets worse. I have a beautiful pack of Halloween fonts that will do nicely for this. Anyway, I've thought of one way to do this which seems to work, which is to wrap each passage like so:
<<if $corrupt is 1>> <span style='font-family:BloodyBlessing'>This is totes text. Observe its text-ness.
Yes
No
</span> <</if>>
...but that seems sort of sloppy. What I am hoping is that there is some other, better way to do this. My theory about one possible better way to do this would be if I could apply new tags to all story passages based on a variable (like, if corrupt = 1, give all passages new tag "corruptOne
Comments
Since it sounds like you want this to trigger off of the value of the $corrupt story variable, you could do something like the following: (goes in the PassageDone special passage; simply a passage with that, case-sensitive, name) If the value of $corrupt is greater than zero—don't forget to initialize it to 0 within the StoryInit special passage—it adds a class to the <body> element named corrupt-#, where # is the value of $corrupt—e.g. corrupt-1, corrupt-2, etc. This uses a backtick expression (near the top) to concatenate the base class name with the value of $corrupt.
Also, if necessary, you could accomplish the same thing without using the value of $corrupt as part of the class name via a longer <<if>> or <<switch>>.
And the necessary CSS: (goes in your Story Stylesheet) Obviously, I made up the last two font names, however, you should get the idea.
Basically, more or less what CK advised with some extra details and caveats.
You were on right track. I do have a few very minor nitpicks though.
I have tried TheMadExile's suggestion, and it works beautifully (no surprise there). Thanks! My game is going to be a lot better because of you.
BTW, I ended up posting my question before I meant to. Meaning to hit Save Draft, I clicked a button... and then, suddenly, as far as I could determine, my post was Beyond Recall. I am pleased to see that I seem to have asked my whole question.
Thanks again, both of you!
If you add a class to a passage with an existing tag (assuming that this wasn't due to some bone-headery on my part, implementation-wise), the class will, it appears, only apply to the sidebar. At least, that is what it looks like. All I actually know is that the font changes only in the sidebar in my tagged passages. Which actually makes a lot of sense, now that I think about it.
So, I think I have figured out a way to implement TheMadExile's and klembot's solutions without losing the stylesheet I have already set up. Anyway, I have tested it in every way I can think of, and it seems to work. I put it up here both for critique and for other people who want to do this same sort of thing:
Thank you again, TheMadExile and klembot! "My" solution is just a sort of Frankenstein's Monster-esque patching together of your suggestions, and well I know it.