I managed to get some work done on Ren'Py today, for the first time in over a week. Since I'm in no condition to code newtext, I put some work into a Music Room system. Since the result is immediately useful, I thought I'd post it here.
The idea is that Ren'Py will supply a series of actions that manipulate a playlist. It's then up to the creator to make a screen that takes advantage of those actions to become an actual music room. Here's the example code from the documentation.
Code:
init python:
# Step 1. Create a MusicRoom instance.
mr = MusicRoom(fadeout=1.0)
# Step 2. Add music files.
mr.add("track1.ogg", always_unlocked=True)
mr.add("track2.ogg")
mr.add("track3.ogg")
# Step 3. Create the music room screen.
screen music_room:
tag menu
frame:
has vbox
# The buttons that play each track.
textbutton "Track 1" action mr.Play("track1.ogg")
textbutton "Track 2" action mr.Play("track2.ogg")
textbutton "Track 3" action mr.Play("track3.ogg")
null height 20
# Buttons that let us advance tracks.
textbutton "Next" action mr.Next()
textbutton "Previous" action mr.Previous()
null height 20
# The button that lets the user exit the music room.
textbutton "Main Menu" action ShowMenu("main_menu")
# Start the music playing on entry to the music room.
on "replace" action mr.Play()
# Restore the main menu music upon leaving.
on "replaced" action Play("music", "track1.ogg")
Of course, this being screens-based, this could just as easily be an imagemap or something like that.
Rather than try to write thus up further, I've posted the documentation online:
http://www.renpy.org/dev-doc/html/rooms.html#music-roomIf someone could proofread that, I'd appreciate it - it's hard to focus on proofreading.
You can take advantage of this today by grabbing the code from:
http://bazaar.launchpad.net/~renpytom/r ... icroom.rpyand dropping it into your game. (You should also change the init -1135 in that file to something smaller, like init -100.)
_________________
Another Old-Fashioned Bishoujo Gamer
Supporting creators since 2004; Code > Drama
(When was the last time you backed up your game?)
"It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face in marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming" - Theodore Roosevelt