Trouble adding music 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
Zalsburry
Newbie
Posts: 4
Joined: Sun Feb 23, 2014 1:58 pm
Contact:

Trouble adding music to Main Menu

#1 Post by Zalsburry » Mon Jul 22, 2019 11:00 am

Hey, lovely people! I'd really appreciate if someone could help me with adding music to the main menu of my project.

I believe I followed all of the instructions I've seen online. In the options.rpy screen, like instructed, I've uncommented the main menu music line and replaced the title in quotes with the title of my music file. The line in options.rpy looks like this:

config.main_menu_music = "lazyafternoons.mp3"

The file itself is in the game folder, is titled exactly lazyafternoons, and is definitely an .mp3 file. Yet, when I try to Start the project I get this:

"Parsing the script failed.

File "game/options.rpy", line 63: expected statement.
config.main_menu_music ->= "lazyafternoons.mp3"
^
Ren'Py Version: Ren'Py 6.99.11.1749"

I've tried adding and deleting a space before the equals sign in case that was the problem. I've retyped the line myself in case there was a typo in formatting. I even replaced "lazyafternoons.mp3" with the name of another music file in the game folder to see if the problem was with the file. But nothing changes.

Also, I have this same track play in the game proper. When I comment this line so I can get back into the game, the music file plays absolutely fine in game when called to by "play music "lazyafternoons.mp3" "

Does anyone have any ideas for what I can try?

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Trouble adding music to Main Menu

#2 Post by Per K Grok » Mon Jul 22, 2019 11:58 am

Zalsburry wrote:
Mon Jul 22, 2019 11:00 am
Hey, lovely people! I'd really appreciate if someone could help me with adding music to the main menu of my project.

I believe I followed all of the instructions I've seen online. In the options.rpy screen, like instructed, I've uncommented the main menu music line and replaced the title in quotes with the title of my music file. The line in options.rpy looks like this:

config.main_menu_music = "lazyafternoons.mp3"

---

Does anyone have any ideas for what I can try?
Have you lost the 'define' that the line should start with?

define config.main_menu_music = "lazyafternoons.mp3"

User avatar
Andredron
Miko-Class Veteran
Posts: 535
Joined: Thu Dec 28, 2017 2:37 pm
Completed: Kimi ga nozomu renpy-port(demo), Albatross Koukairoku(demo)
Projects: Sisters ~Natsu no Saigo no Hi~(renpy-port)
Location: Russia
Contact:

Re: Trouble adding music to Main Menu

#3 Post by Andredron » Mon Jul 22, 2019 12:37 pm

Code: Select all


screen main_menu():
    python:
        renpy.music.play("menu.mp3", fadeout=10.0, fadein=15.0)
    frame:
        ....
        
        
I'm writing a Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18

Help me to register in QQ International

Honest Critique

Zalsburry
Newbie
Posts: 4
Joined: Sun Feb 23, 2014 1:58 pm
Contact:

Re: Trouble adding music to Main Menu

#4 Post by Zalsburry » Tue Jul 23, 2019 2:16 pm

Oh my goodness, thank you so much!! I don't know where along the line I lost "define" but I know I never would have realized it on my own, thank you. I added in "define" and now it works perfectly.

Thank you <3

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Trouble adding music to Main Menu

#5 Post by namastaii » Tue Jul 23, 2019 6:44 pm

If you go to options.rpy, there is a line that you can comment out that sets the music for the main menu

Code: Select all

# define config.main_menu_music = "main-menu-theme.ogg"
You don't need to add a command to the menu screen directly

Post Reply

Who is online

Users browsing this forum: No registered users