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

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
henvu50
Veteran
Posts: 322
Joined: Wed Aug 22, 2018 1:22 am
Contact:

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

#1 Post by henvu50 » Wed Oct 19, 2022 5:37 pm

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?
Last edited by henvu50 on Wed Oct 19, 2022 6:37 pm, edited 1 time in total.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

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

#2 Post by Ocelot » Wed Oct 19, 2022 6:20 pm

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.
< < insert Rick Cook quote here > >

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

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

#3 Post by henvu50 » Wed Oct 19, 2022 6:37 pm

Thank you for confirmation. I'll adjust my code accordingly.

Post Reply

Who is online

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