Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Something something with multiple broadcast block
- damasbinabdulmalik
-
New Scratcher
53 posts
Something something with multiple broadcast block
its been a long time since i do my project, but i hope to see some familiar faces helping me out.
So basically i have a kind of a reset script in my project, it uses a keybind, when i press r, it would broadcast “GAME START”, basically restarting the game, this broadcast also happens after finishing the tutorial. And here is the problem; sometimes, the whole thing just breaks when “GAME START” is broadcasted, yes even after finishing the tutorial, but repeatedly resetting would fix it. Now if i remember correctly, this doesnt happen prior adding the reset script, idk how do i explain this in a much more detailed explanation just check my game in my profile i have no idea what is going on.
ive already made a similar forum like this but i think i dont understand so like i didnt bother too much, and it seems like i cant even find it in my history data (chrome).
So basically i have a kind of a reset script in my project, it uses a keybind, when i press r, it would broadcast “GAME START”, basically restarting the game, this broadcast also happens after finishing the tutorial. And here is the problem; sometimes, the whole thing just breaks when “GAME START” is broadcasted, yes even after finishing the tutorial, but repeatedly resetting would fix it. Now if i remember correctly, this doesnt happen prior adding the reset script, idk how do i explain this in a much more detailed explanation just check my game in my profile i have no idea what is going on.
ive already made a similar forum like this but i think i dont understand so like i didnt bother too much, and it seems like i cant even find it in my history data (chrome).
- 8to16
-
Scratcher
1000+ posts
Something something with multiple broadcast block
Please share and link your project
- damasbinabdulmalik
-
New Scratcher
53 posts
Something something with multiple broadcast block
https://scratch.mit.edu/projects/1019544118/
is this it?
is this it?
- damasbinabdulmalik
-
New Scratcher
53 posts
Something something with multiple broadcast block
waiting by the chair, are you there
- damasbinabdulmalik
-
New Scratcher
53 posts
Something something with multiple broadcast block
is it too hard of a question
- deck26
-
Scratcher
1000+ posts
Something something with multiple broadcast block
Don't leave people helping having to look at 20+ sprites and thousands of blocks. Identify the sprites/scripts concerned.
A food debugging technique is to make a copy and remove as much as you can that is not relevant. Do this in stages and test at each stage to make sure the problem hasn't disappeared - if it has you need ot check scripts in the last thiings you removed.
A food debugging technique is to make a copy and remove as much as you can that is not relevant. Do this in stages and test at each stage to make sure the problem hasn't disappeared - if it has you need ot check scripts in the last thiings you removed.
- 10goto10
-
Scratcher
1000+ posts
Something something with multiple broadcast block
So I looked at your project and I didn't get very far. You have at least a dozen Game Start event hats. Most of them that I saw have in their first frame some kind of conditional.
You also have at least one (that I saw) Game Start script that sets up variables.
What might help your project (and I did not test this) is to make a Game Initialize event that you broadcast prior to doing a Game Start broadcast.
The Game Initialize scripts would do all of your non-conditional, non-dependent setup. In those scripts you would reset the timer and set the variables to constants and do any “go to” blocks to specific values.
Update: I'm going to add this comment even if it is not actually interesting. An ancient beta version of Scratch actually did two “broadcasts” when the green “flag” was clicked. Initially a “broadcast” to “Setup” was made and that was followed automatically by a “broadcast” to “Go”. I can only guess that they wanted people to use the “Setup” scripts to just set the variables to constants and place the sprites at some fixed starting points prior to starting the actual project. They dropped feature this of course.
You also have at least one (that I saw) Game Start script that sets up variables.
What might help your project (and I did not test this) is to make a Game Initialize event that you broadcast prior to doing a Game Start broadcast.
The Game Initialize scripts would do all of your non-conditional, non-dependent setup. In those scripts you would reset the timer and set the variables to constants and do any “go to” blocks to specific values.
Update: I'm going to add this comment even if it is not actually interesting. An ancient beta version of Scratch actually did two “broadcasts” when the green “flag” was clicked. Initially a “broadcast” to “Setup” was made and that was followed automatically by a “broadcast” to “Go”. I can only guess that they wanted people to use the “Setup” scripts to just set the variables to constants and place the sprites at some fixed starting points prior to starting the actual project. They dropped feature this of course.
Last edited by 10goto10 (Jan. 25, 2025 04:06:21)
- damasbinabdulmalik
-
New Scratcher
53 posts
Something something with multiple broadcast block
Don't leave people helping having to look at 20+ sprites and thousands of blocks. Identify the sprites/scripts concerned.
A food debugging technique is to make a copy and remove as much as you can that is not relevant. Do this in stages and test at each stage to make sure the problem hasn't disappeared - if it has you need ot check scripts in the last thiings you removed.
Mr./Ms. deck26, ill take that into action pronto, thank you for telling.
- damasbinabdulmalik
-
New Scratcher
53 posts
Something something with multiple broadcast block
So I looked at your project and I didn't get very far. You have at least a dozen Game Start event hats. Most of them that I saw have in their first frame some kind of conditional.
You also have at least one (that I saw) Game Start script that sets up variables.
What might help your project (and I did not test this) is to make a Game Initialize event that you broadcast prior to doing a Game Start broadcast.
The Game Initialize scripts would do all of your non-conditional, non-dependent setup. In those scripts you would reset the timer and set the variables to constants and do any “go to” blocks to specific values.
Update: I'm going to add this comment even if it is not actually interesting. An ancient beta version of Scratch actually did two “broadcasts” when the green “flag” was clicked. Initially a “broadcast” to “Setup” was made and that was followed automatically by a “broadcast” to “Go”. I can only guess that they wanted people to use the “Setup” scripts to just set the variables to constants and place the sprites at some fixed starting points prior to starting the actual project. They dropped feature this of course.
About “Game Initialize” event, do you mean like, giving the main game broadcasts start before the “GAME START” broadcast started?
- 10goto10
-
Scratcher
1000+ posts
Something something with multiple broadcast block
Yes. Where you are doing a broadcast to “GAME START” proceed that with a broadcast to “Game Initialize”.
- Discussion Forums
- » Help with Scripts
-
» Something something with multiple broadcast block