Hello all. Very new to Twine, and enjoying learning the system. I have had lots of success so far using variables, links, and other fairly basic tools.
I've now upgraded from sugarcane to Sugarcube and have two questions that seem simple. Haven't been able to find a clear answer so far:
1) What is the best way to change the background color for the entire story? I have tried using a stylesheet but can't get it to work, and haven't found a clear explanation for this thus far.
2) I had lots of variables working when I used sugarcan. I then converted over to Sugarcube and they seem to all have been broken. Is there something obvious that I need to update when making that switch?
Thank you very much.
Comments
I feel like I am missing something obvious on both issues.
Thanks!
EDIT: I'll do the same, actually. Attached.
So, if you have a variable that will always be set before it is checked (say it's set in the start passage and not checked until afterwards), it'll work fine. But if a variable can be checked before it is set you'll have to initialise it yourself at the start of the story by setting it to 0.
Put this in a stylesheet passage: Where <COLOR> is any valid CSS color value.
For example, all of these set the background color to white: (this is not an exhaustive reference, see the CSS color value link for more information)
Use the StoryInit special passage and the <<set>> macro to initialize any $variables that may be used prior to being set normally.
So in my case using Sugarcube, I have lots of variables that need to start at different values. Trying to use the StoryInit passage but not having much luck.
1) I create a StoryInit special passage and put all the variables there using standard <<set>> macro, same as was working in Sugarcane.
2) I start all the variables at 0.
3) In the Start passage, I set all the variables to their initial values.
What am I missing?
Also, you should only have to set the variables in either Start OR StoryInit, not both (use StoryInit because TheMadExile knows better than I do!). And if you want a variable to be set to 2 at the start, there's no need to set it to 0 first.
Can you post some example code you are using? I imagine it's a simple problem.
I will add one more thing, however, in your <<if>> macros be sure that you do not include a space between the "else" and the "if" in <<elseif>> clauses. For example: The next release of SugarCube will issue a warning about that, but the current release doesn't, so that could be tripping you up as well.
Honestly, it would be better if the wiki docs here didn't push <<else if>> and barely mention <<elseif>> as a footnote.
When using Sugarcube and creating a special passage like StoryInit, should that passage's banner change color similar to when I create a special passage like StoryMenu? Because my StoryInit is still colored like a normal passage.
As far as code, here is an example of what I had under Sugarcane, working perfect, that seems to be not working properly in Sugarcube:
Probably not, no. Twine would have to know that StoryInit is special. Hopefully, the hooks implemented by the next version of Twine will allow for things like that.
1. You have a space between "end" and "silently", it should be one word (unless something has changed, that's not even allowed in the vanilla headers).
2. What version of SugarCube are you using? Because that should have thrown a error complaining about not being able to find a closing tag for macro <<silently>>.
3. The StoryInit special passage is already silent (save for errors), so <<silently>> is superfluous and can be removed. For example: Also, if $day_number is supposed to be an actual number, rather than a numeric string, don't quote it. For example:
Thank you to everyone for taking the time to assist a new user. Much appreciated!