Page 1 of 1

return button doesn't return to the screen I want [solved]

Posted: Fri Jul 14, 2017 6:46 am
by Meg'
Hi!

After a lot of thoughts and failed attempts, I'm asking for help. My return button won't return to the CG_Galery screen but instead get me back to the game directly. Here is my code:

Code: Select all

screen CG_Galery:
    
    tag menu
    
    add "gui/bonus.jpg"
    
    hbox:
        xpos 246 
        ypos 610 

        if not persistent.illu1Purchased:
            $cond = persistent.EnergyAvailable - 20 < 0
            imagebutton:
                yoffset -40
                idle "gui/change_apparence_locked.png"
                if not cond:
                    action [ShowMenu("purchase_illu1")]

        else:

            imagebutton auto "gui/change_apparence_%s.png":
                action [Show("illu1")]
    
    add "gui/forme1.png" xpos 1003 ypos 0.73 at main_eff8
    imagebutton auto "gui/config_%s.png" xalign 0.95 ypos 0.85 action Return() at main_eff7

screen purchase_illu1:
    tag menu
    add "gui/debloquer_illu.png"
    add "gui/debloquer_custom.png"
    use yesno_proxy([Function(PurchaseItem,"illu1Purchased",20),Show("illu1")],ShowMenu("CG_Galery"))
    
screen illu1:
    
    add DynamicDisplayable(draw_illu1)
    
    add "gui/forme1.png" xpos 1003 ypos 0.73 at main_eff8
    imagebutton auto "gui/config_%s.png" xalign 0.95 ypos 0.85 action Return() at main_eff7
I tried to change the Return() into Return("CG_Galery"), Show("CG_Galery") and ShowMenu("CG_Galery"), it doesn't work. The only thing that works is the Return() but it gets me back to the game instead of returning to the CG_Galery screen.

I don't understand why. Can someone help?

Thanks,

Meg'

Re: return button doesn't return to the screen I want

Posted: Fri Jul 14, 2017 7:39 am
by Milkymalk
You only "show" illu1. Return only undoes the last "call" statement, to put it simply. Just "hide" the screen instead and you should be where you started.

Re: return button doesn't return to the screen I want

Posted: Fri Jul 14, 2017 11:40 am
by Meg'
That worked like a charm. Thank you so much! :D