Skip to content

Gamepads: Add generic conditions to check buttons by numerical ID #1990

@Edytor-Studio

Description

@Edytor-Studio

Changes

Summary
This PR introduces three new conditions to the Gamepad extension that allow developers to check button states using their numerical ID instead of a predefined list.

How to use the new features

Why is this needed?
Currently, the extension uses a fixed list of button names (A, B, X, Y, etc.). However, many non-standard controllers, arcade sticks, or specialized gamepads have extra buttons (IDs 17, 18, 19+) that are not accessible via the current dropdown menu.

By adding "by ID" conditions, developers can now support any button reported by the browser's Gamepad API without needing to modify the extension's source code every time.

Changes:
Added Button pressed (by ID): Returns true if the button with the specified ID is held.

Added Button released (by ID): Returns true if the button was just released.

Added Button just pressed (by ID): Returns true only in the frame the button was pressed.

The PlayerId parameter now uses a clear label: Gamepad identifier: 1, 2, 3, or 4.

How to test:
Connect any gamepad.

Use the new condition "Button ID 0 of gamepad 1 is pressed" (Button 0 is usually 'A' or 'Cross').

Observe that it triggers correctly.

Test with higher IDs (e.g., 17 or 18) for specialized hardware.

Checklist

  • I've followed all of the best practices.
  • I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
  • I am aware that the extension may be updated by anyone, and do not need my explicit consent to do so.

Example file

Gamepads example.zip

Extension file

Gamepads.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔄 Extension updateAn update for an existing extension🔍 Reviewed extensionAn extension that is to be reviewed in great detail before merging.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions