How to prevent mouse click skipping during dialogue.

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
BrumaDev
Newbie
Posts: 11
Joined: Wed Apr 28, 2021 9:08 pm
Projects: Occult:Rewrite
itch: brumadev
Location: Brazil
Contact:

How to prevent mouse click skipping during dialogue.

#1 Post by BrumaDev »

I've looked around the forum, the cookbook and the documentation and while I found a couple of answers, they're all over 10 years old, and since then renpy has changed so much that it looks like the code in said links don't apply anymore.

Basically the question is this: How can I prevent the player from skipping the dialogue by mouseclick when a character is still speaking?
The latest link I found is this one: viewtopic.php?t=23463. There, user Elmiwisa presents a solution that looks like it works, by adding the blocks

Code: Select all

    if _preferences.text_cps==0:
        on "show" action dismiss_control.allow_dismiss
    else:
        on "show" action dismiss_control.block_dismiss
        timer dismiss_control.calculate_time(what,_preferences.text_cps) repeat False action dismiss_control.allow_dismiss
    on "hide" action dismiss_control.allow_dismiss
and

Code: Select all

class DismissControl:
        def __init__(self):
            self.dismissable=True
            config.say_allow_dismiss=self.dismiss_check
            return
        def allow_dismiss(self):
            self.dismissable=True
            return
        def block_dismiss(self):
            self.dismissable=False
            return
        def dismiss_check(self):
            return self.dismissable
        def calculate_time(self,what,cps):
            if cps==0:
                return 0.01
            else:
                return (float)(len(what))/(float)(cps)+0.01
    dismiss_control=DismissControl()
to the screens.rpy file.
However, when I try to replicate the result, I get several statement and end of line expected errors for the first part. I tried including it on an init python block, but then other different kinds of erros pop up. Can someone with more knowledge about this review these blocks and find out what's wrong? Pehaps some kind of syntax changed since 2013 that I'm not aware.
Do you like VNs with more gameplay?
Are you interested in the paranormal?
Check out my new project Occult:Rewrite
Image

Post Reply

Who is online

Users browsing this forum: No registered users