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 Wed Jun 19, 2013 12:17 pm

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sat Jul 30, 2011 2:04 pm 
Veteran
User avatar

Joined: Sat Jan 15, 2011 5:41 pm
Posts: 456
Location: England
Projects: Nijiko
Organization: Colorful Visual Arts (formerly Scope Games)
Is there any way to display the name of the music track currently playing, on the screen and for it to correspond to a playlist? So that the title of the song will pop up when the song changes? I ask because I want to position it over an on screen image of an mp3 player.

_________________
New Games as [pen-kun]:
http://colorfulvisualarts.wordpress.com

Old Games as clannadman:
http://clannadppvisualproject.wordpress.com
http://scopegames.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sat Jul 30, 2011 2:10 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10849
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Yes, you'd use:

Code:
$ playing = renpy.music.get_playing("music")


Note that this can return None if the user has muted the music.

_________________
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  
 
PostPosted: Sun Jul 31, 2011 3:21 am 
Veteran
User avatar

Joined: Sat Jan 15, 2011 5:41 pm
Posts: 456
Location: England
Projects: Nijiko
Organization: Colorful Visual Arts (formerly Scope Games)
How would I position the text? Would it be as simple as:

Code:
$ playing = renpy.music.get_playing("music", xpos=0.1, ypos=0.1)

_________________
New Games as [pen-kun]:
http://colorfulvisualarts.wordpress.com

Old Games as clannadman:
http://clannadppvisualproject.wordpress.com
http://scopegames.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sun Jul 31, 2011 6:38 am 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10849
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Oh, that simply stashes the name of the music into a variable. If you want to position it, you'd have to use a screen:

Code:
screen playing_music:
    $ playing = renpy.music.get_playing("music")
    if playing is not None:
        text playing xpos 0.1 ypos 0.1
    else:
        text "No Music Playing" xpos 0.1 ypos 0.1

_________________
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  
 
PostPosted: Sun Jul 31, 2011 11:28 am 
Veteran
User avatar

Joined: Sat Jan 15, 2011 5:41 pm
Posts: 456
Location: England
Projects: Nijiko
Organization: Colorful Visual Arts (formerly Scope Games)
Nothing seems to be appearing although the issue might be that I'm using a playlist rather than individual tracks:

Code:
python:
        def ambient(songlist, interval):
            playlist = ["music/pause.wav"]
            for song in songlist:
                playlist.append(song)
                j = renpy.random.randint(2, interval)
                for i in range(0, j):
                    playlist.append("music/pause.wav")
            return renpy.music.play(playlist, channel=6)

_________________
New Games as [pen-kun]:
http://colorfulvisualarts.wordpress.com

Old Games as clannadman:
http://clannadppvisualproject.wordpress.com
http://scopegames.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sun Jul 31, 2011 1:01 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10849
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Are you showing the screen?

_________________
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  
 
PostPosted: Sun Jul 31, 2011 1:55 pm 
Veteran
User avatar

Joined: Sat Jan 15, 2011 5:41 pm
Posts: 456
Location: England
Projects: Nijiko
Organization: Colorful Visual Arts (formerly Scope Games)
My bad. It's showing now, however I get 'No Music Playing' instead of the currently playing song in the playlist.

Code:
screen playing_music:
    $ playing = renpy.music.get_playing("music")
    if playing is not None:
        text playing xpos 0.1 ypos 0.1
    else:
        text "No Music Playing" xpos 0.1 ypos 0.1


Code:
python:
        def ambient(songlist, interval):
            playlist = ["music/pause.wav"]
            for song in songlist:
                playlist.append(song)
                j = renpy.random.randint(2, interval)
                for i in range(0, j):
                    playlist.append("music/pause.wav")
            return renpy.music.play(playlist, channel=6)


Code:
scene bgcar
    with fade
    $ ambient(("music/riju.mp3","music/fat girl.mp3","music/Escaping NYC.mp3"), 4)
    show screen playing_music

_________________
New Games as [pen-kun]:
http://colorfulvisualarts.wordpress.com

Old Games as clannadman:
http://clannadppvisualproject.wordpress.com
http://scopegames.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sun Jul 31, 2011 2:14 pm 
Veteran
User avatar

Joined: Wed Nov 18, 2009 11:17 am
Posts: 365
Location: Germany
Completed: Loren
Projects: PS2
Code:
screen playing_music:
    $ playing = renpy.music.get_playing(6)
    if playing is not None:
        text playing xpos 0.1 ypos 0.1
    else:
        text "No Music Playing" xpos 0.1 ypos 0.1


Does this work?

_________________
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase II


Top
 Profile Send private message  
 
PostPosted: Sun Jul 31, 2011 2:46 pm 
Veteran
User avatar

Joined: Sat Jan 15, 2011 5:41 pm
Posts: 456
Location: England
Projects: Nijiko
Organization: Colorful Visual Arts (formerly Scope Games)
@Anima - I still get the 'No Music Playing' rather than the title track.

_________________
New Games as [pen-kun]:
http://colorfulvisualarts.wordpress.com

Old Games as clannadman:
http://clannadppvisualproject.wordpress.com
http://scopegames.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sun Jul 31, 2011 3:05 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10849
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Hm... we might be getting into a race condition here. What's happening is that the screen is being displayed before the music gets started.

Try using Anima's code, and then putting a:

Code:
    $ renpy.pause(.25)


Between the ambient and show screen lines. (The .25 is probably long - it might even work with a delay of 0.)

_________________
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  
 
PostPosted: Sun Jul 31, 2011 3:43 pm 
Veteran
User avatar

Joined: Sat Jan 15, 2011 5:41 pm
Posts: 456
Location: England
Projects: Nijiko
Organization: Colorful Visual Arts (formerly Scope Games)
@PyTom - The same problem still arises. Perhaps theres something wrong with the type of playlist I'm using?

Code:
show screen playing_music
    $ renpy.pause(.25)
    $ ambient(("music/riju.mp3","music/fat girl.mp3","music/Escaping NYC.mp3"), 4)

_________________
New Games as [pen-kun]:
http://colorfulvisualarts.wordpress.com

Old Games as clannadman:
http://clannadppvisualproject.wordpress.com
http://scopegames.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Sun Jul 31, 2011 3:52 pm 
Lemma-Class Veteran
User avatar

Joined: Fri May 23, 2008 2:11 pm
Posts: 2545
Location: USA
Projects: RockRobin
Are you updated to latest Ren'Py? That fixed my renpy.music.get_playing() problems before. Also, I find that the string will not update in real time. The screen needs to be refreshed every time the music changes. I got "around" this by not actively displaying the track and having the player click a playlist button to see the title.

_________________
I apologize in advance for being extremely opinionated.
[Tutorial] How to Customize the Textbox
[Tutorial] How to Customize Game Menus
Icon art by Mocha07734


Top
 Profile Send private message  
 
PostPosted: Sun Jul 31, 2011 3:59 pm 
Veteran
User avatar

Joined: Sat Jan 15, 2011 5:41 pm
Posts: 456
Location: England
Projects: Nijiko
Organization: Colorful Visual Arts (formerly Scope Games)
@Aleema - I'm currently using 6.12.1.1501. Does it require upgrading?

_________________
New Games as [pen-kun]:
http://colorfulvisualarts.wordpress.com

Old Games as clannadman:
http://clannadppvisualproject.wordpress.com
http://scopegames.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Mon Aug 01, 2011 12:47 pm 
Veteran
User avatar

Joined: Sat Jan 15, 2011 5:41 pm
Posts: 456
Location: England
Projects: Nijiko
Organization: Colorful Visual Arts (formerly Scope Games)
I've discovered the issue. Rather than using Anima's code word for word I'd accidentally left in the brackets around the channel number.

Code:
screen playing_music:
    $ playing = renpy.music.get_playing("6")
    if playing is not None:
        text playing xpos 0.1 ypos 0.1
    else:
        text "No Music Playing" xpos 0.1 ypos 0.1


It's working now although it displays the filename completely i.e. ifeelfine.mp3. Is there a way to display a given text title for it? Would I have to put something in the init block similar to how images are defined?

Also, a way to give a specific colour, size and font (if the last one is possible), separate from the default?

_________________
New Games as [pen-kun]:
http://colorfulvisualarts.wordpress.com

Old Games as clannadman:
http://clannadppvisualproject.wordpress.com
http://scopegames.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Mon Aug 01, 2011 1:10 pm 
Veteran
User avatar

Joined: Wed Nov 18, 2009 11:17 am
Posts: 365
Location: Germany
Completed: Loren
Projects: PS2
You could use a dictionary mapping.
Code:
$ musictitles = {"ifeelfine.mp3":("I feel Fine","#00FF00",20,"FunnyFont.ttf")}

screen playing_music:
    $ playing = renpy.music.get_playing(6)
    if playing is not None:
        playing = musictitles[playing]
        text playing[0] xpos 0.1 ypos 0.1 color playing[1] size playing[2] font playing[3]
    else:
        text "No Music Playing" xpos 0.1 ypos 0.1

_________________
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase II


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: arachni42, Google [Bot]


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