Essentially, at the beginning of every scene, we declare the value of "mmdarkness". The value can range anywhere from "0" to "100", where "0" provides a nice, happy, sunny menu screen, and "100" provides a dark foreboding menu screen. A user can quit at any point, start the game back up, the persistent data is evaluated, and the appropriate color is displayed to the user.
Our problem comes from the accompanying audio. Obviously, we would like to have music that matches the mood of the title screen. Here's a simplified version of the code we're using in the options.rpy file:
Code: Select all
if persistent.mmdarkness == "0":
config.main_menu_music = "happy.wav"
if persistent.mmdarkness == "100":
config.main_menu_music = "sad.wav"
else:
config.main_menu_music = "blank.wav"
As an example, let's say the user begins a "New Game". The first scene is initialized and the value of "mmdarkness" is set to 0. At this point, the user can back out to the main menu, and the "happy" music will play. Similarly, if the user advances to a scene in which "mmdarkness" is set to 100, they can then back out to the main menu, and the "sad" music will play.
However, if the user quits at that point, and then starts back up, the main menu will play no music.
We know the "mmdarkness" file is set and is being evaluated properly on startup, otherwise we would not be displaying the proper graphics (which we are). So why is config.main_menu_music not evaluating "mmdarkness" and playing the appropriate music upon startup?