Page 1 of 1

[SOLVED: Intended Functionality]Potential Bug? Renpy 8.0.2 - Keysym doesn't work with gamepad, but Key does.

Posted: Wed Oct 19, 2022 5:37 pm
by henvu50
Potential Bug? Renpy 8.0.2 - Keysym doesn't work with gamepad, but Key does.

Documentation says it should work: "In Ren'Py keysyms are strings representing mouse buttons, joystick buttons, or keyboard keys." - https://www.renpy.org/doc/html/keymap.html

How to reproduce. Paste this code over the Quick_Menu section of a new Renpy project.

Code: Select all

screen test4():
    text "test4"
screen quick_menu():
    ## Ensure this appears on top of other screens.
    zorder 100
    key 'pad_b_press': #REF803
        action ToggleScreen("test4") #REF803
    if quick_menu:
        hbox:
            style_prefix "quick"
            xalign 0.5
            yalign 1.0
            textbutton "FFFFFFF":
                action ToggleScreen("test4")
                keysym ['pad_b_press', 'K_l']
L key will toggle the screen, but your gamepad button B or PS(O) won't work; if you comment out the key part #REF803

Key works with gamepad, but Keysym does not, is this intended?

Re: Potential Bug? Renpy 8.0.2 - Keysym doesn't work with gamepad, but Key does.

Posted: Wed Oct 19, 2022 6:20 pm
by Ocelot
pad_b_press is not a keysym. It is a gamepad event.
From https://www.renpy.org/doc/html/keymap.html:
Gamepad bindings work a little differently. Gamepad bindings work by mapping a gamepad event to one or more Ren'Py event names.
key works, because it is made to do so. https://www.renpy.org/doc/html/screens.html#key
This creates a keybinding that runs an action when a key is pressed, or one of the keys in a given list. Key is used in a loose sense here, as it also allows joystick and mouse events.

Re: Potential Bug? Renpy 8.0.2 - Keysym doesn't work with gamepad, but Key does.

Posted: Wed Oct 19, 2022 6:37 pm
by henvu50
Thank you for confirmation. I'll adjust my code accordingly.