Multiple conditional displays in Chapbook

Twine Version:
[also choose a Story Format tag above]

Hello,

I was wondering if anyone has experience using multiple conditional displays?
I have a variable tracked called Time, with the reader amassing this value the longer they take to get to a certain point in the story. At that point I want the text to wary depending on how much time has accumulated.
It would look something like thiis:

[if prep time = 0]
Text

[if preptime = 1]
Different text

[if preptime =2]
Another text

[continue]
Common text

Problem is, even if I have the preptime value be 0, the game shows me all the text except the 0 one. Is there some trick to having multiple conditional displays function do that only one of them shows? All the documentation I can find only mentions the [else] function, but how would that work for more than two options?

Any help or insights would be much appreciated!

1 Like

In conditional statements you need to use two equal signs instead of one, like this;

[if preptime == 0]
2 Likes

Thank you so much! I have only tried one and three equal signs, so this makes me laugh a little :D. You really saved me here, I was pulling my hair in frustration!

Would you also by any chance know how to write the code for a value inbetween two numbers? Something like [if preptime == 1-3] or [if preptime >=1 && preptime <=3]?

Yes, [if preptime >=1 && preptime <=3] will work.

3 Likes

Thank you, you’re my hero :).

I think I have reflexively been using only one = in Chapbook and wondering why my conditionals weren’t working right, so thank you for bringing this up!

2 Likes

The reason Harlowe uses to and is instead of = and ==

1 Like