I'm trying to make a string of <<if $var >= x>>words<</if>> <<if $var2 >= y>><</if>> functions, so that my game will list the effects of changes to the character if the player's stats exceed or equal certain values, one after the other. The problem is that it always defaults to the last listed <<if>> function and ignores the prior ones. Any ideas?
An example of the problem passage:
It's not just your ears either, you're getting a little taller, <<nobr>>
<<if $sen >= 4>>your senses are steadily growing sharper, <</if>>
<<if $str >= 4>>you're getting fitter and more flexible, even showing a little muscle for the first time in your life, <</if>>
<<if $mag >= 4>>something strange and wonderful keeps tugging at your consciousness, <</if>>
<</nobr>>and you can't shake the feeling that this is just the start.
Comments
Are you initialising everything? If you haven't yet defined any of the prior variables than it won't display them.
I've initialized everything; I made sure of it. The only passage that displays however is the "something strange and wonderful keeps tugging at your consciousness," one, no matter how high I set the other variables.
I initialize the variables two passages away and while now the variable for strength is displaying properly when I test it, the variable for senses still doesn't seem to work.
I wrote that little segment and inserted it for ease of testing; it's not the actual first passage.
Anyway, you say that you're setting them "two passages away", are you using the <<back>> macro between them being set and going to the problem passage?
Also, FYI. I'm unsure why you put a <<set>> macro directly after the link like that, e.g. the following: But that's effectively the same as doing this: If you were trying to make a setter link, a link that also sets $variables, then that would look like the following: Though, I believe Twine 2 will still do something stupid with that syntax.
And no, I'm copying this all into Twine 2 manually and double-checking my work every time.
When I say "Two passages away" I mean I start my bug test on the passage I posted, click to Day1, then click the link that takes me to the problem passage, the same way a player would in a full play-through. I basically created that testing entry to skip the introduction and initial character set-up.
Can you post an example file which displays the issue?
I cannot fathom a reason for what you're describing to be happening. I created a new story using the code that's been flying around here and I cannot replicate your issue. Could you import and try the attached Twine 2 archive to see if you get the same results.
Let this be a lesson to myself and other newbs: Always clean up your code!