Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Beginner Question About Switch Case

$
0
0
Hi Guys,

New to Twine and trying out the different builds. Decided to stick to Sugarcube and try to make it work. I got a little problem making Switch Case work.

So to start, I'm trying to implement a haunted mansion, with sanity being one of the ongoing stat of the reader.

I'm testing the switch functionality by putting it in the second passage of the story. At the start of the passage, sanity will drop. I will then go to a different room (passage) then back to this one.

This is the switch code.

<<switch $sanity>>
<<case lte 80>>
You feel slightly faint. Is it something in the air?
<<case lte 60>>
Your head starts to throb. There is a slight numbing pain in your brain.
<<case lte 40>>
The headache seems to be getting worse. You feel liquid oozing from your right nostril. You dab it with your fingertip. Is that blood?
<</switch>>

First of all, I know the code is wrong. It should go in ascending order. But the weird thing I realised was that each case only triggers one and then never again.

So sanity =
80 - slightly faint
70 - nothing happens
60 - numbing pain
50 - nothing happens
etc.

Is the function supposed to work this way?

Viewing all articles
Browse latest Browse all 1844

Trending Articles