Help with Music Room[SOLVED]
Posted: Mon Nov 08, 2010 10:45 pm
Well I decided to add a Music Room to my VN, and I really can't figure out what I do wrong, it just keeps crashing on me.
That's the full code. A little help?
Code: Select all
def set_playing_(track):
store.playing = track
return True
set_playing = renpy.curry(set_playing_)
# Call this with a button name and a track to define a music
# button.
def music_button(name, track):
if store.playing == track:
role = "selected_"
else:
role = ""
if not renpy.seen_audio(track):
name = "???"
clicked = None
else:
clicked = set_playing(track)
ui.textbutton(
name,
clicked=clicked,
role=role,
size_group="music")
# Add to the main menu.
config.main_menu.insert(3, ("Music Room", "music_room", "True"))
label music_room:
scene bg safe
python:
_game_menu_screen = None
# The default track of music.
playing = "1-Decay.mp3"
label music_room_loop:
# Play the playing music, if it changed.
python:
renpy.music.play(playing, if_changed=True, fadeout=1)
# Display the various music buttons.
ui.side(('c', 'r'), xpos=140, ypos=130, xanchor=0.0, yanchor=0.0, spacing=5)
vp = ui.viewport(draggable=True, mousewheel=True, xmaximum=250, ymaximum=220)
ui.vbox()
music_button("Decay", "Decay.mp3")
music_button("Rains will Fall", "Rains will Fall.mp3")
music_button("Deep Noise", "Deep Noise.mp3")
music_button("Decisions", "Decisions")
music_button("Harmful or Fatal", "Harmful or Fatal.mp3")
music_button("Master", "Master.mp3")
music_button("Interloper", "Interloper.mp3")
music_button("Kool Kats", "Kool Kats")
music_button("Lightless Dawn", "Lightless Dawn.mp3")
music_button("Atlantean Twilight", "Atlantean Twilight")
ui.close()
ui.bar(adjustment=vp.yadjustment, style='vscrollbar')
ui.close()
ui.side(('c', 'r'), xpos=410, ypos=130, xanchor=0.0, yanchor=0.0, spacing=5)
vp = ui.viewport(draggable=True, mousewheel=True, xmaximum=250, ymaximum=220)
# This is how we return to the main menu.
ui.textbutton(
"Return",
clicked=ui.returns(False),
xalign=1,
ypos=550,
size_group="music")
if ui.interact():
jump music_room_loop
else:
return