#that is greenwarden's volatile code
Explore tagged Tumblr posts
fiddles-ifs · 1 year ago
Note
WAIT oh my god you figured out toggles in twine??? please explain??? I've got a text effect I've been dying to add in my IF but I'm worried it'll be visually too much for some players/a pain for fast readers so I've been trying to figure out how to give folks a toggle option but I don't know how and I haven't been able to find anything helpful... any advice at all you have would be helpful and deeply appreciated!!
Oh Jesus -- I wouldn't say it's a good solution, but it works. Sometimes. Essentially I create a custom class (in my case ".snaggletooth") and in settings I create a toggle for people to either append the class to its dialogue ("true") or leave it as normal text ("false").
The code looks something like this:
var settingSnaggletoothDialogue = function () { if (settings.snaggletooth) { // is true $("html").addClass("snaggletooth"); } else { // is false $("html").removeClass("snaggletooth"); } }; Setting.addToggle("snaggletooth", { label : "Allow animated text for certain characters' dialogues?", default : false, onInit : settingSnaggletoothDialogue, onChange : settingSnaggletoothDialogue } );
Then you add a few lines of CSS code that tells the robot what paragraphs with the .snaggletooth class should look like. Theoretically this should work. I have yet to animate the text because I'm scared.
Also, to note: I'm using SugarCube v2. I'm sure this is different for Chapbook or Harlowe.
18 notes · View notes