[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: 101
Joined: Sun Oct 25, 2015 10:28 am
Completed: Robot Daycare, Deep Sea Valentine, Locke(d)
Projects: Artificial Selection, Artificial Fashionista, rei_carnation
Github: kigyo
itch: kigyo
Discord: kigyodev
Contact:

[Solved] Adding preference that determines length of pauses

#1 Post by Syrale »

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.
ImageArtificial Selection (ongoing) |ImageDeep Sea Valentine | ImageRobot Daycare (NaNo19)
| ImageArtificial Fashionista (NaNo24)

My Developer Tools: Ren'Py Minimap/Location System | Ren'Py Word Counter+

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

Re: Adding preference that determines length of pauses

#2 Post by philat »

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

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

Re: Adding preference that determines length of pauses

#3 Post by Syrale »

Thank you very much for leading me in that direction! I managed to get it working :D
ImageArtificial Selection (ongoing) |ImageDeep Sea Valentine | ImageRobot Daycare (NaNo19)
| ImageArtificial Fashionista (NaNo24)

My Developer Tools: Ren'Py Minimap/Location System | Ren'Py Word Counter+

Post Reply

Who is online

Users browsing this forum: Google [Bot]