- May 24, 2020
- 160
- 79
Hey everyone,
Right now, I'm struggling with a very weird problem concerning renpy.audio.queue
Let's say I have 2 kinds of music playlists:
And in my game script both get at one point or another queued up, but one is random:
It would look like this:
stop music
$ renpy.music.queue(list1, loop=True)
and
stop music
$renpy.random.shuffle(list2)
$ renpy.music.queue(list2, loop=True)
it works nicely.
However, the shuffle only happens in the "beginning " of the script, when you queue it up. So if you reload the game, you always hear the same songs in the same sequence.
To shuffle them, I decided to go with:
label after_load:
$renpy.random.shuffle(list2)
It works perfectly: Every time you reload your game, another song from the list gets played.
just what I wanted.
Now the problem part: let's say you want to add or remove a song from your lists with a patch:
list1 goes down without a hitch. Define does its job nicely. The new songs, that are played are from the patched list.
Whenever you load up the game, you always start with the first song on your list, but whatever, that's what you wanted: nice.
list2 on the other hand...
list2 gets weird af, once you load a savefile, that's playing the list already.
you always start with the same song. despite $renpy.random.shuffle(list2) also being in the after_load and despite $renpy.random.shuffle(list2) in after_load working before.
The music queue is also fixed.
Why? Because it assumes the weirdest shit:
It takes the old queue, but your list2 is different.
Meaning:
if you open up the console and type: list2, it shows you: [track1, track4, ..., track100, track101,track2000], however your queued music is track1-100 shuffled, just like the one before. It even has track2 and 3, which were removed but not track 101 and 2000 which were added.
So my questions are kinda simple, even though the problem was difficult to describe:
1) Why does renpy play the old playlist, and how can I make it stop that.
2) Is there a more elegant way to have random-music-queue, with appliable patches?
Thanks for everyone, who was willing to read such a giant wall of text.
Right now, I'm struggling with a very weird problem concerning renpy.audio.queue
Let's say I have 2 kinds of music playlists:
Python:
define list1 = [track1, track2, track3, ..., track100]
default list2 = [track1, track2, track3, ..., track100]
It would look like this:
stop music
$ renpy.music.queue(list1, loop=True)
and
stop music
$renpy.random.shuffle(list2)
$ renpy.music.queue(list2, loop=True)
it works nicely.
However, the shuffle only happens in the "beginning " of the script, when you queue it up. So if you reload the game, you always hear the same songs in the same sequence.
To shuffle them, I decided to go with:
label after_load:
$renpy.random.shuffle(list2)
It works perfectly: Every time you reload your game, another song from the list gets played.
just what I wanted.
Now the problem part: let's say you want to add or remove a song from your lists with a patch:
Python:
label after_load:
#optional if-clause for patches, but for testing purposes not necessary
$list2 = [track1, track4, ..., track100, track101,track2000]
$renpy.random.shuffle(list2)
list1 goes down without a hitch. Define does its job nicely. The new songs, that are played are from the patched list.
Whenever you load up the game, you always start with the first song on your list, but whatever, that's what you wanted: nice.
list2 on the other hand...
list2 gets weird af, once you load a savefile, that's playing the list already.
you always start with the same song. despite $renpy.random.shuffle(list2) also being in the after_load and despite $renpy.random.shuffle(list2) in after_load working before.
The music queue is also fixed.
Why? Because it assumes the weirdest shit:
It takes the old queue, but your list2 is different.
Meaning:
if you open up the console and type: list2, it shows you: [track1, track4, ..., track100, track101,track2000], however your queued music is track1-100 shuffled, just like the one before. It even has track2 and 3, which were removed but not track 101 and 2000 which were added.
So my questions are kinda simple, even though the problem was difficult to describe:
1) Why does renpy play the old playlist, and how can I make it stop that.
2) Is there a more elegant way to have random-music-queue, with appliable patches?
Thanks for everyone, who was willing to read such a giant wall of text.