Discuss Scratch

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

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

25andrdemm wrote:

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
Please don't blockspam or necropost.
CocoBar2000
Scratcher
2 posts

Repeat Until Loop

deck26
Scratcher
1000+ posts

Repeat Until Loop

CocoBar2000 wrote:

Please don't spam or necropost.

Powered by DjangoBB