- May 24, 2020
- 160
- 79
TLDR Version:
1) How to determine, when only 1 or 0 songs are being played, and when a list is queued?
2) How to add a previous/Next music button (Including looped songs (aka. going from last to first song with the next button and vice versa with the previous button))?
Longass version:
Hi there everyone,
Does anyone know, how to create a previous song, next song button in the most elegant way?
I use single songs and queued songs equally often and would like to add a skip music/next/previous music button for the player, if music is ever queued
So far I have scrapped this together:
An extra screen with:
However the len(renpy.music.get_loop()) doesn't work since get_loop doesn't seem to return something with an attribute. that len can read.
Additionally, I'm not smart enough to find the ideal solution for the actual buttons.
So far, my idea for the previous/next button would be to get the loop and then use a convoluted way (with get_playing e.g.) to get the integer of that song and then reshuffle the list with the integer as startsong and then queue it again.
It should work, but it would be just... ugly.
According to the audio-documentation, there's nothing, that I can use, unless I'm stupid (which is honestly probably the case), but the music room has a mr.Next() function, which is the thing, that I'm looking for.
Thank you all in advance.
Thanks again.
EDIT: I put the TLDR first, cuz ain't nobody got time for that
1) How to determine, when only 1 or 0 songs are being played, and when a list is queued?
2) How to add a previous/Next music button (Including looped songs (aka. going from last to first song with the next button and vice versa with the previous button))?
Longass version:
Hi there everyone,
Does anyone know, how to create a previous song, next song button in the most elegant way?
I use single songs and queued songs equally often and would like to add a skip music/next/previous music button for the player, if music is ever queued
So far I have scrapped this together:
An extra screen with:
Python:
If len(renpy.music.get_loop())<2: (If you only have 1 or 0 songs playing, it only gives you a non-working "button" )
add greyed out button previous (just an image)
add greyed out button next (just an image)
else:
add imagebutton previous (actual imagebutton)
add imagebutton next (actual imagebutton)
However the len(renpy.music.get_loop()) doesn't work since get_loop doesn't seem to return something with an attribute. that len can read.
Additionally, I'm not smart enough to find the ideal solution for the actual buttons.
So far, my idea for the previous/next button would be to get the loop and then use a convoluted way (with get_playing e.g.) to get the integer of that song and then reshuffle the list with the integer as startsong and then queue it again.
It should work, but it would be just... ugly.
According to the audio-documentation, there's nothing, that I can use, unless I'm stupid (which is honestly probably the case), but the music room has a mr.Next() function, which is the thing, that I'm looking for.
Thank you all in advance.
Thanks again.
EDIT: I put the TLDR first, cuz ain't nobody got time for that
Last edited: