Page 1 of 1

Character Callback not activating

Posted: Wed Oct 06, 2021 9:44 pm
by amaturemanga
Hi there im trying to use a Character callback so that everytime a character speaks the the sprite zooms in a little. I've got the setup with the transforms and the callback in the character definition but nothing happens when the character speaks no zoom. Not getting any errors its as if i never coded a callback here is my basic setup:

Transforms.rpy

Code: Select all

transform close:
    zoom 1.2

transform normal:
    zoom 1.0
Script.rpy

Code: Select all

init python:
    def my_zoom1(event, interact=True, **kwargs):
        if not interact:
            return
        if event == "begin":
            if renpy.showing("m"):
                renpy.show("m", at_list=[close])
        elif event == "end":
            if renpy.showing("m"):
                renpy.show("m", at_list=[normal])

    def my_zoom2(event, interact=True, **kwargs):
        if not interact:
            return
        if event == "begin":
            if renpy.showing("r"):
                renpy.show("r", at_list=[close])
        elif event == "end":
            if renpy.showing("r"):
                renpy.show("r", at_list=[normal])

    def my_zoom3(event, interact=True, **kwargs):
        if not interact:
            return
        if event == "begin":
            if renpy.showing("ma"):
                renpy.show("ma", at_list=[close])
        elif event == "end":
            if renpy.showing("ma"):
                renpy.show("ma", at_list=[normal])

define m = Character('Mother', ctc="ctc_blink", ctc_position="nestled", what_prefix='"', what_suffix='"', callback=my_zoom1)
define r = Character('Robert', ctc="ctc_blink", ctc_position="nestled", what_prefix='"', what_suffix='"', callback=my_zoom2)
define ma = Character('Maya', ctc="ctc_blink", ctc_position="nestled", what_prefix='"', what_suffix='"', callback=my_zoom3)

    show Maya1 with dissolve

    m "That's all you're getting. You should have thought twice before eating so quickly!"
                

Re: Character Callback not activating

Posted: Thu Oct 07, 2021 7:17 am
by jeffster
renpy.showing probably doesn't become True, at least in your example.

You are showing Maya1, it has no tag "m" (or "ma" or any other except "Maya1").

https://www.renpy.org/doc/html/displayi ... py.showing

Re: Character Callback not activating

Posted: Thu Oct 07, 2021 7:31 am
by jeffster
PS. To debug such things you can add print statements, like this:

Code: Select all

    def my_zoom1(event, interact=True, **kwargs):
        print("callback")
        if not interact:
            return
        print("interact")
        if event == "begin":
            print("begin")
            if renpy.showing("player"):
                renpy.show("player", at_list=[close])
                print("showing")
        elif event == "end":
            print("end")
            if renpy.showing("player"):
                renpy.show("player", at_list=[normal])
                print("showing")
The you open the console (shift-o) and see which messages were printed.