Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » My Scratch project isn't working and I really need to get this "Music Update" out.
- austhodg29
-
Scratcher
25 posts
My Scratch project isn't working and I really need to get this "Music Update" out.
The menu music won't stop unlike the code (should) suggest.
The in-game music DOES, however, start and I need help to make the menu theme stop while the in-game music plays. Help?
The code that won't work:

The in-game music DOES, however, start and I need help to make the menu theme stop while the in-game music plays. Help?
The code that won't work:

- timhortonsyo
-
Scratcher
31 posts
My Scratch project isn't working and I really need to get this "Music Update" out.
It's because you set the music to play until its done, meaning that script can't perform another check for the backdrop number until the song finishes playing. I think that
would be better. Hope this helps!
wait (3.50) secs
play sound [GameSelectTheme v]
wait until <not <<(backdrop #) = [3]> or <<(backdrop #) = [4]> or <(backdrop #) = [5]>>>>
stop all sounds
would be better. Hope this helps!
Last edited by timhortonsyo (March 26, 2020 02:52:01)
- austhodg29
-
Scratcher
25 posts
My Scratch project isn't working and I really need to get this "Music Update" out.
@timhortonsyo
Thank you so much! I really can't explain how much I appreciate this. Like, I know it's weird that I appreciate this, but I just really really needed to get this update out. I'll definitely credit you in the “Notes and Credits” section!
Thank you so much! I really can't explain how much I appreciate this. Like, I know it's weird that I appreciate this, but I just really really needed to get this update out. I'll definitely credit you in the “Notes and Credits” section!

- ipaddude
-
Scratcher
100+ posts
My Scratch project isn't working and I really need to get this "Music Update" out.
It's because you set the music to play until its done, meaning that script can't perform another check for the backdrop number until the song finishes playing. I think thatwait (3.50) secs
play sound [GameSelectTheme v]
wait until <not <<(backdrop #) = [3]> or <<(backdrop #) = [4]> or <(backdrop #) = [5]>>>>
stop all sounds
would be better. Hope this helps!
however then the music only plays once and if there are any other sounds playing or the new music starts before the old one ends then those will stop as well. i usually use
when green flag clickedthe only disadvantage is that if you need to play it again it might continue in the middle because volume 0% doesn't prevent the music from continuing to play
forever
play sound [music v] until done
end
when green flag clicked
forever
if <not<too lazy to write all of the backdrops>> then
set volume to (100) %
else
set volume to (0) %
end
end
Last edited by ipaddude (March 26, 2020 11:11:27)
- timhortonsyo
-
Scratcher
31 posts
My Scratch project isn't working and I really need to get this "Music Update" out.
however then the music only plays once and if there are any other sounds playing or the new music starts before the old one ends then those will stop as well. i usually usewhen green flag clickedthe only disadvantage is that if you need to play it again it might continue in the middle because volume 0% doesn't prevent the music from continuing to play
forever
play sound [music v] until done
end
when green flag clicked
forever
if <not<too lazy to write all of the backdrops>> then
set volume to (100) %
else
set volume to (0) %
end
end
If OP wants to go this far, then they could use
when green flag clicked
wait (3.50) secs
forever
create clone of [myself v]
wait until <not <<(backdrop #) = [3]> or <<(backdrop #) = [4]> or <(backdrop #) = [5]>>>>
wait until <<(backdrop #) = [3]> or <<(backdrop #) = [4]> or <(backdrop #) = [5]>>>
end
when I start as a clone
hide
play sound [GameSelectTheme v]
wait until <not <<(backdrop #) = [3]> or <<(backdrop #) = [4]> or <(backdrop #) = [5]>>>>
delete this clone
It would allow the music to restart at the beginning anytime its played.
Last edited by timhortonsyo (March 26, 2020 16:42:09)
- Discussion Forums
- » Help with Scripts
-
» My Scratch project isn't working and I really need to get this "Music Update" out.