How to: Delay sound playing without renpy.pause?
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.
- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
How to: Delay sound playing without renpy.pause?
I was wondering if there were some method by which I can incorporate a delay in playback without having to use a pause statement that would stop the say screen from continuing? Couldn't find anything about it in the documentation. Manually adjusting the length of the sound files is sadly not an option due to randomisation.
- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
Re: How to: Delay sound playing without renpy.pause?
Alternatively, and possibly even handier, would be some method of keeping text on the say screen while paused rather than blanking it out.
Re: How to: Delay sound playing without renpy.pause?
Have you tried using interact=false before the pause?
It works for keeping the text on the screen for a menu, so I'm going to take a leap of logic and say it'd work for pause too.$ renpy.say(None, "blah blah blah", interact=False)

If we are what we repeatedly do, then good coding is not an act, but a habit
- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
Re: How to: Delay sound playing without renpy.pause?
Interesting! I was totally unaware that that was a thing. Thanks for pointing me in that direction, I'll definitely investigate.
- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
Re: How to: Delay sound playing without renpy.pause?
Okay, I've been experimenting, and interact=False can largely do what I want in a clumsy way... But the text still gets caught up in transitions, which looks bad. Is there any way to exclude things from a transition somehow?
Re: How to: Delay sound playing without renpy.pause?
I don't know what you're trying to do exactly, so it's difficult to know if this would be optimal for you, but one possible avenue would be use a timer in a screen. Something like
and then simply show the screen in the game with time and file specified.
Code: Select all
screen delayedplay(time, file):
timer time action Play("sound", file)- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
Re: How to: Delay sound playing without renpy.pause?
philat, I thought of that, but I need it to be a more modular, able to handle timing for multiple items at once.
Basically, from a label I want to choreograph the sounds to coincide with delayed visual effects on a screen. I could hand-code clunky timers into every single cutscene screen, but as I said, a modular solution would save me ten tons of headache and repetition.
Basically, from a label I want to choreograph the sounds to coincide with delayed visual effects on a screen. I could hand-code clunky timers into every single cutscene screen, but as I said, a modular solution would save me ten tons of headache and repetition.
Re: How to: Delay sound playing without renpy.pause?
Given that you can pass times and files to the screen, why is this not a "modular" solution that would work for you? Yes, you need to know the times and files to pass, but presumably you know that anyway (whether randomly generated or otherwise). Again, I have no idea how you set up your system or exactly what you're trying to achieve so I'm shooting blind here.
ETA: Anyway, to answer your question from above my post, you can apply a transition to a particular layer, I suppose. I don't think there's an easy way to exclude just the text (as opposed to anything else on the screen layer -- which is where text shows up by default, being part of the say screen).
ETA: Anyway, to answer your question from above my post, you can apply a transition to a particular layer, I suppose. I don't think there's an easy way to exclude just the text (as opposed to anything else on the screen layer -- which is where text shows up by default, being part of the say screen).
- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
Re: How to: Delay sound playing without renpy.pause?
I'm not really using any kind of 'system.' Just screens that have delayed transforms, and playing sounds from a label by way of a for loop.
For 'passing times and files to the screen,' wouldn't showing the same screen multiple times just replace/cancel the previous instance of the screen? It's not very modular if I have to pass umpteen variables to it with six lines of timers going at once.
For 'passing times and files to the screen,' wouldn't showing the same screen multiple times just replace/cancel the previous instance of the screen? It's not very modular if I have to pass umpteen variables to it with six lines of timers going at once.
Re: How to: Delay sound playing without renpy.pause?
Winterslice wrote:For 'passing times and files to the screen,' wouldn't showing the same screen multiple times just replace/cancel the previous instance of the screen? It's not very modular if I have to pass umpteen variables to it with six lines of timers going at once.
Code: Select all
$ ui.timer(1.5, Play("sound", "sfx/sound.wav"))- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
Re: How to: Delay sound playing without renpy.pause?
Man, I really wish those ui functions were better documented. That could've been handy elsewhere. But in this case, it only plays one sound and ignores all subsequent commands. (Sounds are not playing on the same channel, so that's not the problem.) Is there any way I can get it to do multiple things?xela wrote:Winterslice wrote:For 'passing times and files to the screen,' wouldn't showing the same screen multiple times just replace/cancel the previous instance of the screen? It's not very modular if I have to pass umpteen variables to it with six lines of timers going at once.?Code: Select all
$ ui.timer(1.5, Play("sound", "sfx/sound.wav"))
Can screen timers be placed inside if statements? That might solve my problem.
Re: How to: Delay sound playing without renpy.pause?
Yes, you can place both ui and screen timers in if/else forks. ui module is largely made obsolete with the screen language but some of it's functions are still valid and even used by the screens through wrappers (or at least were, SL2 changed loads of stuff).
- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
Re: How to: Delay sound playing without renpy.pause?
Cheers. I'm going to try something. Will report back.xela wrote:Yes, you can place both ui and screen timers in if/else forks. ui module is largely made obsolete with the screen language but some of it's functions are still valid and even used by the screens through wrappers (or at least were, SL2 changed loads of stuff).
Re: How to: Delay sound playing without renpy.pause?
Oki, you can also do this:
It's hard to imagine it getting any more convenient than this.
Code: Select all
init python:
def func(...):
...
$ ui.timer(1.5, func, args=(), kwargs={})- Winterslice
- Veteran
- Posts: 228
- Joined: Mon Sep 28, 2015 3:51 am
- Completed: The Next World, Golem Creation Kit
- Organization: Illuminated Games
- Contact:
Re: How to: Delay sound playing without renpy.pause?
I actually ended up doing it with screen timers on a loop, using a dict to feed it sounds and times, since ui.timer won't do more than one thing. Works great, and I can select either random sounds or go through them in sequence.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]
