Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Repeat Until Loop
- Cub56
-
Scratcher
1000+ posts
Repeat Until Loop
Is there any way to break the repeat until loop immediately once the condition of the loop is false, instead of wait for the entire loop to run again?
So with
then once the backdrop is changed to “next” the loop will still be running and will not stop until the wait condition is true.
I know this is workaroundable by putting backdrop checkers in the wait until blocks but that can be tedious putting it into different scripts, is there any alternative?
The reason I'm asking is because having all that waiting in the background can cause lag.
So with
repeat until <(backdrop name) = [next]>
say []
wait until <touching [mouse pointer v] ?>
say [Touching]
wait until <not <touching [mouse pointer v] ?>>
end
then once the backdrop is changed to “next” the loop will still be running and will not stop until the wait condition is true.
I know this is workaroundable by putting backdrop checkers in the wait until blocks but that can be tedious putting it into different scripts, is there any alternative?
The reason I'm asking is because having all that waiting in the background can cause lag.
Last edited by Cub56 (Jan. 1, 2017 15:55:38)
- drmcw
-
Scratcher
1000+ posts
Repeat Until Loop
when backdrop switches to [next v]
stop [other scripts in sprite v]
- FiveCubed
-
Scratcher
100+ posts
Repeat Until Loop
You could use:
When green flag clicked
repeat until <(backdrop name) = [next]>
say[]
repeat until <touching[mouse-pointer v]>
if <(backdrop name) = [next]> then
broadcast [next]
stop [this script v]
end
end
say [touching]
repeat until <not<touching [mouse-pointer v]>>
if <(backdrop name) = [next]> then
broadcast [next]
stop [this script v]
end
end
end
broadcast [next]
when i receive [next v]
do stuff after repeat until
- TheScratchLemon
-
Scratcher
36 posts
Repeat Until Loop
when backdrop switches to [ next v]
stop [other scripts in sprite v]
- 25andrdemm
-
Scratcher
2 posts
Repeat Until Loop
when green flag clicked
if <(25andrdemm) =(AWESOME)> then
say (SCRATCH IS AWESOME)
end
if <(25andrdemm) = <not (AWESOME)>> then
add [SCRATCH MORE] to [TO-DO]
end
Last edited by 25andrdemm (Jan. 21, 2019 23:51:17)
- deck26
-
Scratcher
1000+ posts
Repeat Until Loop
Please don't blockspam or necropost.when green flag clicked
if <(25andrdemm) =(AWESOME)> then
say (SCRATCH IS AWESOME)
end
if <(25andrdemm) = <not (AWESOME)>> then
add [SCRATCH MORE] to [TO-DO]
end
- Discussion Forums
- » Help with Scripts
-
» Repeat Until Loop
