Ceci est une ancienne révision du document !
Table des matières
Language / Langue : FR | EN
Keyboard, mouse and gamepad shortcuts
On Web, Desktop and in HTML exports, authors can bind keys, clicks or gamepad controls to scenario interactions. Buttons remain usable. Without author-defined bindings, a gamepad adds no automatic navigation.
On an action, choice or event
actions: - verb: fire target: all button: Fire do: ammo - 1 shortcut: keys: [Space, f] mouse: left gamepad: [A, RT] show-shortcut: true
Declare ammo in vars: for this example. shortcut: [Space, f] is enough for keyboard-only bindings. show-shortcut adds a hint to the button; it is hidden by default. An event with a shortcut needs an explicit id. Its conditions, state and usage limits still apply.
Commands and referenced events
shortcuts: - keys: [i] gamepad: B command: inventory rooms: - id: question shortcuts: - keys: [Ctrl+Enter] event: question_hint
These lists can be declared at the root or in a room. Each entry targets either a command, with optional arguments, or an existing event. They add no buttons. Available commands depend on the support being used.
Controls
| Input | Examples |
|---|---|
| Keys | z, ArrowUp, Space, Enter, Escape, F1 to F24 |
| Combinations | Ctrl+1, Shift+z, Alt+Enter, Meta+Enter |
| Physical codes | KeyW, Digit1, Numpad1 |
| Click on the game background | left, right, middle |
| Gamepad buttons | A, B, X, Y, LB, RB, LT, RT, LS, RS, Back, Start, Home |
| D-pad and sticks | DPadUp, LeftStickLeft, RightStickDown and the other directions |
| Raw controls | Button0 to Button63, Axis0+ / Axis0- to Axis15+ / Axis15- |
Quote digits in YAML: keys: [“1”]. Letters follow the keyboard layout; physical codes follow the position. Clicks on buttons, links and interactive images keep their usual role; touch does not become a mouse shortcut.
Gamepad names follow the browser's standard mapping: A at the bottom, B on the right, X on the left, Y at the top. Cross/Circle/Square/Triangle and L1/R1/L2/R2/L3/R3 are accepted. Controller labels may differ; raw numbers depend on the hardware.
During play
- One press triggers one action. Holding a key or direction does not repeat turns; return to neutral to act again.
- Shortcuts wait while typing, a dialogue, menu or action is active. Ignored presses are not queued.
- Local bindings take priority over global ones. Within one scope: actions, events, choices, then list commands, in declaration order.
- An unavailable binding reserves its key. Hidden or greyed-out choices do not become accessible through shortcuts.
- Explicit shortcuts take priority over native deck directions or keyboard triggers. The linter reports collisions.
Gamepads need the browser's Gamepad API, generally over HTTPS or localhost. A first press may be needed for detection. Physical device checks remain pending for 4.17.
In the editor
Actions, choices and events have shortcut fields. Command lists are under Globals > Interface and in the room interface settings. Detect a button captures a new gamepad press; release held controls first. Clicking the capture button again cancels it.
Mini Doom provides an example: arrows/ZQSD or D-pad/stick to move, Space/F/left click or A/RT to fire. The game rules are written in the scenario.
