On hide transform not working with buttons.

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
missiya4
Newbie
Posts: 6
Joined: Fri Oct 22, 2021 11:18 am
Contact:

On hide transform not working with buttons.

#1 Post by missiya4 » Fri Jun 17, 2022 11:46 am

Hi all. Today I encountered a problem that "on hide" transform stops working for screen menu elements that have at least one button or textbutton in them.
This happens when I need to exit the menu with the right mouse button or with Return().
Has anyone encountered this problem before?

Here's an example:

Code: Select all

transform show_hide_moves(diff_x=100):
    on show:
        xoffset diff_x
        linear .3 xoffset 0
    on hide:
        xoffset 0
        linear .2 xoffset -diff_x

screen test_screen():
    tag menu
    
    frame at show_hide_moves:
        null        # There may be text, images etc. Everything works well.
        textbutton "1111"  # But with any buttons/textbuttons/imagebuttons "on hide" stops working.


# Another screen...
# ...
    textbutton "Open Test Menu" action [ShowMenu("test_screen")]


User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: On hide transform not working with buttons.

#2 Post by Alex » Fri Jun 17, 2022 12:27 pm

missiya4 wrote:
Fri Jun 17, 2022 11:46 am
...
Try it like - viewtopic.php?f=8&t=64720#p552761

missiya4
Newbie
Posts: 6
Joined: Fri Oct 22, 2021 11:18 am
Contact:

Re: On hide transform not working with buttons.

#3 Post by missiya4 » Fri Jun 17, 2022 2:15 pm

Alex wrote:
Fri Jun 17, 2022 12:27 pm
Try it like - viewtopic.php?f=8&t=64720#p552761
I have no problem with the menu opening animation. There is nothing wrong with it.
I only have a problem with closing the menu (right-click or Return().

Tried your method, but it does not work fully.
At best, it leaves behind a completely opaque copy, which takes much longer to disappear than what moves in front of that copy.
Because of this, only a small wave effect is created, but the desired result is almost absent. The participation of alpha in the animation does not help either. :?

User avatar
RicharDann
Veteran
Posts: 284
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: On hide transform not working with buttons.

#4 Post by RicharDann » Fri Jun 17, 2022 3:26 pm

Your first post's example seems to be working for me on Ren'Py 7.4.2. Are you trying this on a newer version?
The most important step is always the next one.

missiya4
Newbie
Posts: 6
Joined: Fri Oct 22, 2021 11:18 am
Contact:

Re: On hide transform not working with buttons.

#5 Post by missiya4 » Sat Jun 18, 2022 5:28 am

RicharDann wrote:
Fri Jun 17, 2022 3:26 pm
Are you trying this on a newer version?
I have not yet been able to update Ren'Py for the sake of testing.
I just have a lot of manual engine fixes. :?
Can you try this example to be sure?

Code: Select all

transform show_hide_moves(diff_x=100):
    on show:
        xoffset diff_x
        linear .3 xoffset 0
    on hide:
        xoffset 0
        linear .2 xoffset -diff_x

screen test_screen():
    tag menu

    frame xysize(422,222) align(.5,.2) at show_hide_moves:
        null
        text "This frame should go to the left when the right mouse button is clicked.\nThat's OK."

    frame xysize(422,222) align(.5,.7) at show_hide_moves:
        null
        text "This frame will NOT go to the left, but will simply disappear through transparency.\nBut that's wrong."
        textbutton "Textbutton" align (.5,1.0)
        
# Another screen...
# ...
    #textbutton "Open Test Menu" action [ShowMenu("test_screen")]
        
Normally, when you right click, both frames should go to the left before disappearing completely.
But if it happens the way it's written on them, it's wrong.
Thanks.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]