EDIT - Okay, I figured it out with some help from discord: thanks to Seronis, Fen (Feniks) & Mr. Robot.
Note: We need to use config.main_menu_music so the music won't stop when starting a new game. But, we also need to play music based on a condition. So how do we do that? Like this:
Code: Select all
#your_rpy_file.rpy
init offset -1 # or earlier if needed
define var_some_condition = 0
init python:
def some_function():
# your code here
# return a value
# yes, we're running code in init python
var_some_condition = some_function()
Code: Select all
# options.rpy
# note options.rpy init offset is a default of 0, so this code runs after the code in: your_rpy_file.rpy
define config.main_menu_music = "this.ogg" if var_some_condition = 1 else "that.ogg"
In the future, it would be great if we didn't need to use config.main_menu_music to ensure music doesn't stop when starting a new game.