Need an example of using global variables to trigger a piston (which uses values in variables)


#1

1) Give a description of the problem
I want to create some global variables that my pistons can set, and a special piston that detects changes to these variables and then uses the variable values to do stuff.

2) What is the expected behavior?
Per above, piston would detect changes to global variables, then use those values to perform some action.

3) What is happening/not happening?
N/A

4) Post a Green Snapshot of the pistonimage
N/A

5) Attach any logs (From ST IDE and by turning logging level to Full)
N/A


#2

You can use an On Event statement, i.e.,

On Event @myGlobal
do Stuff
end On

You can then use additional statements (if then, switch, etc) to determine the specific actions to take based on the value of the Global.

Really, a variety of ways to approach this depending on what you’re really trying to accomplish. For example, you could avoid the global variables altogether and simply pass arguments to another piston with the “Execute Piston” statement.


#3

Here’s a sample of one:


#4

Thanks, I’d actually love to learn how to pass args via execute piston. I found the action but how do you set up the piston you are calling to take arguments?


#5

There’s a discussion here that provides some examples.


#6

Thanks that’s just what I needed! Successfully got it working passing three variables from one piston to another. Sweet!