Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
- damasbinabdulmalik
-
New Scratcher
53 posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
here's the stuff;
Alright so the only thing that could broadcast the message “GAME START” is only from finishing the tutorial (outside this sprite) and pressing r (inside the same sprite of this'), i was intending to use this pressing r as a reset button, but the problem is, after the message “wave 2 STARTS” has already been broadcasted then the game is reset, sprites that are still doing stuff with blocks like “wait until” or “repeat until” and stuff, which were put under the block “when i receive ‘wave 2 STARTS’ ”, wouldn't stop doing their script until they're done. My attempt on preventing this is to put this code on each of them (where some might have some more codes under them);
but still, they would instead complete their script, ignoring the fact that the game was reset.
when I receive [ GAME START]
wait until <[timer] > [15]>
set [ {KIAI)] to [1]
wait until <[timer] > [39]>
set [ (KIAI)] to [0]
broadcast [ wave 2 STARTS]
wait until <(3/4, 4/4) = [17]>
set [ wave] to [2]
set [ deterioration] to [0]
wait until <[timer] > [63]>
set [ (KIAI)] to [1]
wait until <[timer] > [87]>
set [ (KIAI)] to [0]
Alright so the only thing that could broadcast the message “GAME START” is only from finishing the tutorial (outside this sprite) and pressing r (inside the same sprite of this'), i was intending to use this pressing r as a reset button, but the problem is, after the message “wave 2 STARTS” has already been broadcasted then the game is reset, sprites that are still doing stuff with blocks like “wait until” or “repeat until” and stuff, which were put under the block “when i receive ‘wave 2 STARTS’ ”, wouldn't stop doing their script until they're done. My attempt on preventing this is to put this code on each of them (where some might have some more codes under them);
when I receive [ GAME START]
hide
wait until <etc, etc.>
but still, they would instead complete their script, ignoring the fact that the game was reset.
Last edited by damasbinabdulmalik (June 23, 2024 09:54:56)
- damasbinabdulmalik
-
New Scratcher
53 posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
holy what i tried to make the “kiai” variable appear with an orange background but what have i done
- deck26
-
Scratcher
1000+ posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
A broadcast being repeated should restart all receivers of that broadcast. If you think that is not happening please share the project and tell us how to replicate and recognise the issue.
- damasbinabdulmalik
-
New Scratcher
53 posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
you mean when a certain script was running under a receiver block, if that receiver received its message again while the script is still running, the script would restart from the start of the script?
- deck26
-
Scratcher
1000+ posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
you mean when a certain script was running under a receiver block, if that receiver received its message again while the script is still running, the script would restart from the start of the script?Yes.
- damasbinabdulmalik
-
New Scratcher
53 posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
thats the problem, when restarting, somehow the “when i receive ‘wave 2 STARTS’ ” block on sprites that has one has already received its message, where supossedly the ‘wave 2 STARTS’ should only be broadcasted after a certain time AFTER the game is reset, as you can see at the script i mentioned before.
- damasbinabdulmalik
-
New Scratcher
53 posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
i beg you please comeback
ok wait my response earlier is kinda confusing, so basically, when “GAME START” is broadcasted while ‘wave 2 STARTS’ receiver scripts are still running due to wait blocks and stuff, the receiver scripts would receive the message again, even though its supposed to be broadcasted after some time, after “GAME START” is broadcasted
ok wait my response earlier is kinda confusing, so basically, when “GAME START” is broadcasted while ‘wave 2 STARTS’ receiver scripts are still running due to wait blocks and stuff, the receiver scripts would receive the message again, even though its supposed to be broadcasted after some time, after “GAME START” is broadcasted
Last edited by damasbinabdulmalik (June 26, 2024 14:29:25)
- RokCoder
-
Scratcher
1000+ posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
I imagine @deck26 checks the forum at a certain time each day. You can't expect them to be on hand throughout the day to respond to you 
It sounds like the source of the problem has been found. I would still recommend sharing the project so you can get a definitive response. You can unshare again as soon as the problem is resolved.

It sounds like the source of the problem has been found. I would still recommend sharing the project so you can get a definitive response. You can unshare again as soon as the problem is resolved.
- deck26
-
Scratcher
1000+ posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
So is the project shared?
- damasbinabdulmalik
-
New Scratcher
53 posts
Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block
yea
- Discussion Forums
- » Help with Scripts
-
» Need help with message broadcasting when not told to (yet), under some waiting blocks and started with the "when i receive" block