# How to add variables in Harlowe?

Okay so today is my first day coding/using twine. Im not sure if this is even possible but i'll try to explain it as good as possible.

So I have 5 characters with multiple stats. Eventually one or more characters are going to be able to killed off, depending on which character is chosen by the player different choices will be available to the player depending on the stats of the alive characters.

Right now ive chosen to use the (set:) macro to accomplish this. So if the player has a strength stat of five, character1 has a stat of three, character2 has a stat of 10, character3 has a strength stat of 7

``````(set: \$CHARACTER1strength to 3, \$CHARACTER2strength to 10, \$PLAYERstrength to 5, \$CHARACTER3strength to 7)
``````

and then say they need to open a locked door with a combined strength stat of 15 how would I write this so that any combo of stats that add up to 15 they could open the door?

(also easier question, I saw a couple macros that could work but i was still unsure, what would I use to display these stats)

by (159k points)
selected by

When you say "add up to 15" do you mean:

1. The total of the combined strengths must be equal to at least 15 to be successful, as will any total over 15.
eg. Totals of 16 and above are also be concided successful.

2. The total of the combined strengths must be exactly equal to 15 to be successful.
eg. Totals of 16 and above would be considered unsuccessful.

If you mean point 1 then you can simply sum the individual strengths together and compare the total to the required target value using an (if:) macro like so.

``````(if: \$CHARACTER1strength + \$CHARACTER2strength + \$PLAYERstrength + \$CHARACTER3strength >= 15)[
The combined strenght of everyone is 15 or greater.
]``````

by (150 points)
thats exactly what i meant thank you