[Bug] Remapping certain keys doesn't have the correct functionality

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
SypherZent
Veteran
Posts: 362
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Location: Puerto Rico
Contact:

[Bug] Remapping certain keys doesn't have the correct functionality

#1 Post by SypherZent »

The documentation for Ren'Py keymap says:

Code: Select all

 # These keys control skipping.
    skip = [ 'K_LCTRL', 'K_RCTRL' ],
    stop_skipping = [ ],
    toggle_skip = [ 'K_TAB' ],

Problem / Bug:
If I add the following:

Code: Select all

init python:
    config.pad_bindings["pad_righttrigger_pos"] = ['skip']
When I press RT on controller, the Skip behaves like a Toggle, not like K_LCTRL.
In other words, it behaves like a 'toggle_skip', not like 'skip' which is what would be expected.

It seems like there is code beyond what we can control with config.keymap / config.pad_bindings where the engine internally has hardcoded functionality for LCTRL that cannot be remapped to other keys, and treats the other keys like TAB.

I hope this can be fixed in an upcoming patch to facilitate proper and professional controller support.

Thank you in advance for your attention.



Side note: This bug also occurs when removing 'd' and 'D' keys from the keymap and setting them to anything the right arrow key is supposed to do (focus_right, input_right, etc.). The 'd' key doesn't behave like the right_arrow in the Settings menu and possibly other menus.

strayerror
Regular
Posts: 159
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: [Bug] Remapping certain keys doesn't have the correct functionality

#2 Post by strayerror »

I think ctrl works because Ren'Py listens for a keyup event on the key assigned to skip, but pad_righttrigger, being an analogue input, doesn't issue a keyup. The keymap docs suggest it might be possible to achieve the behaviour you describe another way, as there exist events for analogue controls returning to zero/null:
Analog axis events have the form "pad_*axis*_pos", "pad_*axis*_neg", or "pad_*axis*_zero".
So perhaps this could accomplish what you're aiming for?

Code: Select all

init python:
    config.pad_bindings["pad_righttrigger_pos"] = ['skip']
    config.pad_bindings["pad_righttrigger_zero"] = ['stop_skipping']
Hope it works out! o/

User avatar
SypherZent
Veteran
Posts: 362
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Location: Puerto Rico
Contact:

Re: [Bug] Remapping certain keys doesn't have the correct functionality

#3 Post by SypherZent »

Hi, sorry for late reply. Thank you! I'll give this a try next week once I'm working again. ^^

Edit: This works perfectly, thank you again for the suggestion, strayerror!

Post Reply

Who is online

Users browsing this forum: No registered users