How to create a pause after every period and comma?

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
twodee
Newbie
Posts: 12
Joined: Tue May 08, 2018 4:30 pm
Contact:

How to create a pause after every period and comma?

#1 Post by twodee » Tue May 08, 2018 4:33 pm

I know that I can just insert a wait tag after every period/comma, but I was wondering if there was a way I could just define something and have the system do it for me automatically?

Thanks :D

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How to create a pause after every period and comma?

#2 Post by Remix » Tue May 08, 2018 5:11 pm

Code: Select all

init python:

    def alter_say_strings( str_to_test ):
        str_map = {
            ". " : ". {w=0.75}", 
            ", " : ", {w=0.45}",
        }
        for key in str_map:
            str_to_test = str_to_test.replace( key, str_map[ key ] ) 
        return str_to_test

define config.say_menu_text_filter = alter_say_strings
*should* work. Untested though so maybe add an extra bit in the values to view, e.g. ". " : ". this has a 3/4 second wait {w=0.75}",
Frameworks & Scriptlets:

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to create a pause after every period and comma?

#3 Post by kivik » Tue May 08, 2018 5:15 pm

Just to add - this is going to cause bad UX when your sentence ends with a . and players have to click twice to proceed and think the game's semi-froze. Also you'll have to consider situations like ... (although you can replace that with ellipses (…) providing your font supports it.

twodee
Newbie
Posts: 12
Joined: Tue May 08, 2018 4:30 pm
Contact:

Re: How to create a pause after every period and comma?

#4 Post by twodee » Tue May 08, 2018 5:34 pm

kivik wrote:
Tue May 08, 2018 5:15 pm
Just to add - this is going to cause bad UX when your sentence ends with a . and players have to click twice to proceed and think the game's semi-froze.
That's true. I think I'll just use Remix's code and get rid of the part for the periods. Need be, I can just manually put in the wait tags after periods so that players don't get confused/annoyed.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How to create a pause after every period and comma?

#5 Post by Remix » Tue May 08, 2018 6:03 pm

twodee wrote:
Tue May 08, 2018 5:34 pm
kivik wrote:
Tue May 08, 2018 5:15 pm
Just to add - this is going to cause bad UX when your sentence ends with a . and players have to click twice to proceed and think the game's semi-froze.
That's true. I think I'll just use Remix's code and get rid of the part for the periods. Need be, I can just manually put in the wait tags after periods so that players don't get confused/annoyed.
You might note that mine *only* replaces commas or periods that are immediately followed by a space, so it should not affect any end of line period (unless that was followed by a space)

You could tweak it to only replace those followed by two spaces, then you could just type:

Code: Select all

eileen "Some words with no pause as only one space after the period. Some with a pause as typed two spaces.  More with a pause.  None at end."
Frameworks & Scriptlets:

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to create a pause after every period and comma?

#6 Post by kivik » Wed May 09, 2018 4:27 am

Ah, sorry didn't spot that! Remix always thinking way ahead of us :D

Post Reply

Who is online

Users browsing this forum: No registered users