[solved]How to make music change affect returning to main menu from music room

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
shiolily
Newbie
Posts: 18
Joined: Fri Aug 20, 2021 5:10 am
Deviantart: shiolily
Contact:

[solved]How to make music change affect returning to main menu from music room

#1 Post by shiolily »

Hello! Sorry for the wordy subject line, but my issue is as follows.

After passing a certain point in the game, the main menu music (and background image) changes. I accomplished this with this code in the script:

Code: Select all

label before_main_menu:

    if persistent.op2:
        $ renpy.music.play('audio/gs.ogg', channel='music', loop=True)
    else:
        $ renpy.music.play('audio/wa.ogg', channel='music', loop=True)
    return main_menu
In the music room code, this is used to change the music back when the player returns to the main menu.

Code: Select all

    # Restore the main menu music upon leaving.

    on "replaced" action Play("music", "audio/gs.ogg")
How can I make the file 'wa.ogg' play if persistent.op2 isn't true yet in the music room?

Additionally (I will move this part into another topic if necessary) I have a ton of songs in my music room and I'd like to implement a scroll bar, but all information I've found on the subject has broken the code or caused crashes. This is what I have right now (it all barely fits)

https://media.discordapp.net/attachment ... nknown.png
Last edited by shiolily on Mon Oct 11, 2021 1:30 am, edited 1 time in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2376
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: How to make music change affect returning to main menu from music room

#2 Post by Ocelot »

Code: Select all

on "replaced" action If(persistent.op2, true=Play("music", "audio/gs.ogg"), false=Play("music", "audio/wa.ogg"))
< < insert Rick Cook quote here > >

shiolily
Newbie
Posts: 18
Joined: Fri Aug 20, 2021 5:10 am
Deviantart: shiolily
Contact:

Re: How to make music change affect returning to main menu from music room

#3 Post by shiolily »

That worked perfectly, thank you so much!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]