Character Callback not activating

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
User avatar
amaturemanga
Regular
Posts: 94
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

Character Callback not activating

#1 Post by amaturemanga » Wed Oct 06, 2021 9:44 pm

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!"
                

jeffster
Regular
Posts: 123
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Character Callback not activating

#2 Post by jeffster » Thu Oct 07, 2021 7:17 am

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

jeffster
Regular
Posts: 123
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Character Callback not activating

#3 Post by jeffster » Thu Oct 07, 2021 7:31 am

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.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]