Using Global Variables for Device Lists


#1

1) Give a description of the problem
I have a Device variable that will contain a list of physical devices (light switches).
I have a “master” (calling) piston that sets the global variable to the desired list of devices (depending upon which Routine triggered the master piston), and then calls a “slave” (callee) piston which turns those devices ON (relying on the updated value of the global variable). But I have noticed that the global variable does not seem to get updated before the callee piston executes. Instead, it uses the prior value of the global variable. I tried inserting delays, configuring the callee piston to “wait for execution” and a few other things, but nothing seems to work (at least not reliably).

2) What is the expected behaviour?
I would like the global varilable to be updated before I call a piston which relies on the updated value.
I tried passing a local variable as an argument to the callee piston, but discovered that was not supported for Device List varilables.

3) What is happening/not happening?
The callee piston uses the prior (non-updated) value of the global variable.

This seems so simple, but I cant make it work reliably.
Appreciate any suggestions.


#2

Global variables only “get set” when the piston that changes them exits.

So if you in piston A set a variable and call piston B, the change piston A made did not get saved until piston A exits…

Since A calls B, B will see the original state of A…