Can scene variables be mixed up in a function?

If you call a function twice, one just after the other, then looking in the debugger it uses the same scene variables. How are we sure the variables are not overwritten before the first function was calculated?

An less they’re async one function will execute after another

what if you use one in the other one, the function calls itself

Events are processed as follows:

  1. The first event at the top of the event sheet is processed for conditions.
  2. All conditions are processed in order from top to bottom.
  3. If true, all actions are processed in order from top to bottom.
  4. If any conditions, expressions, or actions are function, as soon as their condition or action (or expression) is processed in the main event sheet, the function event sheet follows the same as above.

So yes, if you have three conditions, the first which is directly checking the variable, the second which is a function that has an action that checks the variable and then changes it, and the third which also checks the variable, the third action could have a completely different result than the first action.

Events cannot be “mixed up” necessarily because they always happen in an order of operations, but it is up to you to know what you’re doing with your functions and how to make sure they’re being used in the correct order as needed.


seems logic. But what about an asynchronous function f1 that I put inside a function f2. If I put return value of f2 “inside” the f1 events, as what’s called a “following event” in the documentation, then f2 will not return a value till f1 did. Correct? Then what happens in the game?
On the other hand if I put return value of f2 in a independent block after f1 is called then the value of f2 will be returned before f1 had time to execute. And f2 will not be corrected afterwards.

Asynchronous events are generally not meant to be used with logic or pieces of other events, because they themselves break the logic of the event sheet. They can interact with logic in their own event fine, though.

I read that. It makes you think you can use asynchronous functions… with logic. So I wonder what “breaking the logic” means. It’s kind of terrible to say we don’t know how it works because it breaks the logic