I have a little problem about the blink lip lap then I combining this with an automatic pause code after every commas (found here : viewtopic.php?t=50030)
The characters moves their mouth, even on commas like : "...", "!", "." etc.
I can correct this problem manually (with a change between a moving mouth and a stiff one sprite with condition switch and extend), but is there a way to do this automatically ?
Automatic pause :
Code: Select all
init python:
def alter_say_strings( str_to_test ):
str_map = {
". " : ".{cps=2} {/cps}",
"! " : "!{cps=2} {/cps}",
"? " : "?{cps=2} {/cps}",
"... " : "{cps=4}... {/cps}",
", " : ",{cps=2} {/cps}",
": " : ":{cps=2} {/cps}",
}
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
Code: Select all
init python:
# This is set to the name of the character that is speaking, or
# None if no character is currently speaking.
speaking = None
# If True, then all characters will be mute, i. e. their mouths
# will be closed.
mute = False
# This is called by Ren'Py with the arguments passed to a say
# statement.
#
# We use this callback to remember the value of the "mute"
# argument (if any) that was passed to the last say statement.
def say_arg_cb(who, *args, **kwargs):
global mute
# NB: Seems like the Ren'Py language uses unicode for keyword
# argument names...
mute = kwargs.get(u"mute")
return args, kwargs
# This makes Ren'Py actually call our callback.
config.say_arguments_callback = say_arg_cb
# This returns speaking if the character is speaking, and done if the
# character is not.
def while_speaking(name, speak_d, done_d, st, at):
if speaking == name:
return speak_d, .1
else:
return done_d, None
# Curried form of the above.
curried_while_speaking = renpy.curry(while_speaking)
# Displays speaking when the named character is speaking, and done otherwise.
def WhileSpeaking(name, speaking_d, done_d=Null()):
return DynamicDisplayable(curried_while_speaking(name, speaking_d, done_d))
# This callback maintains the speaking variable.
def speaker_callback(name, event, **kwargs):
global speaking
if event == "show":
if mute:
# If the say statement has a "truthy" mute attribute (e. g. mute=1),
# then we do not make the character's mouth move: We keep it closed.
speaking = None
else:
speaking = name
elif event == "slow_done":
speaking = None
elif event == "end":
speaking = None
# Curried form of the same.
speaker = renpy.curry(speaker_callback)