[SOLVED] Game music keeps playing when exiting to main menu

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
lacrimoosa
Newbie
Posts: 23
Joined: Tue Jun 05, 2018 8:31 pm
Projects: Alice's Reverie
Organization: Red&Pink games
Tumblr: lacrimoosa, alicesreverie
itch: redpink-games
Contact:

[SOLVED] Game music keeps playing when exiting to main menu

#1 Post by lacrimoosa »

The main menu music only plays when you first start up the game and when you complete a route and return to the main menu. However, when you go to the main menu from in the middle of a route, the main menu music doesn't play. The music from the game just continues instead. Is there a way to stop this from happening?

I've had this problem before, but it was a while ago I don't quite remember how to solve it.
Last edited by lacrimoosa on Mon Jun 18, 2018 7:58 am, edited 1 time in total.
Image

An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Game music keeps playing when exiting to main menu

#2 Post by Imperf3kt »

You want the menu music to play, instead of the game music, when a player opens the menu?
Or only when they're on the main menu?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
lacrimoosa
Newbie
Posts: 23
Joined: Tue Jun 05, 2018 8:31 pm
Projects: Alice's Reverie
Organization: Red&Pink games
Tumblr: lacrimoosa, alicesreverie
itch: redpink-games
Contact:

Re: Game music keeps playing when exiting to main menu

#3 Post by lacrimoosa »

I want only the main menu music to play when they are on the main menu. But if you were to return to the main menu via the save menu in the middle of playing the music is replaced by whatever audio was playing during gameplay for some reason?
Image

An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."

User avatar
lacrimoosa
Newbie
Posts: 23
Joined: Tue Jun 05, 2018 8:31 pm
Projects: Alice's Reverie
Organization: Red&Pink games
Tumblr: lacrimoosa, alicesreverie
itch: redpink-games
Contact:

Re: Game music keeps playing when exiting to main menu

#4 Post by lacrimoosa »

Imperf3kt wrote: Mon Jun 11, 2018 4:22 am You want the menu music to play, instead of the game music, when a player opens the menu?
Or only when they're on the main menu?
I want only the main menu music to play when they are on the main menu. But if you were to return to the main menu via the save menu in the middle of playing the music is replaced by whatever audio was playing during gameplay for some reason?
Image

An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."

User avatar
lacrimoosa
Newbie
Posts: 23
Joined: Tue Jun 05, 2018 8:31 pm
Projects: Alice's Reverie
Organization: Red&Pink games
Tumblr: lacrimoosa, alicesreverie
itch: redpink-games
Contact:

Re: Game music keeps playing when exiting to main menu

#5 Post by lacrimoosa »

Just to clarify, the main menu music will play only when you start the game and when you finish the game, which is normal (?) It's just going to the main menu before actually finishing the game causes the music to not play and get replaced with the in-game music.

If anyone knows how to fix this, please help!
Image

An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Game music keeps playing when exiting to main menu

#6 Post by Imperf3kt »

Sorry about not replying earlier, opened the thread and forgot about it by the time I could reply.

You could perhaps use an on show statement to enqueue the song to play. I've not tried to do this, but it should work this way, I think.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
lacrimoosa
Newbie
Posts: 23
Joined: Tue Jun 05, 2018 8:31 pm
Projects: Alice's Reverie
Organization: Red&Pink games
Tumblr: lacrimoosa, alicesreverie
itch: redpink-games
Contact:

Re: Game music keeps playing when exiting to main menu

#7 Post by lacrimoosa »

Imperf3kt wrote: Mon Jun 18, 2018 4:32 am Sorry about not replying earlier, opened the thread and forgot about it by the time I could reply.

You could perhaps use an on show statement to enqueue the song to play. I've not tried to do this, but it should work this way, I think.
Thank you for the help! But I just found the problem a few seconds ago. it was an issue with the buttons I made for screen_save and screen_load. The code I referencing had the wrong action associated with the "main menu" button

The actions for the button that takes you to main menu was:

Code: Select all

action ShowMenu("main_menu")
I replaced that with:

Code: Select all

action MainMenu()
and that seemed to do the trick.
Image

An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]