Keymap help please

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
User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Keymap help please

#1 Post by thirstyoctopus » Tue Apr 30, 2019 11:13 am

Hi guys

This is just a quick one really. I have added a little hud to my game which I want hidden, but can only be activated by implementing a specific key combination. This is a beta testing feature.

I'd like the combination to be Alt+Shift then the backtick key (`)

However I do not know how to specify the ` key in Ren'py keymaps.

Here's what I have:

Code: Select all

screen hud_toggle:
    if renpy.get_screen("test_hud"):
        key "alt_shift_K_xxxx" action Hide("test_hud")
    else:
        key "alt_shift_K_xxxx" action Show("test_hud")
where the xxxx is whatever the backtick key is called. I did some searching and suggestions included grave, tilde, quoteleft and asciitilde but none of these work, they just throw an error saying:

Code: Select all

AttributeError: 'module' object has no attribute 'K_grave'
or whatever one I use.

Anyone know how to reference this key? It's the one on the top left of a Windows keyboard (with the broken pipe symbol alongside it)

rames44
Veteran
Posts: 232
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: Keymap help please

#2 Post by rames44 » Tue Apr 30, 2019 11:52 am

I think you can find a list of all the “special” key codes in this file:
https://github.com/renpy/pygame_sdl2/bl ... e_list.pxi
(At least, that’s what it looks like. Ren’py uses pygame under the hood, and that repo has PyTom’s partial port of pygame to sdl2 in it.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]