Problem with screen action (Quit + ESC)

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
Gigan
Newbie
Posts: 21
Joined: Mon Jan 10, 2022 7:02 pm
Contact:

Problem with screen action (Quit + ESC)

#1 Post 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)>

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Problem with screen action (Quit + ESC)

#2 Post 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.
< < insert Rick Cook quote here > >

Gigan
Newbie
Posts: 21
Joined: Mon Jan 10, 2022 7:02 pm
Contact:

Re: Problem with screen action (Quit + ESC)

#3 Post 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 ! :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]