Bassically, it consists of three separate steps to achieve this. (Press space to test) Step 1. Have a "When timer > 0" with a "When VARIABLE = 1" condition under it. (This is the code that triggers after the project has been stopped) Step 2. In your stopping command (Ex. When space pressed, when I receive message, wait until A < B) have it say "Set VARIABLE to 1" than, "Reset timer" and then finally run "Stop All". Step 3. This is the last and easiest step. Get a "When green flag clicked" block to reset the example variable(s)
I have always wanted a "Stop All Then" command for scratch. A type of command that stops EVERYTHING in the project except a single line of code. But I was never able to make it work besides "Any input". But now! I figured it out! It's super useful for death detectors in your games! Try it out!