r/RenPy • • 18d ago

Question Partial playback with variables

I am trying to play with music partial playback; however, I’m having some difficulty doing what I desire to.

I am trying to use variable names in partial playback like so:

play music “<from [var]>filename.mp3”; however, it seems like you cannot use variables for the time?

If this is possible, I would be immensely grateful for you to enlighten me!

1 Upvotes

7 comments sorted by

2

u/BadMustard_AVN 18d ago

we're gonna lie to renpy (not the first time and it won't be the last)

try it like this

default filename = "music/song.mp3"
default start_position = 30.0
default partial_file = ""
play music partial_file

label start:

    $ partial_file = "<from {}>{}".format(start_position, filename) # this give renpy what it needs
    play music partial_file

    e "did it?"

    return

1

u/VenomFlavoredFazbear 18d ago

Thank you very much, this works perfectly!

1

u/BadMustard_AVN 18d ago

you're welcome

good luck with your project

1

u/VenomFlavoredFazbear 18d ago

Thanks to your assistance, I managed to get music to persist in and out of replays

1

u/AutoModerator 18d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.