Page 1 of 1

Problem with screen action (Quit + ESC)

Posted: Sat May 28, 2022 2:15 pm
by Gigan
Hello everyone, I have a silly noob question.
I'm trying to make an inventory screen that players will be able to access whenever they want. Screen will be full of little icons that will show an image or some flavor text when clicked on. So I figured an imagemap would be the easier way to do it. Also I'm fucking dumb as a brick so I'm looking for the easiest way to get it to work.

Just started it, so don't kill me for that pathetic code :

Code: Select all

screen inventory():
    tag menu
    zorder 100
    imagemap:
        ground "inventory/bg_inventory.png"
        imagebutton:
            focus_mask True
            xpos 10
            ypos 400
            idle "imagebutton_retour.png" ###'Go back to game' button
            action Hide("inventory")
I also added this :

Code: Select all

screen quick_menu():
    zorder 100
    if quick_menu:
        hbox:
            style_prefix "quick"
            xalign 0.5
            yalign 1.0
            textbutton _("Inventory") action ShowMenu('inventory')
...in the quick_menu screen.

Thing work as intended. I can access the screen whenever I want with the quick menu, and I can quit it by using my button.
...except quitting this inventory screen makes all the other buttons, textbox, quick menu textbuttons,... from the previous screen disappear, only leaving the background.
I can get them to reappear by pushing the ESC key.


Is there a way to disable that ESC key thing ? I'd like it to be used like a simple pause screen, with the player getting back to where he left the game before clicking the inventory textbutton.

Since english is not my main language, here is the problem illustrated :
Image

Accessing the inventory with the textbutton :
Image

Using the "Back" button leaves to this :
Image

Buttons and textbox appear again after pressing ESC :
Image

Thx for your help and your time. ( >O_O)>

Re: Problem with screen action (Quit + ESC)

Posted: Sat May 28, 2022 3:48 pm
by Ocelot
ShowMenu switches you to the menu mode (the same thing used for saving, loading, etc). You want Return action there if you wish to keep menu mode.

Also you do not have a proper imagemap. Imagemaps have hotspots, not imagebuttons (it is surprising that it even allows imagebutton as a child). What you probably want is a background image and imagebuttons.

Re: Problem with screen action (Quit + ESC)

Posted: Sat May 28, 2022 4:11 pm
by Gigan
Thx a lot ! Changed the "Showmenu" for a "Show" and it works perfectly !
Ocelot wrote:
Sat May 28, 2022 3:48 pm
it is surprising that it even allows imagebutton as a child
I have 0 idea why but it works so I'm not complaining. I'll see if I can change the whole thing tho. Thanks again ! :)