Discuss Scratch

amoorestl
Scratcher
18 posts

Repeat until Sprite clicked or broadcast received

I want one of my scripts to continue to do something until another script is clicked. The sprite that I want to wait on does broadcast a message when it is clicked. So, my question is, can I either detect another sprite being clicked and put that in a repeat until or repeat a group of commands until a broadcast message is received? If there's not a way to do this directly, can you think of a good “hack” to compete it?

Thanks.
ShadowScizor
Scratcher
100+ posts

Repeat until Sprite clicked or broadcast received

I think of one way to do it which is to use variable

set [stop? v] to [0 ]
repeat until <(stop?) = [1 ]>

end

For the another sprite
when this sprite clicked
set [stop? v] to [1 ]

Last edited by ShadowScizor (Nov. 14, 2014 02:51:11)

Paigeri
Scratcher
500+ posts

Repeat until Sprite clicked or broadcast received

HOT_JUICY_GIRL wrote:

OOOOOOOFFFF
Please do not post unrelated comments or necropost. If you have a question, please create another thread.
lwyay
Scratcher
10 posts

Repeat until Sprite clicked or broadcast received

I have the same problem, too
lwyay
Scratcher
10 posts

Repeat until Sprite clicked or broadcast received

But I want it like, repeat something until broadcast is received, not clicked. Please help!
8bitjake
Scratcher
100+ posts

Repeat until Sprite clicked or broadcast received

ShadowScizor wrote:

I think of one way to do it which is to use variable

set [stop? v] to [0 ]
repeat until <(stop?) = [1 ]>

end

For the another sprite
when this sprite clicked
set [stop? v] to [1 ]

lwyay wrote:

But I want it like, repeat something until broadcast is received, not clicked. Please help!
Just look at the 1st post in this message.
lwyay
Scratcher
10 posts

Repeat until Sprite clicked or broadcast received

8bitjake wrote:

ShadowScizor wrote:

I think of one way to do it which is to use variable

set [stop? v] to [0 ]
repeat until <(stop?) = [1 ]>

end

For the another sprite
when this sprite clicked
set [stop? v] to [1 ]

lwyay wrote:

But I want it like, repeat something until broadcast is received, not clicked. Please help!
Just look at the 1st post in this message.
Thanks! I'll try it
lwyay
Scratcher
10 posts

Repeat until Sprite clicked or broadcast received

8bitjake wrote:

ShadowScizor wrote:

I think of one way to do it which is to use variable

set [stop? v] to [0 ]
repeat until <(stop?) = [1 ]>

end

For the another sprite
when this sprite clicked
set [stop? v] to [1 ]

lwyay wrote:

But I want it like, repeat something until broadcast is received, not clicked. Please help!
Just look at the 1st post in this message.
I mean I'd like it not to click the sprite? Like, automatically.
lwyay
Scratcher
10 posts

Repeat until Sprite clicked or broadcast received

Actually, I found another way supporting your way that worked, THANKS!
836562
Scratcher
1 post

Repeat until Sprite clicked or broadcast received

how can I make something that says repeat until not clicked
deck26
Scratcher
1000+ posts

Repeat until Sprite clicked or broadcast received

836562 wrote:

how can I make something that says repeat until not clicked
Start by creating a new topic and asking your question there please.

The answer will depend what's in the code within the loop. If it would be possible to click while other code is being run within the loop and it not be seen by the repeat until then the method shown above is still sensible.
ded_PC
Scratcher
100+ posts

Repeat until Sprite clicked or broadcast received

836562 wrote:

how can I make something that says repeat until not clicked
Please do start your own thread but,
when green flag clicked
repeat until <>
<not <>><touching [(Insert rest of code here) v] ?>
end
bmsarica
Scratcher
1 post

Repeat until Sprite clicked or broadcast received

i agree with @ShadowScizor
benche1
Scratcher
100+ posts

Repeat until Sprite clicked or broadcast received

when green flag clicked
set [ variable] to [0]
repeat until <<(variable) = [1]> or <<touching [ mouse pointer] ?> and <mouse down?>>>
code
end
when I receive [ message]
set [ variable] to [1]
Cabbagepult30
Scratcher
12 posts

Repeat until Sprite clicked or broadcast received

it like this
when green flag clicked          
forever
change [ blank] by (1)
end
when this sprite clicked
stop [ Other scripts in this sprite]
ca3045eis
Scratcher
1 post

Repeat until Sprite clicked or broadcast received

i really agree. this is terrible!!
Astral_M4ku48
Scratcher
1 post

Repeat until Sprite clicked or broadcast received

when I receive [ blank]
set [any var] to [1]

when green flag clicked
repeat until <[any var] = [1]>
move (1) steps
end

You could do this

Powered by DjangoBB