Making Dialogue Delay in Renpy More Efficient

In my visual novel, I have small pauses in between dialogue. The code currently looks like this.

The code works fine. But I feel this is extremely inefficient and can get very messy when I eventually get up to hundreds of lines of dialogue.

Is there a way to make this script more efficient? If so, how?

Thanks for your help.

1 Answer

You could do something with character callbacks. It lets you add functions that run anytime a certain character speaks.

init python:
    def Dialogue_Gap(event,pause=0.0,**kwargs):
        if event == "begin":
            renpy.pause(pause)

define delay_showing = Character(callback=Dialogue_Gap,cb_pause=0.75)

label start:
    "It was quiet."
    delay_showing "Too..."
    delay_showing "Quiet..."

You could also make it apply to multiple characters at once using config.all_character_callbacks if you want

init python:
    def Dialogue_Gap(event,pause=0.0,**kwargs):
        if event == "begin":
            renpy.pause(pause)

    config.all_character_callbacks = [Dialogue_Gap]

define delay_showing = Character(cb_pause=0.75)
define b = Character("Show Talkin' Bob",cb_pause=1.5)

label start:
    "It was quiet."
    delay_showing "Too..."
    delay_showing "Quiet..."
    b "Hi"

And if you if you want it to apply to everyone by default, you can change the "pause" parameter to be something other than zero.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest