Discuss Scratch

gob35
Scratcher
12 posts

Forever loop not running...

Hi there,

I'm working on a project and making some good progress, however I'm not sure why a forever loop isn't running.

It belongs to the white text sprite. I've created a variable that turns to true so I know the sprite is receiving the gameOver broadcast, however the variable doesn't change to false as expected which means the forever code is being completely ignored.

Is there a reason for this? I bet there is, but I cannot for the life of me think what it could be…

https://scratch.mit.edu/projects/632393214
Thingied
Scratcher
1000+ posts

Forever loop not running...

Change this in the “Rocks” sprite:

This makes the it so that the text loop doesn't get cancelled when it starts.
gob35
Scratcher
12 posts

Forever loop not running...

Thingied wrote:

Change this in the “Rocks” sprite:
This makes the it so that the text loop doesn't get cancelled when it starts.

Thanks

Question. Does stop all. mean stop all scripts within the broadcast section.

When I change this to stop other scripts it brings other scripts out which I didn't want to run. Do you have any tips on how to have more control on which scripts run when.. Does it all revolve around variables?

EDIT..

No It was a quick and easy fix. Your solution helped a lot thanks.

If you could give your thoughts on the different stop block that'd be awesome, I'll give the scratch wiki article another read too.

Last edited by gob35 (Jan. 22, 2022 22:38:41)

Thingied
Scratcher
1000+ posts

Forever loop not running...

gob35 wrote:

If you could give your thoughts on the different stop block that'd be awesome
stop all - stops everything in the project
stop this script - stop the script it was run in
stop other scripts in this sprite - stops other script in the sprite/clone it was run in
HeHeTeeHeeHee
Scratcher
100+ posts

Forever loop not running...

gob35 wrote:

Thingied wrote:

Change this in the “Rocks” sprite:
This makes the it so that the text loop doesn't get cancelled when it starts.

Thanks

Question. Does stop all. mean stop all scripts within the broadcast section.

When I change this to stop other scripts it brings other scripts out which I didn't want to run. Do you have any tips on how to have more control on which scripts run when.. Does it all revolve around variables?

EDIT..

No It was a quick and easy fix. Your solution helped a lot thanks.

If you could give your thoughts on the different stop block that'd be awesome, I'll give the scratch wiki article another read too.

Stop all stops the entire project. Everything freezes and every script stops. To run it again you need to click the green flag.
gob35
Scratcher
12 posts

Forever loop not running...

Very helpful @Thingied and @HeHeTeeHeeHee

Still getting the hang of the way scratch wants you to program..

It's a great tool, but like any program, has little idiosyncrasies.

Thanks again

Powered by DjangoBB