Conditions β
A condition compares two values. If the comparison is true, one function runs; if not, another one does.
If $state == ON
ββ true β run "turn_off"
ββ false β run "turn_on"Operators β
| Operator | True when |
|---|---|
== equal to | A is the same as B |
!= not equal to | A is different from B |
> greater than | A is larger than B |
< less than | A is smaller than B |
>= greater or equal | A is larger than or the same as B |
<= less or equal | A is smaller than or the same as B |
What can be compared β
Each side can be a fixed value, a user variable ($name) or a system variable (!name). Both sides must be of compatible types:
| Allowed | Not allowed |
|---|---|
| number with number (integer and float mix freely) | text with number ("A" > 2) |
| string with string | vector with number |
| key with key, or key with string | |
| vector with vector |
For strings and keys, == and != are the meaningful operators. Comparisons are case-sensitive: ON and on are different.
Success and failure β
Every condition has two outcomes, each a small branch function: success runs when true, failure when false. Either can be left empty. Branches are created from the buttons on the condition's card and do not appear in the main function list; see Creating a Condition. Their memory is counted as part of the function that holds the condition.
After the chosen branch runs, the original function continues with its next action.
Nesting β
A branch function can itself contain a condition. That is how you build "if owner, then if face 2, thenβ¦". Two or three levels are readable; beyond that, rethink the design.
Cost β
Conditions are the most expensive action to run: each one is a small detour through the add-on script. Guidelines:
- A few conditions per click: fine.
- A condition inside a fast Timer loop: keep the delay at 0.1 s or more.
- Dozens of chained conditions: noticeable delay. Split the logic or use fewer states.
Memory cost is modest: 40 units per condition, plus 30 for each branch that has actions, plus the actions themselves.
Debugging tip β
Add a Message as the first action in each branch ("branch: on", "branch: off") while you test. Delete them before Finish.