Keyboard and mouse functions
Read supported keyboard and mouse state and write translated output using current Zen identifiers and routing rules.
Overview
The official Zen keyboard table contains get_keyboard and get_modifiers for key state, plus get_mk and set_mk for Mouse & Keyboard configuration values.
Key constants, modifier constants, and configuration indexes must come from the current official table.
Key facts
- Several keyboard and mouse APIs are Zen-only.
- Key and mouse identifiers must come from the current official tables.
- Output routing depends on the connected setup and active protocol.
GPC syntax examples
Examples are intentionally small. Replace identifiers only with values documented for your target.
main {
if (get_keyboard(KEY_A)) {
set_val(XB1_A, 100);
}
}Use the key constants listed in the current official keyboard reference.
Functions, commands, and terms
Names below are catalog entries, not guessed signatures. Open the official sources for current parameter and return-value details.
get_keyboardfunction · Zen onlyChecks whether the selected keyboard key is held.
get_modifiersfunction · Zen onlyChecks whether a selected keyboard modifier is held.
get_mkfunction · Zen onlyGets a Mouse & Keyboard configuration value.
set_mkfunction · Zen onlySets a Mouse & Keyboard configuration value.
Common mistakes
Inventing key codes from another platform.
Treating get_mk as live mouse-axis input.
Assuming these Zen-only functions compile for Plus.
Official GPC sources
Use these first-party references to confirm exact syntax and runtime behavior for your installed firmware and Studio version.
Related GPC references
Use the verified runtime, slot, control-button, VM timing, polar output, Zen LED, and clamp device APIs.
Input and outputController input and output functionsRead current, physical, and prior values; detect transitions; write outputs; and understand when script changes affect later reads.
ToolingCompiler errors and GPC debuggingDiagnose placement, identifier, type-range, combo-timing, and target-version problems systematically in Zen Studio.