[Solved] Passing a variable to bubble screen on a specific dialogue line

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

[Solved] Passing a variable to bubble screen on a specific dialogue line

#1 Post by kaleidoscopic_kelvin »

I have one dialog line where I want to implement a shake effect

Code: Select all

hyd_s "Everything ready?" (shake_toggle = True)
The character is defined as a bubble type

Code: Select all

define hyd_s = Character(
    None
    , image="hyd"
    , kind=bubble
    , what_color="#80b847"
    , what_font = gui.hyd_font
    , what_bold = True
    , what_outlines = [ (absolute(0), "#000", absolute(2), absolute(2)) ]
    , window_xpos = 0.5
    , window_xanchor = 0.5
    , window_ypos = 0.66
    , window_yanchor = 0.5
    , what_style = "normal_voice"
    )
And within the bubble code, I have

Code: Select all

window:
        id "window"
        
        
        if shake_toggle:
            at bubble_shake()
        else:
            at bubble_appear()
But when I run it, shake_toggle doesn't change.

So how do I update the shake_toggle variable?

Thanks in advance!
Last edited by kaleidoscopic_kelvin on Sun Feb 04, 2024 8:34 am, edited 1 time in total.

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

Re: Passing a variable to bubble screen on a specific dialogue line

#2 Post by m_from_space »

kaleidoscopic_kelvin wrote: Thu Feb 01, 2024 5:32 am So how do I update the shake_toggle variable?
I didn't realize you have this other thread. So you cannot pass arguments or keyword arguments to the say or bubble screen as far as I know (like you can with the choice screen for example). At least it's not documented. Renpy is calling those screens only with "who" and "what" as arguments, not passing any other args or keyword arguments along. Even if you try to change the argument list of the screens, nothing will happen. Maybe it's a bug, maybe a feature.

A workaround is using global variables and change them via the say_arguments_callback function.

I answered you here: viewtopic.php?t=67886

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

Re: Passing a variable to bubble screen on a specific dialogue line

#3 Post by kaleidoscopic_kelvin »

Again, thanks a lot!!!

Post Reply

Who is online

Users browsing this forum: LuckyT, Ocelot