Keyboard & Mouse
These functions are available when the selected Helios input and output path provides keyboard or mouse state. Use the standard headers for readable key, mouse, and modifier names.
gpc
#include <keyboard.gph>
#include <mouse.gph>Keyboard
| Function | Use |
|---|---|
key_status(key) |
Read the physical key state |
get_keyboard(key) |
Compatibility alias for key_status(key) |
get_modifiers(mask) |
Return the pressed modifiers from a requested mask |
key_get(key) |
Read the current scripted key output |
key_set(key, state) |
Set a key output |
key_check() |
Return the first pressed key identifier, or 0 when none is found |
key_passthru() |
Copy physical keyboard state to output |
gpc
#include <keyboard.gph>
main {
key_passthru();
if (key_status(KEY_F)) {
set_val(BUTTON_15, 100);
}
if (get_modifiers(MOD_LCTRL | MOD_RCTRL)) {
key_set(KEY_G, TRUE);
}
}Mouse
| Function | Use |
|---|---|
mouse_status(field) |
Read a physical mouse axis, wheel, or button |
mouse_get(field) |
Read the current scripted mouse output |
mouse_set(field, value) |
Set a mouse output field |
mouse_passthru() |
Copy physical mouse state to output |
gpc
#include <mouse.gph>
main {
mouse_passthru();
if (mouse_status(MBUTTON_1)) {
set_val(BUTTON_10, 100);
}
}Mappings
keymapping(), mousemapping(), and remapper() support compatible mapping data. For normal use, create and tune a .ipt profile with Helios Input Translator, then choose that profile in GPC 3. This avoids hand-authoring mapping arrays.
Reset calls are available when a script needs to clear a loaded mapping:
gpc
keymapping_reset();
mousemapping_reset();
remapper_reset();Scripts can also use remapper_swap(first, second) and remapper_disable(id) to adjust an already loaded remapper.
Notes
- Call a pass-through function before applying key or mouse changes when unchanged input should continue to the output.
- Use named constants from the standard headers instead of numeric indexes.
- A loaded Input Translator profile and script mapping should not both control the same source device.