"on hide" event and say screen

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
philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

"on hide" event and say screen

#1 Post by philat »

Code: Select all

screen say(who, what):
    style_prefix "say"

    window:
        id "window"
        at say_transform # default say screen other than adding transform to window

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"

    ## If there's a side image, display it above the text. Do not display on the
    ## phone variant - there's no room.
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0

screen test1():
    add Solid("#000", xysize=(200,200)):
        at say_transform
        yalign 0.5
        
transform say_transform:
    on show:
        yoffset 200
        linear 0.5 yoffset 0
    on hide:
        linear 0.5 yoffset 200


label start:
    scene bg room
    show screen test1()
    e "You've created a new Ren'Py game."
    window hide
    hide screen test1
    pause
    e "Once you add a story, pictures, and music, you can release it to the world!"
With above scripting (vanilla project in 7.4.11):
- the on show event works normally for both the say screen and test1 screen
- on hide doesn't seem to fire at all when say screen is hidden with window hide
- on hide works normally for test1 screen
- (curiously, from other forum posts, it appears to work normally for some - perhaps a different version? I didn't test that far)

I assume this is because the say screen is shown/hidden with different mechanisms than custom screens, but this seems like a bug. I do note that hide "isn't triggered when the transform is eliminated via the scene statement or exiting the context it exists in, such as when exiting the game menu." (https://www.renpy.org/doc/html/atl.html#external-events ) but does that apply here? Or is there another event that's intended to be used with the say screen?

Post Reply

Who is online

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