I tried to use this script
It doesnt work.
You may be interested in the throw and catch blocks in the iteration composition library.
Basically when the loop reaches 5, it will break out of the catch block, making the sprite say "Done!" after it reaches 5.
i dont want to put a loop inside a catch block, i just want to use one block
Unfortunately, this is the only way to break out of s loop in snap.
Given your example, this is how to exit it using catch with a tag
script variable (num) :: grey repeat (10) set (num) to ((num) + (1)) play :: sound // your code here if <(num) = (10)> then catch (tag) { throw (tag) :: control } :: control
This is just an example of how to do with without a for loop, but it's almost exactly the same. You may want to use @cymplecy's example for what you want
The throw tag breaks out of the catch block, that's why you need to wrap the catch block around the loop. Your example does literally nothing.
no variable assigning, no extra c blocks, all i want is to create ONE CUSTOM BLOCK to do the work.
That's AFAIK impossible without at least two custom blocks
actually wait try [scratchblocks]stop [this script v][/scratchblocks]
oops
i want to stop a loop. not a script
wrap the repeat loop around a [scratchblocks]launch <{::grey} @addInput:: grey ring>::control[/scratchblocks] block
also unrelated, but does anyone know how to make a grey ring in scratchblocks?
<{Insert Code Here
} @addInput:: grey ring>
thanks
Also, I swear y'all have been typing for like 10 minutes
In the current scratchblocks forum plugin, you have to do
[scratchblocks]
({...} @</span>addInput :: grey ring)
[/scratchblocks]
({...} @</span>addInput :: grey ring)
However if snapblocks gets added to the forum, you'd only have to do
[snapblocks]
({...} @addInput)
[/snapblocks]
cool
Last time this came up, you said you weren't quite ready. Are you, now? And if so, where do we find the code? Thanks.