0 votes
by (160 points)

Hi there,

Can you check if 1 variable is greater than multiple variables inside the same if statement. Is there a macro or an expression that lets you do that? Sounds simple, right? I'm working with Twine 2.2.1 (Harlowe 1.2.4). Something like this (obviously, the & between each variable doesn't work):

(set: $kiss to 0)
(set: $compliment to 0)
(set: $insult to 0)

(if: $kiss > $compliment & $insult)[Oh... wow. I wasn't expecting that!]
(elseif: $compliment > $kiss & $insult)[Thanks... that's so nice of you.]
(elseif: $insult > $kiss & $compliment)[You insult me... for some reason.]
(else:)[You don't do anything.]

Cheers.

1 Answer

0 votes
by (63.1k points)

You need to use the word and, not &. Also, while Harlowe will try to figure out what you mean (sometimes even correctly), it's best if each expression is complete when you join them. 

(if: $kiss > $compliment and $kiss > $insult)[... 

If you need to compare a whole lot of values and see if one is higher, you can use the (max:) macro as a bit of a shortcut: 

(if: $kiss > (max: $compliment, $insult, $something, $anotherthing))

This will return whichever number is highest in the (max:) macro and compare just that number against $kiss. 

by (160 points)
Beautiful. Both options work out quite nicely. Thank you very much.
...