# Order of operations for conditions?

I have a logic routine in a project I'm working on, where a condition evaluates as true if the following are true:

• X is equal to 3
• Y is equal to 3
• Z is equal to either 2 or 3

This logic would be represented in standard order of operations as:

`X=3 AND Y=3 AND (Z=2 OR Z=3)`

Is it possible to do this with Storyline 2?  From my observation, it appears that the program has no consideration for order of operations.  Thus my condition would evaluate as true if `X=3 AND Y=3 AND Z=2`, and also evaluates as true if `Z=3`.  If my observations are correct, it would therefore be possible for Z to equal 3 but either X or Y not be equal to 3.  In such case, it should evaluate as a false condition, but apparently does not.

How does Storyline 2 handle conditions with multiple `AND`s or `OR`s? Is there a way to achieve something like this without a workaround like using hidden objects and states?

###### 4 Replies

Just noticed the "between two values" operator, which makes it possible to perform the logic example above:

`X=3`
`AND Y=3`
`AND Z [IS BETWEEN] 1 and 4`

But that operator won't always meet the need for logic involving `AND`s and `OR`s.  I would still like to know how Storyline 2 handles things, and if there's another way to go about this.  (And definitely would request richer logic handling  for conditions in future versions.)

To do the exact logic you have here is beyond SL's abilities

X=3 AND Y=3 AND (Z=2 OR Z=3)

On the other hand, the example Wendy cited is a good work around if you are in a situation where the IN BETWEEN option does not work..

Set the state of the object, or the variable to CORRECT. then with two separate triggers, set it to False

1.     IF X !=3 or Y != 3

2.    IF Z!=2 and Z!= 3

I watched Jeanette’s screen recording, and I’m trying to wrap my head around how that could be done with numeric variables in the absence of user interaction.  (Just for some context, I’m using this logic to change the states of menu buttons, while allowing a user to jump around in the menu freely and keep track of the slide he should be going to next.)

My solution was to implement a variable for each menu button, and apply conditions which restricted variable changes unless they met a known previous condition (i.e., change the state of this button to Disabled, but only if its previous state was a custom state of “In Progress”).  It required a lot of extra triggers, but I think it was more efficient than creating extra objects and using their states to achieve the logic.

The ability to “nest” conditions would still be a nice feature to have in Storyline.  Thanks, all!