"slow_done" callback not firing for lipflap

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
mcoirad
Newbie
Posts: 5
Joined: Thu Apr 04, 2019 9:12 pm
Github: mcoirad
Contact:

"slow_done" callback not firing for lipflap

#1 Post by mcoirad »

My idea here is to have a character that's talking up until the text of their say statement finishes scrolling. I then want the character to switch back to their non-talking image.

I have a minimal example that reproduces the issue I'm having. The assumptions here are two images in the 'image' folder: "man.png" and "man talking.png", as well as

Code: Select all

default preferences.text_cps = 25
in the options.rpy

Code: Select all

init python:
    def show_guy(event, interact=True, **kwargs):


        if event == "slow_done":
            renpy.show("man")
        elif event == "begin":
            renpy.show("man talking")

label start:
    define guy = Character('Guy', image = "man", callback = show_guy)

    guy "I should be talking right up until the end of this sentence."

    guy "Now, I should be talking again, but when this text finishes my mouth will close."
    return
The result is we only ever see the "man talking", and never "man". When the "slow" text finishes, the character image remains the same.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: "slow_done" callback not firing for lipflap

#2 Post by trooper6 »

You could use the config.speaking_attribute to do this more easily.
Check out this post of mine: viewtopic.php?p=483546#p483546
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

mcoirad
Newbie
Posts: 5
Joined: Thu Apr 04, 2019 9:12 pm
Github: mcoirad
Contact:

Re: "slow_done" callback not firing for lipflap

#3 Post by mcoirad »

Your code does do the same thing as my callback (more concisely, I might add), but it still doesn't solve the problem. I want the talking animation to end when the slow text is finished being revealed, not when it moves onto the say statement. (like in the ace attorney series.)

The pulse example you linked runs through the transformation once as the text reveals, then finishes independent of how much text has been displayed. But maybe I implemented it wrong?

mcoirad
Newbie
Posts: 5
Joined: Thu Apr 04, 2019 9:12 pm
Github: mcoirad
Contact:

Re: "slow_done" callback not firing for lipflap

#4 Post by mcoirad »

After further experimentation I've found that the issue is not "slow_done" not firing, but something related to the displayables.
For example in the following code, the sound starts and stops fine but the images still aren't working as they should.

Code: Select all

init python:
    def show_guy(event, interact=True, **kwargs):

        if event == "slow_done":
            renpy.hide("man talking")
            renpy.sound.stop()
        elif event == "begin":
            renpy.show("man talking")
            renpy.sound.play("beeps.wav")

label start:
    define guy = Character('Guy', image = "man", callback = show_guy)

    guy "I should be talking right up until the end of this sentence."

    guy "Now, I should be talking again, but when this text finishes my mouth should close."

    guy "Unfortunately, what is actually happening is that the 'talking' image is being shown the entire time."
    return
In this case the 'renpy.hide' does not seem to be hiding the talking image.

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

Re: "slow_done" callback not firing for lipflap

#5 Post by philat »

Code: Select all

    def show_guy(event, interact=True, **kwargs):
        if event == "slow_done" or event=="end":
            renpy.show("man")
            renpy.restart_interaction() # this
        elif event == "begin":
            renpy.show("man talking")

User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: "slow_done" callback not firing for lipflap

#6 Post by XxrenxX »

I'm not familiar with this code as I don't plan to in my own project but asking cause curious in case I might want to.

The idea is that the "talking" image shows until the text finishes for said line. Similar to how some games have a mouth flap until the voice file is finished playing. But would the player being able to change the text speed effect this? Cause if someone wants the text to appear faster or slower, the idea is to have the flap follow. But how would it in the code go about doing that?

mcoirad
Newbie
Posts: 5
Joined: Thu Apr 04, 2019 9:12 pm
Github: mcoirad
Contact:

Re: "slow_done" callback not firing for lipflap

#7 Post by mcoirad »

Well that solved the issue... I guess I need to better understand how interactions work. I already spent a couple nights on this as it is. Thanks!

As for changing the text speed, this should work no matter what the text speed is set to.

Post Reply

Who is online

Users browsing this forum: Ocelot