Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Stopping forever commands without a "Stop" script
- -NewGame-
- Scratcher
18 posts
Stopping forever commands without a "Stop" script
when green flag clicked
set [stop v] to [0]
wait (5) secs
broadcast [Walk v]
wait (10) secs
broadcast [Stop v]
when I receive [Walk v]
forever
switch costume to [Walk v]
repeat (5)
next costume
end
wait until <(stop) > [50]>
stop [all v]
end
when I receive [Stop v]
set [stop v] to [60]
This is what my code looks right now and I know something is wrong with it but I don't know what it is, so help please.
Hello I'm -NewGame- and if your reading this then you're cool
when green flag clicked
say [Hello and you're cool]
set [User v] to [cool]
say [You're welcome]
if <[User] = (cool)> then
say [Thanks for reading]
end
- deck26
- Scratcher
1000+ posts
Stopping forever commands without a "Stop" script
Don't understand the question. Are you saying the stop all doesn't work? Share the project if so please.
- -NewGame-
- Scratcher
18 posts
Stopping forever commands without a "Stop" script
Sorry, I meant
stop [this script v]I suspect that it's blocking the script but I'm not sure.
Hello I'm -NewGame- and if your reading this then you're cool
when green flag clicked
say [Hello and you're cool]
set [User v] to [cool]
say [You're welcome]
if <[User] = (cool)> then
say [Thanks for reading]
end
- deck26
- Scratcher
1000+ posts
Stopping forever commands without a "Stop" script
Still don't know what you're asking - that will stop the script. Sorry, I meantstop [this script v]I suspect that it's blocking the script but I'm not sure.
- TechNerd64
- Scratcher
100+ posts
Stopping forever commands without a "Stop" script
I think he's talking about exiting the loop. Like a loop breakStill don't know what you're asking - that will stop the script. Sorry, I meantstop [this script v]I suspect that it's blocking the script but I'm not sure.
Founder of Gigabyte Games, and apart of the EvolvusOS Team for OSWars 10. I mainly work on games and other interesting projects, but you can find me in the forums from time to time.
- -NewGame-
- Scratcher
18 posts
Stopping forever commands without a "Stop" script
The code where it says “When I receive: Stop, set stop to 60” does work when triggered but when “Stop this script” is activated it's being blocked by something and isn't going in order after the stop variable supposedly goes over 50. That's what I meant by I think its blocking the rest of the script
Hello I'm -NewGame- and if your reading this then you're cool
when green flag clicked
say [Hello and you're cool]
set [User v] to [cool]
say [You're welcome]
if <[User] = (cool)> then
say [Thanks for reading]
end
- deck26
- Scratcher
1000+ posts
Stopping forever commands without a "Stop" script
being blocked by something and isn't going in order after the stop variable supposedly goes over 50. That's what I meant by I think its blocking the rest of the scriptWhat does the bit I've underlined mean? Is the script being stopped or not? The whole script will be stopped - it can't break out of a forever loop and continue with code after that. Code after a forever loop will never be run once the forever loop is triggered - you either let the forever loop continue or you stop the script completely. The code where it says “When I receive: Stop, set stop to 60” does work when triggered but when “Stop this script” is activated it's
- -NewGame-
- Scratcher
18 posts
Stopping forever commands without a "Stop" script
I thought about where you said “you either let the forever loop continue or you stop the script completely.” And had an idea. Does repeat commands work? If they can run for a certain amount of time could they open up a possibility?
Hello I'm -NewGame- and if your reading this then you're cool
when green flag clicked
say [Hello and you're cool]
set [User v] to [cool]
say [You're welcome]
if <[User] = (cool)> then
say [Thanks for reading]
end
- Discussion Forums
- » Help with Scripts
- » Stopping forever commands without a "Stop" script