When blocks using incorrect variable value

1 sentence description of the problem:
The “when i get a mesage” block is using the incorrect, outdated value of a local variable
Steps to reproduce the problem every time:
(Start in a blank draft if possible)

  1. Add an object
  2. Outside of any rules, set a local variable to some value (ie “first”)
  3. When game starts, create a clone, then immediately destroy.
  4. When object is cloned, set the local variable from earlier to something else (ie “second”), then broadcast a message named the old value (ie “first”)
  5. Add a when I get a message rule, and use the local variable as the message name

I expected this to happen:
The when I get a message rule to never run, because by the time the message is broadcasted the variable has changed values
But instead this happened:
The rule does run, and code inside of it sees the correct value for the variable.

This bug affects all when blocks, even “when =”

It is also important that the variable is a local variable.

6 Likes