A collection of frequently asked questions related to the automation functionality.
Since version 6.1 the global variables keep state. This means that variables inside the global object are only initialized once. As a result, some behavior has changed.
For instance, before, you could write:
and then in your layers use [global].bat, which would always have the latest value of [bat_p] because the global script was executed every frame. Also [global].variable would always be 10.
Now inside a tap automation, you can do things like:
This would change the state of the [global] object (the value of the variable becomes 15). If the global script was executed again, the [global].variable would be set back to 10. We don't want this anymore because we want it to keep state!
When the [global] script is only executed once, you can change variables from other scripts and it will keep state! Great, that is what we want. But.. this will also mean that [global].bat = [bat_p] is also only executed once, so [global].bat will only have the battery level at the moment it was initialized. Thus, those kinds of statements may not work as intended anymore.
What you should do now is:
and then use [global].bat() as a function in your layers, this will return the latest value of [bat_p].