Page 1 of 1

I'm trying to remap the "d" key...not sure whats going on

Posted: Wed Feb 21, 2018 1:14 am
by RoseMaster3000
Hey, I wanted to add WASD to the navigation keymaps, I figured it would be easy using this:

Code: Select all

config.keymap["input_left"] = [ 'K_LEFT', 'repeat_K_LEFT',     'a']
config.keymap["input_right"] = [ 'K_RIGHT', 'repeat_K_RIGHT',  'd']
config.keymap["input_up"] = [ 'K_UP', 'repeat_K_UP',           'w']
config.keymap["input_down"] = [ 'K_DOWN', 'repeat_K_DOWN',     's']

config.keymap["viewport_leftarrow"] = [ 'K_LEFT', 'repeat_K_LEFT',       'a']
config.keymap["viewport_rightarrow"] = [ 'K_RIGHT', 'repeat_K_RIGHT',    'd']
config.keymap["viewport_uparrow"] = [ 'K_UP', 'repeat_K_UP',             'w']
config.keymap["viewport_downarrow"] = [ 'K_DOWN', 'repeat_K_DOWN',       's']

config.keymap["focus_left"] = [ 'K_LEFT', 'repeat_K_LEFT'     , 'a']
config.keymap["focus_right"] = [ 'K_RIGHT', 'repeat_K_RIGHT'  , 'd']
config.keymap["focus_up"] = [ 'K_UP', 'repeat_K_UP'           , 'w']
config.keymap["focus_down"] = [ 'K_DOWN', 'repeat_K_DOWN'     , 's']
I remapped the developer key and screenshot keys to avoid any overlap, and W,A,and S all worked perfectly, but for some reason the D key just refuses to work :/ I also tried setting {config.developer = False} but the D key still doesn't work... any ideas? Not really sure what I should doing differently?

Re: I'm trying to remap the "d" key...not sure whats going on

Posted: Wed Feb 21, 2018 6:15 pm
by Morhighan
I would think that setting config.developer = False would solve the issue, but if still persists, then I'm a bit stumped.
I think this probably belongs in the Ren'Py Questions and Announcements section. Hopefully having this thread moved will provide someone with the answer seeing it. I'll still try to help though!

According to the keymap customization page, it says:
...
There are two kinds of keyboard keysyms. The first is a string containing a character that is generated when a key is pressed. This is useful for binding alphabetic keys and numbers.
...

Code: Select all

#Bindings present almost everywhere, unless explicitly
# disabled.
developer = [ 'D' ],
...
Gamepad bindings work a little differently. Gamepad bindings work by mapping a gamepad event to one or more Ren'Py event names. The default set of gamepad bindings is given below:

Re: I'm trying to remap the "d" key...not sure whats going on

Posted: Wed Feb 21, 2018 6:49 pm
by irredeemable
Lower case 'd' is the binding for 'director', not 'developer'. Add config.keymap['director'].remove('d') somewhere and you should be fine.

Re: I'm trying to remap the "d" key...not sure whats going on

Posted: Thu Jul 29, 2021 10:04 am
by henvu50
FYI you only need to override the focus & viewport, not the input.

There's no need to override these:

Code: Select all

            #config.keymap['input_left'] 
            #config.keymap['input_right']
            #config.keymap['input_up'] 
            #config.keymap['input_down']