Ren'Py How to assign a key to call or show a map?

9thCrux

--Waifu maker--
Game Developer
Oct 22, 2017
844
3,232
I'm not sure if I'm even making the right question... sorry about my noobness.

What I'm trying to do is to bind or assign a key to show a map screen or an information screen.

So is like you press M and the map screen shows up.
Or you press I and the inventory screen shows up.
Or maybe you press T and the stats screen shows up...

How do you assign keys to call or show screens? Do you use zorder to keep them on top?

Any help would be appreciated.

Found some info here...







I guess is time to read. o_O
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,978
16,233
The easiest way is to use the screen statement :

Python:
init python:
    # 'I' is already used by Ren'Py, so CTRL + I.
    config.keymap['inventory'] = "ctrl_K_i"
    # To keep the same logic.
    config.keymap['map'] = "ctrl_K_m"

screen keymap:
    # 'inventory' and 'map' refer to the entry defined above.
    key "inventory" action Show( "inventory" )
    key "map" action Show( "map" )

screen inventory:
    # Do not let the player click outside of the screen.
    modal True
    [...]
    textbutton "Close" action Hide( "inventory" )

screen map:
    # Do not let the player click outside of the screen.
    modal True
    [...]
    textbutton "Close" action Hide( "map" )

label start:
    # The screen will be shown until you hide it or totally reset the display.
    show screen keymap
    [...]
By order of appearance , and , the screen action, the screen property, and finally the screen action.

Alternatively to show screen keymap, you can use to display the screen.
 

9thCrux

--Waifu maker--
Game Developer
Oct 22, 2017
844
3,232
The easiest way is to use the screen statement :

Python:
init python:
    # 'I' is already used by Ren'Py, so CTRL + I.
    config.keymap['inventory'] = "ctrl_K_i"
    # To keep the same logic.
    config.keymap['map'] = "ctrl_K_m"

screen keymap:
    # 'inventory' and 'map' refer to the entry defined above.
    key "inventory" action Show( "inventory" )
    key "map" action Show( "map" )

screen inventory:
    # Do not let the player click outside of the screen.
    modal True
    [...]
    textbutton "Close" action Hide( "inventory" )

screen map:
    # Do not let the player click outside of the screen.
    modal True
    [...]
    textbutton "Close" action Hide( "map" )

label start:
    # The screen will be shown until you hide it or totally reset the display.
    show screen keymap
    [...]
By order of appearance , and , the screen action, the screen property, and finally the screen action.

Alternatively to show screen keymap, you can use to display the screen.
Great, thanks.