How do I set up an if statement to check if a variable is the highest out of four separate variables.
I assume I can say:
(if: $variable1 > $variable2 and $variable3 and $variable4)[run script A]
(if: $variable2 > $variable1 and $variable3 and $variable4)[run script B]
(if: $variable3 > $variable2 and $variable1 and $variable4)[run script C]
(if: $variable4 > $variable2 and $variable3 and $variable1)[run script D]
But what if there is a joint highest - how can I give an order of priority so that only one script runs no matter what.
For example, I want script a to take priority over scripts B, C, and D - so if A and C are tied, it is script A that gets run
Comments
Unless the $variable2, $variable3 and $variable4 variables in your first (if:) macro example contain Boolean values, that is not how you use the and operator to test multiple conditions/expressions.
It should look similar to the following:
One method to do what you asks is to first determine the maximum value contained within your variables, and then you can compare that max value to each of your variables (in the order of importance) to see which one equals it.
note: You can use an (else:) macro to catch the last of the variable checks, because if it is not one of the other variables then it must be the last one. ... If you want variable 4 thing to be more important that variable 2 thing then just change the order of the variables.