This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-04-27 22:36:05

andrewguy
New Scratcher
Registered: 2013-04-16
Posts: 4

How to restart a script that has a forever loop?

I made a script with a forever loop and I can't get it to start from the beginning. It's a long script so I can't wait 20 seconds just to wait for it to get to end script, but I can't have it stop all either.

Offline

 

#2 2013-04-27 23:01:08

7734f
Scratcher
Registered: 2010-12-23
Posts: 500+

Re: How to restart a script that has a forever loop?

andrewguy wrote:

I made a script with a forever loop and I can't get it to start from the beginning. It's a long script so I can't wait 20 seconds just to wait for it to get to end script, but I can't have it stop all either.

Maybe stop the project, then start it? Or make sure your single stepping is set to normal by going to Edit>Set single Stepping>Normal


http://internetometer.com/image/38992.png   http://i37.tinypic.com/2qixx6c.png

Offline

 

#3 2013-04-28 11:38:12

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How to restart a script that has a forever loop?

andrewguy wrote:

I made a script with a forever loop and I can't get it to start from the beginning. It's a long script so I can't wait 20 seconds just to wait for it to get to end script, but I can't have it stop all either.

Well, one way you could do this through broadcasts. First, you'll have to edit your single script into this:

when gf clicked
broadcast [Start! v]
when I receive [Start! v]
forever
 Scripts...

Now, all you need to do to restart your script is to broadcast "Start!" and you should be good.

Just to say, you can use this method to help interrupt/stop a glide block that's already running. In fact, that's how I discovered this.

Anyway, I hope that this helps! Also, hello andrewguy and welcome to Scratch! I hope that you'll find everything great here!  smile

With regards,

ErnieParke

Last edited by ErnieParke (2013-04-28 11:38:43)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer