[Solved] Adding preference that determines length of pauses

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
Syrale
Regular
Posts: 57
Joined: Sun Oct 25, 2015 10:28 am
Completed: Robot Daycare, Deep Sea Valentine, Locke(d)
Projects: Artificial Selection, rei_carnation
itch: kigyo
Contact:

[Solved] Adding preference that determines length of pauses

#1 Post by Syrale » Mon May 17, 2021 2:42 pm

So I've been trying this for several hours now, but I don't seem to be getting anywhere.

To simulate real speech, I always add short pauses after punctuation marks in my game's dialogue. This makes the text more natural to read in slow text mode, but causes it to be a bit choppy if the text is set to display instantly. That's not very good, so I want to give the player the option to decide how long the pauses should be (or turn them off entirely).

I got to the point where I created the following custom text tag:

Code: Select all

def c_tag(tag, argument):
    if persistent.speechpause:
        return [(renpy.TEXT_TAG, "w="+str(persistent.speechpause_length))]
    else:
        return [(renpy.TEXT_TAG, "w=0")]
config.self_closing_custom_text_tags["c"] = c_tag
But then I saw
The dialogue text tags {p}, {w}, {nw}, and {fast} are processed before custom text tags, and should either be not included inside a custom text tag, or passed through unchanged.
So that explained why it wasn't working.

I also came across RENPY_LESS_PAUSES, but that's not really what I need. I only want the player to be able to turn off specific pauses (those designated with the {c} tag), not all of them.

Does anyone have an idea for how to solve this? Or would customizing pauses be a worthwhile feature request?
Last edited by Syrale on Tue May 18, 2021 4:49 am, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1797
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Adding preference that determines length of pauses

#2 Post by philat » Tue May 18, 2021 2:52 am

You could use config.say_menu_text_filter with regex instead of custom text tags, I think.

User avatar
Syrale
Regular
Posts: 57
Joined: Sun Oct 25, 2015 10:28 am
Completed: Robot Daycare, Deep Sea Valentine, Locke(d)
Projects: Artificial Selection, rei_carnation
itch: kigyo
Contact:

Re: Adding preference that determines length of pauses

#3 Post by Syrale » Tue May 18, 2021 4:48 am

Thank you very much for leading me in that direction! I managed to get it working :D

Post Reply

Who is online

Users browsing this forum: Aardvark, Google [Bot]