Skip to main content
Version: Stable

Input

These commands simulate input devices like keyboards and gamepads. For security, Core blocks input commands from remote sources. Currently, Zap Links are the only remote source. Scripts sent through the Zaparoo App are not remote.

The platform sets a default input mode, which you can configure with [zapscript.input]. On desktop platforms, single-character keys are blocked by default; only key combos and special keys like {f1} work. Embedded platforms like MiSTer allow all keys.

input.keyboard

Simulates keyboard key presses.

Platform Support

Supported on MiSTer, MiSTeX, and Batocera.

Syntax

**input.keyboard:<keys>

Arguments

keys (required) The keys to press. Each parsed key is pressed with a 100ms delay between keys. Special keys are entered using curly braces.

Special keys: {esc}, {backspace}, {tab}, {enter}, {lctrl}, {lshift}, {backslash}, {rshift}, {lalt}, {space}, {caps}, {num}, {scroll}, {f1}-{f12}, {home}, {up}, {pgup}, {left}, {right}, {end}, {down}, {pgdn}, {ins}, {del}, {volup}, {voldn}

Escaping: Use \{ and \} for literal curly braces, \\ for a literal backslash.

Key combos: Use + between keys inside braces, e.g., {shift+esc}.

Advanced Arguments

ArgumentTypeDefaultDescription
whenexpression-Conditional execution (see Expressions)

Examples

Type the @ character:

**input.keyboard:@

Type "qWeRty", press Enter, press Up arrow, then type "aaa":

**input.keyboard:qWeRty{enter}{up}aaa

Press Shift+Escape together:

**input.keyboard:{shift+esc}

Open the MiSTer OSD menu:

**input.keyboard:{f12}
Remote Blocked

This command is blocked when the script comes from a remote source.


input.gamepad

Simulates gamepad button presses.

Platform Support

Supported on MiSTer, MiSTeX, and Batocera. The virtual gamepad can interfere with some emulators on Batocera, so it is disabled by default there. It can be re-enabled in the config file.

This command uses a separate virtual gamepad device, not an existing connected controller, which gives it limited use. It must be mapped manually in game or emulator settings, and it can't pretend to be player 1 if a real controller is already connected as player 1.

Syntax

**input.gamepad:<buttons>

Arguments

buttons (required) The buttons to press in sequence. Supports both single characters and named buttons in curly braces. Each parsed button is pressed with a 100ms delay between buttons.

Button mappings:

InputButton
^, {up}D-pad up
V, {down}D-pad down
<, {left}D-pad left
>, {right}D-pad right
A, aEast button
B, bSouth button
X, xNorth button
Y, yWest button
L, l, {l1}Left bumper
R, r, {r1}Right bumper
{l2}Left trigger
{r2}Right trigger
{start}Start
{select}Select
{menu}Menu/Guide button

Advanced Arguments

ArgumentTypeDefaultDescription
whenexpression-Conditional execution (see Expressions)

Examples

Input the classic Konami code:

**input.gamepad:^^VV<><>BA{start}{select}

Press the Start button:

**input.gamepad:{start}

Press A, A, B, B in sequence:

**input.gamepad:AABB
Remote Blocked

This command is blocked when the script comes from a remote source.


input.coinp1 / input.coinp2

Inserts coins for player 1 or player 2 in arcade games.

Platform Support

Supported on MiSTer, MiSTeX, and Batocera.

Syntax

**input.coinp1:<amount>
**input.coinp2:<amount>

Arguments

amount (optional, default: 1) The number of coins to insert.

Omit the amount to insert one coin.

Advanced Arguments

ArgumentTypeDefaultDescription
whenexpression-Conditional execution (see Expressions)

Examples

Insert 1 coin for player 1:

**input.coinp1:1

Insert 3 coins for player 2:

**input.coinp2:3

Insert 2 coins for each player:

**input.coinp1:2||**input.coinp2:2
info

These commands press the 5 key (player 1) or 6 key (player 2), which are the standard coin insert keys for MiSTer arcade cores and MAME. If it doesn't work, try mapping the coin insert keys manually.