How to loop a track inside a MusicRoom?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
How to loop a track inside a MusicRoom?
Hi everyone!
I'm trying to add a botton with the possibility to loop a track of a MusicRoom but I don't get it.
I searched the documentation and the only way I found is create a botton whose action is mr.SetLoop(True) but it doesn't work. I think that SetLoop is a loop for all MusicRoom and no for a single track... but no matter how much I read the documentation and think for myself, I can't imagine how to do it for just one song.
Is it possible or is it very messy? If anyone could tell me how to do it, I'd be very grateful.
I'm trying to add a botton with the possibility to loop a track of a MusicRoom but I don't get it.
I searched the documentation and the only way I found is create a botton whose action is mr.SetLoop(True) but it doesn't work. I think that SetLoop is a loop for all MusicRoom and no for a single track... but no matter how much I read the documentation and think for myself, I can't imagine how to do it for just one song.
Is it possible or is it very messy? If anyone could tell me how to do it, I'd be very grateful.
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: How to loop a track inside a MusicRoom?
Thanks but with this, for I read, stop the music to play a track but I don't want that. I want a button like any audio reproductor: click and when actual track ends, it plays again.isobellesophia wrote: ↑Fri Mar 29, 2019 11:21 pmhttps://www.renpy.org/doc/html/audio.ht ... music.play
You gimme an idea with the renpy.music.play: using music.queue but actually it doesn't work: when I click the button the actual track is looping, but when I click again the loop persists and the music doesn't return to normal
Code: Select all
$ musicloop = False
$ music_is_normal = ""
screen of the musicroom:
if musicloop== False:
textbutton "LOOP (not active)" action SetVariable("musicloop", True)
else:
textbutton "LOOP (active)" action [SetVariable("musicloop", False), SetVariable("music_is_normal", True)]
$ actualtrack = renpy.music.get_playing()
$ renpy.music.queue(actualtrack, loop=True)
if music_is_normal == True:
$ renpy.music.queue(mywholemusic, loop=False)
timer 0.1 action SetVariable("music_is_normal", False)
-
TheMCButterfly
- Newbie
- Posts: 17
- Joined: Sat Mar 30, 2019 12:16 pm
- Projects: Friends Forever - Talk to a character
- IRC Nick: Butterfly
- Contact:
Re: How to loop a track inside a MusicRoom?
I'm pretty sure you can just do
You can stop the sound with:
Code: Select all
define audio.tutorial = "music/filename.ogg"
play music tutorial
Code: Select all
stop music
Re: How to loop a track inside a MusicRoom?
How can add this to a button? I want to add this loop/no-loop feature to a button.TheMCButterfly wrote: ↑Sun Mar 31, 2019 4:25 amI'm pretty sure you can just do
You can stop the sound with:Code: Select all
define audio.tutorial = "music/filename.ogg" play music tutorial
Code: Select all
stop music
- Donmai
- Eileen-Class Veteran
- Posts: 1919
- Joined: Sun Jun 10, 2012 1:45 am
- Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
- Projects: Slumberland
- Location: Brazil
- Contact:
Re: How to loop a track inside a MusicRoom?
I don't know which version of the music room you're using. Mine starts with these lines:
f you set single_track to False, each song will play once and the player will automatically advance to the next track. Set single_track to True and each song will loop until you manually advance to the next track.
I've also tried, but I couldn't find a way to loop only a single track in the music room.
Code: Select all
init python:
mr = MusicRoom(fadeout=1.0, single_track=False, loop=True)I've also tried, but I couldn't find a way to loop only a single track in the music room.
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)
TOIRE NO HANAKO (A Story About Fear)
Re: How to loop a track inside a MusicRoom?
That was exactly what I was looking for ^^Donmai wrote: ↑Sun Mar 31, 2019 1:05 pmI don't know which version of the music room you're using. Mine starts with these lines:f you set single_track to False, each song will play once and the player will automatically advance to the next track. Set single_track to True and each song will loop until you manually advance to the next track.Code: Select all
init python: mr = MusicRoom(fadeout=1.0, single_track=False, loop=True)
I've also tried, but I couldn't find a way to loop only a single track in the music room.
I went back to review the documentation and it escaped me completely ... Thank you, thank you so much!!!
Who is online
Users browsing this forum: Google [Bot]



