0

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

enter image description here

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.

CodeZealot
  • 199
  • 4

1 Answers1

1

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.

Tess
  • 53
  • 5