Can one piston change the state of another piston?


#1

I was just curious if it was possible for one piston to change the state of another piston.


#2

Indirectly, yes…I have done this by using Piston A to execute Piston B and send the state as a variable.

Piston A
Do Stuff
Set variable state = data
Execute Piston B and send variable state

Piston B
Set variable state = bool($args.state) ? $args.state : state
Set piston state = state

I set a state variable first so that I can test the existence of the $args. $args will return null if the piston is executed by other means (without the state arguement). If $args is null, the piston will maintain the previous data.


#3

Thank you :slight_smile:


#4

Could you possibly show two small examples of an A and B piston. I understand how it’s supposed to work, but I’m having trouble setting it up.


#5

Sure…over simplified example, but has all the elements…i would share some of my own that are currently in use but they are a little complicated and don’t want to muddy the waters.

Piston A


Piston B


#6

I understand. These are perfect. Thank you! :slight_smile: