How to cancel a piston running


#1

Hi,
I have a piston running that I want to cancel triggered by other piston

Piston A cancels (not pause) Piston B.

thanks


#2

you could use a virtual switch or global variable, and make piston B only work if the virtual switch or global variable is turned on or true and then make piston A turn on/off true/false that virtual switch/global variable :roll_eyes:


#3

The other piston is already running…I want to stop it…


#4

That will stop it. It can only work if the virtual switch/global variable is on/true.

Upload a green snapshot of both pistons and I’ll modify it for you.


#5

If this condition takes place…

Then cancel/break this piston…even if it started already (e.g line 36)

thanks


#6

The only thing I can think of is add an event trigger in the second piston that subscribes to an event from the first one that can call the ‘cancel all pending tasks’ task within that same piston since I don’t think there’s a global cancel pending tasks.


#7

Ok. First I’m curious what fires your second piston? It’s not subscribing to any events?

Ah. I think I’ve worked it out. Did u mean you want your first piston to activate the second one. And also to cancel it if the conditions in the first piston happen again?


#8

Give this a go.

Create a global variable called.
@OverrideSwitchIsOn

Then import these two pistons and modify the variables to match your lights and sensors.

I’ve made this on my cell while at work. Might be worth trying it before you commit to it. Because obviously I haven’t tried it. But it looks like it could work how you want, if I’ve understood what you meant??? :grinning:

UPDATED Don’t forget to run it once first to setup the variable correctly. Or use the soft edit function. Don’t hard Code a value to the variable or it will always reset back to that value upon every run.


#9

Thanks…it looks it is working…


#10

If this has solved your query please can you check the tick :white_check_mark: box on the solution so other people will be able to find the solution easier in future.
Cheers. :+1:t3: