I want to share some general thoughts about logical operations. In conjunction with the translation of triggers to variables, it can greatly add to your event sheets being well arranged while covering even difficult parts.
A logical or is not the same as in our language. If we say "red or blue" we really mean "either red or blue". But a logical or means "any of the conditions", even if both are true. This seems to not make a huge difference, but think about a real world example. Let's say, we want a shirt in "red or blue". We look around the shop and if a shirt is either red or blue, we try it. But with a logical or we would also look for a blue and red striped shirt.
Consequence: A logical or evaluates to false only if both conditions are false (if there are no red shirts, no blue shierts and no red and blue striped shirts, in the real world example)
There are situations, where you would need a logical or that behaves like "either a or b", to make it exclusive. That's called a logical exclusive or (XOR). Construct does not provide this, but you can do it with a combination of AND plus OR.
(global('a') = 1 AND global('b') = 0) OR (global('b') = 1 AND global('a') = 0)
it would exclusively be only true if either a = 1 or b = 1, but not when both = 1 or both = 0. Take care of the brackets, btw, they show Construct that you first want to logically operate both ANDs and then operate on those results.
This works because AND only results to true if both conditions are true. Let us have a look at how the cpu sees such an evaluation.
a = 0, b = 0 given:
(global('a') = 1 AND global('b') = 0) OR (global('b') = 1 AND global('a') = 0)
(FALSE AND TRUE) OR (FALSE AND TRUE) => FALSE OR FALSE => FALSE
a = 1, b = 0 given:
(global('a') = 1 AND global('b') = 0) OR (global('b') = 1 AND global('a') = 0)
(TRUE AND TRUE) OR (FALSE AND FALSE) => TRUE OR FALSE => TRUE
a = 1, b = 1 given:
(global('a') = 1 AND global('b') = 0) OR (global('b') = 1 AND global('a') = 0)
(TRUE AND FALSE) OR (TRUE AND FALSE) => FALSE OR FALSE => FALSE
a = 0, b = 1 given:
(global('a') = 1 AND global('b') = 0) OR (global('b') = 1 AND global('a') = 0)
(FALSE AND FALSE) OR (TRUE AND TRUE) => FALSE OR TRUE => TRUE
Another logical operation is NOT, which reverses to the opposite, so that TRUE Becomes FALSE and FALSE becmes TRUE. By decribing this, you may already notice that Construct does provide this only for complete conditions in the form of "invert condition". If you do this to the example above, it will exclusively become true if either both = 0, or both = 1.
[inverted](global('a') = 1 AND global('b') = 0) OR (global('b') = 1 AND global('a') = 0)
is the same as
(global('a') = 0 AND global('b') = 0) OR (global('b') = 1 AND global('a') = 1)
End of lesson ;)