Rule Bug.
Omegas7
Member Posts: 37
variable = 5
RULE: variable higher than 4
.......... variable = 4
otherwise
.......... move down
end
------
Output: Variable sets to 4 and then moves down.
It shouldn't move down because variable is higher than 4 (being 5).
Since it is higher than 4, it will set itself to 4.
BUT, the otherwise would be executed because now the variable isn't higher than 4!
...
RULE: variable higher than 4
.......... variable = 4
otherwise
.......... move down
end
------
Output: Variable sets to 4 and then moves down.
It shouldn't move down because variable is higher than 4 (being 5).
Since it is higher than 4, it will set itself to 4.
BUT, the otherwise would be executed because now the variable isn't higher than 4!
...
Comments
Now if you just wanted to set any number greater than 4 for that variable, then use the ≥. That will set the variable to 4, and the condition will still be true and the otherwise won't be activated.
However, any future changes to that variable(attribute) that make it ≥ 4, won't reactivate the TRUE behaviors to set the variable to 4 since it will still be true.
variable = 5
RULE: variable higher than 4
.......... variable = 1
otherwise
.......... move down
end
-----
I think that when a rule's block (true or otherwise) executes, it should ignore the other block... So when it sets variable to 1, ignore the otherwise block.
Like in other programming languages...
variable = 5
if variable == 5
variable = 1
else
move_down
end
Rule: Key "left" is down
........ Move left
otherwise
........ Move right
Rule: Key 'left' is down
.......... Move Left.
end
Rule: Key 'right' is down
.......... Move Right.
end
-----
Anyways, is my problem a bug? Or it was planned like that?
Ty for the help so far btw.
Maybe in a future version? Or an option that says 'Ignore this block if other already executed'.
Make a boolean attribute called ThisRuleWasInitiallyTrue = false
With variable = 8
Rule(Any): variable > 5 OR ThisRuleWasInitiallyTrue == true
..... ThisRuleWasInitiallyTrue = true
..... variable =3
Otherwise:
..... Move