Quantcast
Channel: Twine Forum
Viewing all articles
Browse latest Browse all 3830

"If and" statement help?

$
0
0
I'm trying to make it to where if the player's relationship count with character Bob is the value 1 or 2, and their name variable isn't or isn't blank, then certain dialogue will show up. I have it like this:

(if: $bobRelationship is 1 or 2 and $name is not "")["I'm sorry, $name."]
(if: $bobRelationship is 1 or 2 and $name is "")["I'm sorry, $defaultName."]

Twine won't allow me to use 'and', so I tried to use '+' instead, but when I do that and $bobRelationship is 2 it will display the first if statement, even if $name is "". If $bobRelationship is 1, then both if statements are displayed! I'm not exactly sure what's going wrong, or how to fix it. I also tried nesting if statements, but that didn't work out.

EDIT

I changed the code, and now the if statements are working sort of. Even if $bobRelationship is 1 or 2, neither of the if statements are showing up. The full code looks like this now:

(set: $followBob to "yes")
(set: $bobRelationship to $bobRelationship +1)
(if: $bobRelationship is 1 or $bobRelationship is 2 + $name is not "")["I'm sorry, $name."]
(if: $bobRelationship is 1 or $bobRelationship is 2 + $name is "")["I'm sorry, $defaultName."]

Viewing all articles
Browse latest Browse all 3830

Trending Articles