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

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
RoseMaster3000
Newbie
Posts: 1
Joined: Wed Feb 21, 2018 12:55 am
Contact:

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

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

User avatar
Morhighan
Miko-Class Veteran
Posts: 975
Joined: Sun Jun 27, 2010 12:54 pm
Completed: AIdol, When Our Journey Ends, Forgotten Not Lost
Organization: MysteryCorgi
Tumblr: MysteryCorgi
Deviantart: MysteryCorgi
Soundcloud: MysteryCorgi
itch: MysteryCorgi
Location: USA
Contact:

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

#2 Post 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:

irredeemable
Regular
Posts: 78
Joined: Thu Feb 08, 2018 7:57 am
Contact:

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

#3 Post by irredeemable »

Lower case 'd' is the binding for 'director', not 'developer'. Add config.keymap['director'].remove('d') somewhere and you should be fine.

henvu50
Veteran
Posts: 337
Joined: Wed Aug 22, 2018 1:22 am
Contact:

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

#4 Post 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'] 

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], myself600