Discuss Scratch

scratch0maker0
Scratcher
100+ posts

stop parent script

I want a block that can stop it's parent script, like this:

stop [parent script v] :: stack

How it works:
It would mostly be used for functions, and would stop the parent script. If I had this, perhaps:
define func
...
stop [parent script v] :: stack

when gf clicked
forever
func :: custom stack
change [var v] by (1)
end

Var would never get changed, because the function stop whatever started it, in this case, the green flag block script. And since the function was ran before the var change, the var never got changed. It should work with broadcasts, too. And any hat block. If something does not have a parent block, it would not do anything.

FAQs
If I had nested custom blocks, how many levels does it go?
Remember, I only goes up one level!
Can't you use variables?
Well, that would work for broadcasts, but it would not work for functions. The next block is not ran until the function is finished.

Last edited by scratch0maker0 (June 10, 2017 02:43:41)

stickfiregames
Scratcher
1000+ posts

stop parent script

If you have nested custom blocks, would it stop one level up or all the way to the top?

(edit - didn't read OP)

Last edited by stickfiregames (June 6, 2017 20:01:31)

Scratcher1002
Scratcher
1000+ posts

stop parent script

Hmm, I support, but shouldn't it be a cap block like this
stop [parent script v] :: control cap
?
walkcycle
Scratcher
500+ posts

stop parent script

Would this work?

define custom
set [stop after v] to [false]
...
set [stop after v] to [true]

and use the block like:

custom :: custom
if < (stop after) = [true] > then
stop [this script v]
PrincessPandaLover
Scratcher
1000+ posts

stop parent script

Now I can stop my parents from grounding me!

walkcycle wrote:

Would this work?

define custom
set [stop after v] to [false]
...
set [stop after v] to [true]

and use the block like:

custom :: custom
if < (stop after) = [true] > then
stop [this script v]
Yeah, that would work.
scratch0maker0
Scratcher
100+ posts

stop parent script

PrincessPandaLover wrote:

Now I can stop my parents from grounding me!

walkcycle wrote:

Would this work?

define custom
set [stop after v] to [false]
...
set [stop after v] to [true]

and use the block like:

custom :: custom
if < (stop after) = [true] > then
stop [this script v]
Yeah, that would work.
no, it would not work because the next block will not be ran until the function is finished
scratch0maker0
Scratcher
100+ posts

stop parent script

Scratcher1002 wrote:

Hmm, I support, but shouldn't it be a cap block like this
stop [parent script v] :: control cap
?
no, because it doesn't stop it's own script, just it's parents
XenoCoding
Scratcher
100+ posts

stop parent script

scratch0maker0 wrote:

PrincessPandaLover wrote:

Now I can stop my parents from grounding me!

walkcycle wrote:

Would this work?

define custom
set [stop after v] to [false]
...
set [stop after v] to [true]

and use the block like:

custom :: custom
if < (stop after) = [true] > then
stop [this script v]
Yeah, that would work.
no, it would not work because the next block will not be ran until the function is finished
If you added the variable block underneath that if statement, it won't be run…
walkcycle
Scratcher
500+ posts

stop parent script

PrincessPandaLover wrote:

Now I can stop my parents from grounding me!.
LoL!

scratch0maker0 wrote:

no, it would not work because the next block will not be ran until the function is finished
How about

define custom
set [stop after v] to [false]
...
set [stop after v] to [true]
stop [this script v]

and use the block like:

custom :: custom
if < (stop after) = [true] > then
stop [this script v]
scratch0maker0
Scratcher
100+ posts

stop parent script

XenoCoding wrote:

scratch0maker0 wrote:

PrincessPandaLover wrote:

Now I can stop my parents from grounding me!

walkcycle wrote:

Would this work?

define custom
set [stop after v] to [false]
...
set [stop after v] to [true]

and use the block like:

custom :: custom
if < (stop after) = [true] > then
stop [this script v]
Yeah, that would work.
no, it would not work because the next block will not be ran until the function is finished
If you added the variable block underneath that if statement, it won't be run…

walkcycle wrote:

PrincessPandaLover wrote:

Now I can stop my parents from grounding me!.
LoL!

scratch0maker0 wrote:

no, it would not work because the next block will not be ran until the function is finished
How about

define custom
set [stop after v] to [false]
...
set [stop after v] to [true]
stop [this script v]

and use the block like:

custom :: custom
if < (stop after) = [true] > then
stop [this script v]
If the block isn't a cap block, why should we put a stop this script block under it? And the advantage would be that it can stop the parent block at any time, not just a the end. YOu would have to do that every function, it's workaround is tedious and slow.
XenoCoding
Scratcher
100+ posts

stop parent script

scratch0maker0 wrote:

If the block isn't a cap block, why should we put a stop this script block under it? And the advantage would be that it can stop the parent block at any time, not just a the end. YOu would have to do that every function, it's workaround is tedious and slow.

If the workaround doesn't occur very often, then it doesn't matter if it's tedious or slow. I've never occurred a situation where I would need this block, so I'm sure that there are very few situations where you would. And for those very few situations, a simple and easy workaround has been provided. I don't think that a new block is necessary in this case.
Scratcher1002
Scratcher
1000+ posts

stop parent script

scratch0maker0 wrote:

Scratcher1002 wrote:

Hmm, I support, but shouldn't it be a cap block like this
stop [parent script v] :: control cap
?
no, because it doesn't stop it's own script, just it's parents
Exactly, if it stops it's parent script that means that it can't run anymore. It's like that grandfather paradox.

Powered by DjangoBB