Best way to stop nested Routine

Hello dear List!

I’m wondering what’s the best or “safest” way to stop a nested Routine, I’m finding that calling .stop is not 100% reliable.

~routineCH = Routine{
inf.do {
“do something”
0.3.wait;
}
}

~routineP = Routine{
1.do{
“something”
1.wait;
~routineCH.play;
3.wait;
“something else”;
0.5.wait;
~routineCH.stop;
0.5.wait;
~routineCH.reset;
“something else”
}
}

Many thanks in advance!!

oops, I was resetting before the child routine was over, therefore it kept on going…

Hello dear list,
Is this normal behaviour?
What if I have a Routine that may last anywhere between 10 and 40 seconds, and I need to reset it, and start it again in say 20 seconds. Then it might have or might have not been finished, hmm

I just switched to using Tasks , stop - resume

I recommend having a look at Pspawner, it’s super flexible and elegant for nested sequencing.

1 Like

Thank you Daniel! Yes Pspawner is the way to go,
best!