Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Tue Jun 18, 2013 12:58 am

All times are UTC - 5 hours [ DST ]


Forum rules


Ren'Py support questions should go here. This forum is for discussing changes to Ren'Py itself.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: 6.12.2: Music Room
PostPosted: Sat Jul 02, 2011 10:13 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10848
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
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-room

If 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.rpy

and 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


Top
 Profile Send private message  
 
 Post subject: Re: 6.12.2: Music Room
PostPosted: Sun Jul 03, 2011 1:30 am 
Veteran
User avatar

Joined: Mon Aug 09, 2010 10:02 pm
Posts: 237
Location: California, USA
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
I read over the documentation and didn't find any mistakes, myself.

Also took a look at the .rpy - ooh, I didn't know about renpy.seen_audio. The way I implemented music unlocking was to make a custom play() function which unlocks the song upon playing, and then make the entire game script use this play() function instead of "play music"... though, I had other uses for this function, too. (Such as being able to refer to Python objects instead of raw filenames, and being able to play an Intro section followed by a Loop section of the song.)

Anyway, good to see a music room framework!

_________________
Dai-Sukima Dan blog


Top
 Profile Send private message  
 
 Post subject: Re: 6.12.2: Music Room
PostPosted: Sun Jul 03, 2011 5:21 pm 
Miko-Class Veteran

Joined: Mon Nov 01, 2010 9:10 pm
Posts: 832
Only problem I noticed:
Code:
textbutton "Music Room" action ShowMenu("music_room")


Should be
Code:
textbutton _("Music Room") action ShowMenu("music_room")

_________________
I have moved to a new account. Please contact me here from now on. T/Y~


Top
 Profile Send private message  
 
 Post subject: Re: 6.12.2: Music Room
PostPosted: Sun Jul 03, 2011 5:54 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10848
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
While you're right, that won't be necessary once I finish the translation system. I was just looking ahead when writing the documentation.

Good catch.

_________________
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


Top
 Profile Send private message  
 
 Post subject: Re: 6.12.2: Music Room
PostPosted: Wed Jul 06, 2011 2:33 pm 
Miko-Class Veteran
User avatar

Joined: Fri Jul 07, 2006 9:58 pm
Posts: 733
Location: France
Projects: Suna to Majo
I assume it's possible to customize and create themed music rooms?

Like assigning a themed BG with one song, or create custom playlists, animations, videos...
Not that I would make use of them by now, but it would be interesting to know if it's possible.

_________________
Yume no Sora blog


Top
 Profile Send private message  
 
 Post subject: Re: 6.12.2: Music Room
PostPosted: Tue Sep 20, 2011 12:03 am 
Regular
User avatar

Joined: Tue Dec 15, 2009 12:38 am
Posts: 39
Thank you very much for this code! Now I just need to combine this with the other music room code and voila, ipod theme here we go!


Top
 Profile Send private message  
 
 Post subject: Re: 6.12.2: Music Room
PostPosted: Wed May 08, 2013 8:06 am 
Newbie

Joined: Wed May 08, 2013 8:06 am
Posts: 1
After putting it under some scrutiny, it appears that it works. Thanks for that.




_________________
Computer Q & A


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group