TWINE '(if:' problem


I’m pretty much a noob at all this. so if i’ve posted in the wrong forum please let me know.

I’m creating my first story in TWINE 2.1.3 and i’ve come across a problem with one of my ‘if’ statements.

In my story, there are passages that will only give the player certain options depending on what they have picked up, e.g,

(if: $mothersbrooch is false) [ [[You have nothing to unlock cage with->hide camp]] ] (if: $mothersbrooch is true) [ [[Using the pin on your Mother's Brooch, you attempt to unlock the cage->scage1unlock]] ]

This passage works fine. However, the passage before uses the same logic but does not work;

(if: $wineskin1 is true) [ [[Leave the wineskin for him to find->Drunk raider]] ] (if: $wineskin1 is false) [ [[Unlock cage]] ]

The only real difference between the passages is that the one that doesn’t work has one line of story on the line above the ‘if’ statement.

Any help on this would be really appreciated as i’m getting rather frustrated.


Welcome to the forum! This is the right place to post this topic, no problem.

As for your inquiry, maybe it would help to post the full text of the passages from which those excerpts were drawn–this looks like something where the formatting of the line of story above it might be making a difference. (Though I’m a total Twine noob so I’m not the best person to ask.)

Thanks but i’ve found the problem, my $variable was set to $Wineskin1 but my ‘if’ was looking for $wineskin1! Feel like such a fool… is there anyway to delete this thread before anyone else see’s it?

You should leave it; I didn’t know that variables in Twine were case-sensitive, so this is actually helpful!

I wonder if that’s why I’ve never been able to get variables to work in Twine.

FYI, since (if:) is evaluating the provided expression into a boolean, you don’t need to test a boolean variable against a boolean value. For example:

Assuming $var is either true or false:

(if: $var)[
    Variable is true.
    Variable is false.

-> BAD
(if: $var is true)[...