Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how to stop messages from repeating
- jimbob37andahalf
-
Scratcher
9 posts
how to stop messages from repeating
in the game i am making, when you touch a coin it is supposed to move to 1 of 9 different locations. The problem is, that it likes to repeat the same message many times in a row. any help is useful
- Quantum1993
-
Scratcher
500+ posts
how to stop messages from repeating
This should patch it:
when green flag clickedNow the script will pause instead of indefinitely sending the message,
forever
if <touching [coin v] ?> then
broadcast [move v]
wait (1) secs
end
end
- Malicondi
-
Scratcher
1000+ posts
how to stop messages from repeating
in the game i am making, when you touch a coin it is supposed to move to 1 of 9 different locations. The problem is, that it likes to repeat the same message many times in a row. any help is usefultry using this:
if <touching [coin v]?> thenhope this helps!
broadcast [move coin v]
wait until <not <touching [coin v]?>>
end
Last edited by Malicondi (Feb. 15, 2024 20:50:00)
- undeterminstic
-
Scratcher
1000+ posts
how to stop messages from repeating
when green flag clicked
forever
if <touching [coin v] ?> then
broadcast [move v]
wait until <not <touching [coin v] ?>>
end
end
- jimbob37andahalf
-
Scratcher
9 posts
how to stop messages from repeating
i think that there was some misunderstanding, my problem was that when i touched the coin, it would teleport back to the place that it already was. is there a patch for this?
the game is posted, play/remis it here: https://scratch.mit.edu/projects/962204294/
the game is posted, play/remis it here: https://scratch.mit.edu/projects/962204294/
Last edited by jimbob37andahalf (Feb. 20, 2024 17:51:49)
- -Zorra-
-
Scratcher
100+ posts
how to stop messages from repeating
If you replace this:

With this:

it shouldn't show up in the same place. For the future, it would be helpful to provide a link to your game in the main post so people can see what isn't working more clearly.

With this:

it shouldn't show up in the same place. For the future, it would be helpful to provide a link to your game in the main post so people can see what isn't working more clearly.
- jimbob37andahalf
-
Scratcher
9 posts
how to stop messages from repeating
i tried that and it works great, but now it counts multiple coins collected because it takes a little bit to move. any suggestions
- -Zorra-
-
Scratcher
100+ posts
how to stop messages from repeating
The reason is because in your “coin” sprite, you have duplicate broadcasts that are meant to spawn different zones. All of them need to be unique numbers from 1-9 for it to work. Since you didn't include 7-9 in the “coin” sprite, if it lands on those numbers it won't respawn and you'll get a double coin.
Last edited by -Zorra- (Feb. 20, 2024 22:58:08)
- Discussion Forums
- » Help with Scripts
-
» how to stop messages from repeating




