Discuss Scratch

ZanePro123
Scratcher
35 posts

Question about Custom blocks and Stop this script Block

So I was watching some tutorials when I notice something that I never thought of.
I noticed that you can do something like this in the code
define Blah blah blah
a bunch of code here
if <(variable) = [something]> then
stop [ this script v]
end
a bunch of other code

I know that custom blocks will run everything in it before continuing to the next block below it. (Unlike a broadcast block)
But if a stop this script block is triggered in the custom block, will the entire script where custom block is added stop or only the code inside the define custom block itself.
define Blah blah blah
stop [ this script v]
when green flag clicked
some code
Blah blah blah
will the code below this custom block still run since the custom block is technically connected to it

Last edited by ZanePro123 (June 25, 2023 10:04:19)

toasty_mc_toastface
Scratcher
99 posts

Question about Custom blocks and Stop this script Block

Interesting find! I tried it out myself and found out:
-if you use a stop all block, it will stop what is outside the block as well…
-but if you use a stop this script block because the code inside the custom block counts as a separate script, it skips the rest of the code in the block and moves to the next piece of code. This is cool as it could be used to skip entire sections of code.
Thanks for the info! Now i really want to use this in a game.
medians
Scratcher
1000+ posts

Question about Custom blocks and Stop this script Block


toasty_mc_toastface wrote:

Interesting find! I tried it out myself and found out:
-if you use a stop all block, it will stop what is outside the block as well….
Well, that's because the stop all block stops everything in the project that is running.
toasty_mc_toastface
Scratcher
99 posts

Question about Custom blocks and Stop this script Block

yeah i know

Powered by DjangoBB