Music For Main menu doesn't play? [SOLVED]

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
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Music For Main menu doesn't play? [SOLVED]

#1 Post by AsHLeX »

So what I was trying to do was to change the music of the main menu after playing through the game.
What I did was:

Code: Select all

## Music that is played while the user is at the main menu.
    if (persistent.finish == True):
        config.main_menu_music = "tamskyatd.mp3"
    else:
        config.main_menu_music = None
But after the player finishes the game and goes back to the main menu, the music doesn't play.
But if I close the game and restart it *with the persistent data still in it*, the music works perfectly fine.
Any help would be greatly appreciated. :)
Thanks!
Last edited by AsHLeX on Fri Jul 25, 2014 10:24 pm, edited 1 time in total.
Image
New demo out 24/12/23!!

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Music For Main menu doesn't play?

#2 Post by Alex »

Try to play music when main menu is shown instead of changing config.main_menu.music, like

Code: Select all

screen main_menu:
    # all the stuff

    on "show" action If("persistent.finish", Play("music", "tamskyatd.mp3", loop=True), Stop("music"))
    on "hide" action Stop("music")
    on "replaced" action Stop("music")
(code not tested)

http://lemmasoft.renai.us/forums/viewto ... 65#p292740
http://www.renpy.org/doc/html/screen_ac ... io-actions
http://www.renpy.org/doc/html/screen_ac ... er-actions

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Music For Main menu doesn't play?

#3 Post by AsHLeX »

@Alex: Thanks! Got it! :D
Image
New demo out 24/12/23!!

Post Reply

Who is online

Users browsing this forum: No registered users