[SOLVED] Bug? Inconsistent event triggering

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
Milkymalk
Miko-Class Veteran
Posts: 652
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

[SOLVED] Bug? Inconsistent event triggering

#1 Post by Milkymalk » Thu Mar 08, 2018 5:25 pm

The following code is supposed to do the following:
- show a screen with two buttons, each button shows a different screen ("infoscreen" and "tradescreen").
- both screens have the same tag, so they should replace each other when shown.
- when appearing, they should slide up from below the display, when disappearing they should slide down.

What actually happens:
- click "Info" button: infoscreen slides up. (okay)
- click "Trade" button: infoscreen slides down, tradescreen slides up with a delay. (okay)
- click "Info" button again: tradescreen slides down, infoscreen slides up with a delay. (okay)
- click "Trade" button again: infoscreen slides down, revealing tradescreen underneath (NOT okay) :!:

This last behavior repeats with every button click until the "close" button on a screen is clicked. It seems that whenever a screen that was shown by replacing another screen is supposed to replace a screen again, no "replace" event is triggered (and no "show" event either).

Also, screens replace themselves if shown again (meaning that the events "replace" and "replaced" are triggered). I'm not sure if this is intentional.

Code: Select all

screen base:
    add Color('#000')
    textbutton "Info":
        pos (1050, 50)
        text_color '#fff'
        action Show('infoscreen')

    textbutton "Trade":
        pos (1050, 80)
        text_color '#fff'
        action Show('tradescreen')

transform screenslide:  
    yanchor 0.0
    on show:
        ypos 1.0
        easeout 0.3 ypos 0.0        
    on hide, replaced:
        ypos 0.0
        easeout 0.3 ypos 1.0
    on replace:
        ypos 1.0
        pause 0.2
        easeout 0.3 ypos 0.0        
        
screen infoscreen:
    tag hubscreen
    fixed:
        at screenslide
        add "images/screens/infoscreen.png" xalign 0 yalign 0
        textbutton "Close":
            pos (800, 150)
            text_color '#000'
            action Hide('infoscreen')
        
screen tradescreen:
    tag hubscreen
    fixed:
        at screenslide
        add "images/screens/tradescreen.png" xalign 0 yalign 0
        textbutton "Close":
            pos (800, 150)
            text_color '#000'
            action Hide('tradescreen')
        

label start:
    call screen base
    return
EDIT:
Easy to observe like this:
- Click one button: The screen slides up (on show)
- Click the same button: The screen slides down (on replaced), same screen slides up delayed (on replace)
- Click the same button again: The screen slides down (on replaced) and reveals the exact same screen underneath (no event) :!:
- Click other button: The screen slides down (on replaced), other screen slides up (on replace)
- Click other button again: The screen slides down (on replaced) and reveals the exact same screen underneath (no event) :!:

EDIT:
Solved by latest update, thank you PyTom!
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Post Reply

Who is online

Users browsing this forum: No registered users