Discuss Scratch
- PH-zero
-
100+ posts
A "Restart" -block
Hey 
We have a
You can't just use
So you need to mess around with messages.
this block would be easy to understand and i think it wouldn't be too
hard to implement it.

We have a
stop []But what you gonna do if you just want to shut all scripts down and restart the game?
You can't just use
stop [all]because (logically) you can't put another block under this block.
So you need to mess around with messages.
this block would be easy to understand and i think it wouldn't be too
hard to implement it.
restart
- DotDash
-
1000+ posts
A "Restart" -block
Maybe a drop-down? Hey
We have astop []But what you gonna do if you just want to shut all scripts down and restart the game?
You can't just usestop [all]because (logically) you can't put another block under this block.
So you need to mess around with messages.
this block would be easy to understand and i think it wouldn't be too
hard to implement it.restart
Options:
restart [this script v]
restart [all v]
restart [other scripts in this sprite v]
restart [other sprites v]
Last edited by DotDash (Sept. 28, 2013 21:26:58)
- mitchboy
-
1000+ posts
A "Restart" -block
Uh, I can see a problem with this:
when gf clicked
forever
restart [this script v]
- PH-zero
-
100+ posts
A "Restart" -block
Uh, I can see a problem with this:when gf clicked
forever
restart [this script]
But that would be the same as:
when I receive [Start]
forever
broadcast [Start]
The script would only be restarted over and over, no need to worry

- PhirripSyrrip
-
500+ posts
A "Restart" -block
Why is that a problem? Uh, I can see a problem with this:when gf clicked
forever
restart [this script v]
- DotDash
-
1000+ posts
A "Restart" -block
Uh, I can see a problem with this:when gf clicked
forever
restart [this script v]
define crash
crash
This gets the same results.
Last edited by DotDash (Sept. 29, 2013 12:19:57)
- firedrake969_test
-
500+ posts
A "Restart" -block
And broadcasting recursively. AndUh, I can see a problem with this:when gf clicked
forever
restart [this script v]define crash
crash
This gets the same results.
When [timer v] > (0)but it was still added
play sound [annoying sound v]
Support.
- PH-zero
-
100+ posts
A "Restart" -block
I don't quite see a use for this.
It has many uses:
-Restart the game automatically after game over
-Restart the game comfortable, just by pressing a key
-Getting back to the menue by pressing a key (If the menue is the start screen)
The big advantage is that really ALL loops and procedures get stopped.
and then *after* stopping everything, the project starts over.
with the
stop [all]block you can stop everything, but you cannot do anything after this block.
And think it this way: we got the possibility to simulate a “stop-sing-pressed” event.
So why we shouldn't have the ability to simulate a “Green-flag-pressed” event.
- sccar3
-
100+ posts
A "Restart" -block
There's a really simple workaround I like to use:
Replace all “When gf Clicked” Blocks with “When I receive {Green Flag(or something similar)}”
Then make this script on any sprite(although it would make most sense to put in in stage)
Then whenever you want to restart, just broadcast Green Flag.
Replace all “When gf Clicked” Blocks with “When I receive {Green Flag(or something similar)}”
Then make this script on any sprite(although it would make most sense to put in in stage)
when gf clicked
broadcast [Green Flag v]
Then whenever you want to restart, just broadcast Green Flag.
Last edited by sccar3 (Sept. 29, 2013 20:25:41)
- PH-zero
-
100+ posts
A "Restart" -block
There's a really simple workaround I like to use:
Replace all “When gf Clicked” Blocks with “When I receive ”
Then make this script on any sprite(although it would make most sense to put in in stage)when gf clicked
broadcast [Green Flag]
Then whenever you want to restart, just broadcast Green Flag.
I also know this workaround. But then you have to put
when i receive [Stop]
Stop [all other scripts]
on every sprite otherwise some loops will not stop and the game
will be “synchronized”.
- SuperNicky
-
100+ posts
A "Restart" -block
Um whats wrong with clicking the green flag
(excess characters removed by moderator - please don't spam)
(excess characters removed by moderator - please don't spam)
Last edited by Paddle2See (June 10, 2021 23:13:31)
- PH-zero
-
100+ posts
A "Restart" -block
Um whats wrong with clicking the stop sing?
In this case, we don't need a
In this case, we don't need a
stop [all]But we got it anyway

- DadOfMrLog
-
1000+ posts
A "Restart" -block
@PH-zero:
There is a pretty simple workaround for this…
1. replace all your “when GF clicked” header blocks with “when timer>0.2”
2. wherever you want to restart place “reset timer” followed by “stop all”
Tada!
Note: if you do already use “reset timer” anywhere else (or plan to add it for some use other than above trick), and you have some scripts started by “when timer>0.2” that have stopped running by the time you do one of those resets, then you need to add some extra logic to ensure those extra resets get dealt with correctly.
There is a pretty simple workaround for this…
1. replace all your “when GF clicked” header blocks with “when timer>0.2”
2. wherever you want to restart place “reset timer” followed by “stop all”
Tada!

Note: if you do already use “reset timer” anywhere else (or plan to add it for some use other than above trick), and you have some scripts started by “when timer>0.2” that have stopped running by the time you do one of those resets, then you need to add some extra logic to ensure those extra resets get dealt with correctly.
Last edited by DadOfMrLog (Sept. 30, 2013 21:23:59)
- Failord
-
1000+ posts
A "Restart" -block
Suggested before- and logically, it doesn't make sense. I need experience before I can get the job, but I need the job to get experience. A stack only runs when the script is running. The stack won't do anything at all if the script doesn't reach it. Therefore, it's self-defeating. There will be no “restart” stack, because Scratch doesn't work that way. The point is to figure out how to do it yourself- might I remind you that this is an educational site? Broadcasts, c-loops, etc. can get the job done. You just need to get familiar with the code.
if <key [space v] pressed> then //Now how is a script that isn't running going to respond to the boolean? It simply can't.
do stuff
restart
end
Last edited by Failord (Oct. 1, 2013 01:37:42)
- Diamond_Projects
-
100+ posts
A "Restart" -block
when green flag clickedWhat if someone does that?
forever
reset timer
end
when [timer v] > (0.2)
restart :: control cap
It's the same as when stop sign clicked restart.
Last edited by Diamond_Projects (Sept. 17, 2014 13:07:52)
- OmnipotentPotato
-
1000+ posts
A "Restart" -block
It would be nice to have a block that's like restart from label A or something like that. What it would do is bring the script back to where the block “Label A” is at. So, two blocks would be added:
The latter would just be ignored when running a script until it gets the first command, and then the script would jump backwards to the latter block. If there is no block with that id in the script, the goto block would just be ignored. They have blocks like these on the TI-BASIC programming language and they are beyond useful.
Goto label [(label id)]and
Label [(label id)]
The latter would just be ignored when running a script until it gets the first command, and then the script would jump backwards to the latter block. If there is no block with that id in the script, the goto block would just be ignored. They have blocks like these on the TI-BASIC programming language and they are beyond useful.
- KingOfAwesome58219
-
1000+ posts
A "Restart" -block
Support. The workarounds are quite simple though -
- Have the user click the green flag.
- Replace all When Flag Clicked with a broadcast, then broadcast that whenever you want to restart.
- Have the user click the green flag.
- Replace all When Flag Clicked with a broadcast, then broadcast that whenever you want to restart.