Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to stop a broadcast block in a forever loop.
- IAMTHEOWL
-
Scratcher
38 posts
How to stop a broadcast block in a forever loop.
I'm making a game that has the code:
But the broadcast block is in a forever loop so it keeps on running the code:
so dose any body know how to make the
part not broadcast it forever?
when I receive [say v]etc
forever
if <[(says)] = [Hello]> then
broadcast [Hi v]
else
if <[(says)] = [Hi]> then
broadcast [Hello v]
else
end
end
But the broadcast block is in a forever loop so it keeps on running the code:
when I receive [ Hi v]
say (join [Hello,] [(name)]) for (2) secs
so dose any body know how to make the
forever
if <[(says)]> = [Hello]> then
broadcast [Hi v]
end
part not broadcast it forever?
Last edited by IAMTHEOWL (June 3, 2020 20:19:29)
- deck26
-
Scratcher
1000+ posts
How to stop a broadcast block in a forever loop.
So why is it a forever loop if you don't want that to happen. If you only want it to happen once each time the event occurs add a wait until not event.
- ninjaMAR
-
Scratcher
1000+ posts
How to stop a broadcast block in a forever loop.
when I receive [say v]
if <code here> then
broadcast [hi v]
end
- IAMTHEOWL
-
Scratcher
38 posts
How to stop a broadcast block in a forever loop.
So why is it a forever loop if you don't want that to happen. If you only want it to happen once each time the event occurs add a wait until not event.
because It's a
if <> thenblock so it has to be in a forever loop.
end
- IAMTHEOWL
-
Scratcher
38 posts
How to stop a broadcast block in a forever loop.
when I receive [say v]
if <code here> then
broadcast [hi v]
end
I need it to be an
if <> thenor it wont work I already tried.
else
end
- IAMTHEOWL
-
Scratcher
38 posts
How to stop a broadcast block in a forever loop.
stop [all v]
it kinda works but not really. I need something else.
- theanonymousweirdo
-
Scratcher
500+ posts
How to stop a broadcast block in a forever loop.
when I receive [say v]
wait until<<(says) = [Hello]> or <(says) = [Hi]>>
if <(says) = [Hello]> then
broadcast [Hi v]
else
if <(says) = [Hi]> then
broadcast [Hello v]
else
end
end
Last edited by theanonymousweirdo (June 3, 2020 22:45:57)
- Wyan100
-
Scratcher
1000+ posts
How to stop a broadcast block in a forever loop.
Did you try a
Block?
wait until <Event>
Block?
- deck26
-
Scratcher
1000+ posts
How to stop a broadcast block in a forever loop.
I prefer to use wait until in those circumstances rather than an if block wihin a forever loop. However you can still do it that way - just stop the script after the broadcast.
- RainbowsToybox
-
Scratcher
100+ posts
How to stop a broadcast block in a forever loop.
Use the repeat block. You control how long it loops for,. You'll need to experiment a lot to get it to stop at the right point.
Block (Just in case):
Located under the forever block.
Block (Just in case):
repeat ()
end
Located under the forever block.
- Discussion Forums
- » Help with Scripts
-
» How to stop a broadcast block in a forever loop.