[Solved] Applying transform on window within say_arguments_callback function

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
kaleidoscopic_kelvin
Newbie
Posts: 7
Joined: Wed Jan 31, 2024 11:26 pm

[Solved] Applying transform on window within say_arguments_callback function

#1 Post by kaleidoscopic_kelvin »

I want to apply a shake effect to the say window. How do I access the window within the callback code?

Code: Select all

def say_arguments_callback(char, shake_toggle = False, *args, **kwargs):
        if shake_toggle:
           #<window transform>
            kwargs["what_color"] = "#000"
Thanks in advance!
Last edited by kaleidoscopic_kelvin on Sun Feb 04, 2024 8:33 am, edited 1 time in total.

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Applying transform on window within say_arguments_callback function

#2 Post by m_from_space »

kaleidoscopic_kelvin wrote: Sat Feb 03, 2024 5:21 am I want to apply a shake effect to the say window. How do I access the window within the callback code?

Code: Select all

def say_arguments_callback(char, shake_toggle = False, *args, **kwargs):
        if shake_toggle:
           #<window transform>
            kwargs["what_color"] = "#000"
Thanks in advance!
If you want a shake effect in the say screen, you have to first implement it. This has nothing to do with a callback.

Code: Select all

default shake_say = False

screen say(who, what):
    style_prefix "say"
    
    window:
        if shake_say:
            at myshake
    ...

kaleidoscopic_kelvin
Newbie
Posts: 7
Joined: Wed Jan 31, 2024 11:26 pm

Re: Applying transform on window within say_arguments_callback function

#3 Post by kaleidoscopic_kelvin »

I used the shake as an example. When I try passing a variable to bubble, it doesn't have any effect, but passing to the say screen works. So I needed to find a more general way to manipulate both bubble and say screens. I was able to manipulate the what properties for both say and bubble dialogue types, so now I need to figure out how to access the window stuff from the function

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Applying transform on window within say_arguments_callback function

#4 Post by m_from_space »

kaleidoscopic_kelvin wrote: Sun Feb 04, 2024 7:05 am I used the shake as an example. When I try passing a variable to bubble, it doesn't have any effect, but passing to the say screen works. So I needed to find a more general way to manipulate both bubble and say screens. I was able to manipulate the what properties for both say and bubble dialogue types, so now I need to figure out how to access the window stuff from the function
I don't think you can pass non-style-related arguments to the say or bubble screen. A transform is not a kind of style.

So given my screen example above, you just have to change the global variable whenever you want to make the say window shake. I hope this is what you were aiming for. Otherwise you would need to explain it in more detail to me.

Code: Select all

init python:
    def say_arguments_callback(who, interact=True, shake=False):
        store.shake_say = shake
        return (), { "interact" : interact }

    config.say_arguments_callback = say_arguments_callback
    
label start:
    e "Hello, I am Eileen." (shake=True)
    return

kaleidoscopic_kelvin
Newbie
Posts: 7
Joined: Wed Jan 31, 2024 11:26 pm

Re: Applying transform on window within say_arguments_callback function

#5 Post by kaleidoscopic_kelvin »

Yes! It's working with the two variables separated like that.

Thanks so much!!!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]