0 votes
by (170 points)
Hi everyone,

I'm trying to get IF macro to check on several conditions. Since it's percentage skill check, it needs to check is the roll is up to a certain value (which is ok) but also what roll is made. because double digits are considered critical success or failure (similar to Delta Green RPG)

So it looks something like this:

(if: $SkillRoll <= $ASkill and (($SkillRoll = 11) or ($SkillRoll = 22) or ($SkillRoll = 33) or ($SkillRoll = 44) or ($SkillRoll = 55) or ($SkillRoll = 66) or ($SkillRoll = 77) or ($SkillRoll = 88) or ($SkillRoll = 99)))[something happens]

I get errors about booleans, and cannot make it work. Any ideas?

Cheers & Thanks!

2 Answers

0 votes
by (140 points)
Perhaps a way to clean it up is to check is the number is divisible by 11 instead of checking for all the individual numbers.
by (170 points)
Interesting approach. How would you put in terms of IF macro?
0 votes
by (159k points)

Please use the Question Tags to state the name and full version number of the Story Format you are using, as answers can vary based on that information. Also please use the Insert Code Snippet button when adding code examples to your questions or comments, it makes it easier to find and read those examples.

A single equals sign "=" is used to perform an assignment, so it is the equivelent of the to operator.

(set: $variable = "value")

(set: $variable to "value")

A double equals sign "==" is used to perform a comparison, so it is the equivelent of the is operator.

(if: $variable == "value")

(if: $variable is "value")

a. A triple equals sign "===" can also be used to perform a comparison if the data-types of the two things being compared are the same.
b. Because people often mistakenly use the wrong number of equal signs when doing assignment or comparison I generally recommend using the to and is operators instead.

So your example is actually assigning the values 11, 22, 33, 44, 55, 66, 77, 88, and 99 to the $SkillRoll story variable, not compating that variable to those values.

You can use the JavaScript Modulus / Remainder operator "%" to determine if the current numerical value in $SkillRoll is an exact multiple of 11.

(if: $SkillRoll <= $ASkill and $SkillRoll % 11 is 0)[something happens]