Discuss Scratch

quadruple_door
Scratcher
100+ posts

Break out of Loop block

Stop(this loop v) ::control
this would be a scratch block that when used, does what it says, breaks out of a loop!

(example)
|
|
|
V

when green flag clicked
set [my variable v] to [0]
set [ random variable v] to (pick random (1) to (900))
repeat (900)
change [my variable v] by (1)
if < (my variable) = (random variable) > then
Stop(this loop v) ::control

end

end
do whatever now

(for context, if a loop is inside a loop it wont stop both loops, only the one its in.)
(this wont do anything outside a loop)
__Falcon-Games__
Scratcher
1000+ posts

Break out of Loop block

Support. This would be just plain useful and would be probably easy to implement. This shouldn't be the top priority of the ST of course.
Scratchcat12562
Scratcher
100+ posts

Break out of Loop block

stop [this script v]
This block exists already
7salad3salad
Scratcher
1000+ posts

Break out of Loop block

Scratchcat12562 wrote:

stop [this script v]
This block exists already
The issue with that is that it doesnt carry on with blocks after the loop, and just cancels the entire script.

Also, couldnt you use broadcasts for this?

Last edited by 7salad3salad (Aug. 30, 2023 11:41:13)

Zydrolic
Scratcher
1000+ posts

Break out of Loop block

Scratchcat12562 wrote:

(#3)
stop [this script v]
This block exists already
OP wants to stop the loop and continue the code, not the entire paragraph of code.
Just clarifying.

EDIT: Darn it, I got ninja'd — Well played. i am going to eat your palacsinta (/j)

Last edited by Zydrolic (Aug. 30, 2023 11:42:10)

__Falcon-Games__
Scratcher
1000+ posts

Break out of Loop block

Scratchcat12562 wrote:

stop [this script v]
This block exists already
why aren't kids smarter?
They mean break out of the current loop, not break out of the current script/stop the script.

Last edited by __Falcon-Games__ (Aug. 30, 2023 16:43:36)

Scratchcat12562
Scratcher
100+ posts

Break out of Loop block

__Falcon-Games__ wrote:

Scratchcat12562 wrote:

stop [this script v]
This block exists already
why aren't kids more smarter?
They mean break out of the current loop, not break out of the current script/stop the script.
oh i understand now this would be pretty useful for stuff
CrazyCoder1247
Scratcher
100+ posts

Break out of Loop block

Scratchcat12562 wrote:

__Falcon-Games__ wrote:

Scratchcat12562 wrote:

stop [this script v]
This block exists already
why aren't kids more smarter?
They mean break out of the current loop, not break out of the current script/stop the script.
oh i understand now this would be pretty useful for stuff
first of all, __Falcon-Games__, be nice, second of all, look:
repeat until <>

end
amazing, right?

Last edited by CrazyCoder1247 (Aug. 30, 2023 12:09:42)

__Falcon-Games__
Scratcher
1000+ posts

Break out of Loop block

CrazyCoder1247 wrote:

Scratchcat12562 wrote:

__Falcon-Games__ wrote:

Scratchcat12562 wrote:

stop [this script v]
This block exists already
why aren't kids more smarter?
They mean break out of the current loop, not break out of the current script/stop the script.
oh i understand now this would be pretty useful for stuff
first of all, __Falcon-Games__, be nice, second of all, look:
repeat until <>

end
amazing, right?
1. I am being nice, I was just wondering a question which I put in small tags which didn't have to be noticed by anyone which wasn't meant to cause any offense
2. What does that have to do with this suggestion?
Zydrolic
Scratcher
1000+ posts

Break out of Loop block

CrazyCoder1247 wrote:

(#8)
-snip-

welp thats a bamboozle in my book
i forgot it existed despite using it several minutes ago

edit: Even if you need the criteria there's no jumping over this block.

Last edited by Zydrolic (Aug. 30, 2023 12:14:40)

quadruple_door
Scratcher
100+ posts

Break out of Loop block

CrazyCoder1247 wrote:

Scratchcat12562 wrote:

__Falcon-Games__ wrote:

Scratchcat12562 wrote:

stop [this script v]
This block exists already
why aren't kids more smarter?
They mean break out of the current loop, not break out of the current script/stop the script.
oh i understand now this would be pretty useful for stuff
first of all, __Falcon-Games__, be nice, second of all, look:
repeat until <>

end
amazing, right?
i see, also funny how you say be nice, then immediately switch to sarcasm.
Zydrolic
Scratcher
1000+ posts

Break out of Loop block

quadruple_door wrote:

(#11)
i see, also funny how you say be nice, then immediately switch to sarcasm.

oh come on, we all love us some sarcasm
especially since repeat until is from control so we actually wouldn't really need a dropdown, since we already are getting our if statement

(dont mind the fact its in hungarian)

EDIT: rough around the edge, even if Scratch is meant to be simple.
Anyone able to provide an example where repeat until <> canNOT be used for a line of code?

Last edited by Zydrolic (Aug. 30, 2023 12:27:02)

__Falcon-Games__
Scratcher
1000+ posts

Break out of Loop block

Zydrolic wrote:

Anyone able to provide an example where repeat until <> canNOT be used for a line of code?
do init stuff here :: control
forever
if < cond :: operators > then
do stuff here :: control
stop [this loop v]
else
do other stuff here :: control
end
end
do final stuff here :: control

If someone can find replacement code for this using repeat until <> then I will stop supporting this suggestion.
Zydrolic
Scratcher
1000+ posts

Break out of Loop block

__Falcon-Games__ wrote:

(#13)
forever
if < cond :: operators > then
do stuff here :: control
stop [this loop v]
else
do other stuff here :: control
end
end
do final stuff here :: control
... // whatever
repeat until <condition if needed :: operators>
if <condition :: operators> then
... // "other" code
else
... // do whatever
or do it the opposite way, whatever is needed
anything?
__Falcon-Games__
Scratcher
1000+ posts

Break out of Loop block

Zydrolic wrote:

__Falcon-Games__ wrote:

(#13)
forever
if < cond :: operators > then
do stuff here :: control
stop [this loop v]
else
do other stuff here :: control
end
end
do final stuff here :: control
... // whatever
repeat until <condition if needed :: operators>
if <condition :: operators> then
... // "other" code
else
... // do whatever
or do it the opposite way, whatever is needed
anything?
OBJECTION! that was a reference It needs to break out of the loop there but it doesn't in the other code, it will check if it's that condition then do that code and keep repeating it until the specified condition, it needs to break out of it and go onto the final stuff in the other code.
Zydrolic
Scratcher
1000+ posts

Break out of Loop block

__Falcon-Games__ wrote:

OBJECTION! that was a reference It needs to break out of the loop there but it doesn't in the other code, it will check if it's that condition then do that code and keep repeating it until the specified condition, it needs to break out of it and go onto the final stuff in the other code.
HOLD IT! i get it You can just put another condition afterwards to check what part of the code it requires or needs to run again before proceeding onto the final line of code.
In short:

Last edited by Zydrolic (Aug. 30, 2023 12:50:19)

__Falcon-Games__
Scratcher
1000+ posts

Break out of Loop block

Zydrolic wrote:

__Falcon-Games__ wrote:

OBJECTION! that was a reference It needs to break out of the loop there but it doesn't in the other code, it will check if it's that condition then do that code and keep repeating it until the specified condition, it needs to break out of it and go onto the final stuff in the other code.
HOLD IT! i get it You can just put another condition afterwards to check what part of the code it requires or needs to run again before proceeding onto the final line of code.
In short:
TAKE THAT! If the condition is something that will be different when it reaches the final part of the code then it needs to break the loop there so the condition is the same.
this is not a good argument but I am trying to get this suggestion accepted now, whatever it may take
Zydrolic
Scratcher
1000+ posts

Break out of Loop block

__Falcon-Games__ wrote:

(#17)
TAKE THAT! If the condition is something that will be different when it reaches the final part of the code then it needs to break the loop there so the condition is the same.
this is not a good argument but I am trying to get this suggestion accepted now, whatever it may take
heh, did'ja really think you could-

welp.
ya got me.
quadruple_door
Scratcher
100+ posts

Break out of Loop block

bump
cookieclickerer33
Scratcher
1000+ posts

Break out of Loop block

*cough*
repeat (you can’t change the number after it starts)

end
You could technically use variables but you would need to make a new one for each loop
And also I guess
For each [i v] to (10){

}::control
But it doesn’t exist in the normal pallet anymore

Last edited by cookieclickerer33 (Aug. 31, 2023 11:46:58)

Powered by DjangoBB