Preprocessor
The GPC3 compiler supports common preprocessor directives for constants, shared include files, and compile-time switches.
Defines
#define TEST_HOLD_MS 100
#define STICK_SCALE 1.20
main {
if (event_active(BUTTON_11)) {
combo_restart(OutputTest);
}
}
combo OutputTest {
set_val(BUTTON_15, 100);
wait(TEST_HOLD_MS);
set_val(BUTTON_15, 0);
}Compatible GPC scripts can also use the assignment-style form:
define FIRE_TIME = 45;Conditional Blocks
#define ENABLE_DEBUG
main {
#ifdef ENABLE_DEBUG
if (event_active(BUTTON_11)) {
printf("Debug toggle");
}
#endif
}Includes
#include "shared_settings.inc"
#include <keyboard.gph>
#include <mouse.gph>
#include <remapper.gph>Use quoted includes for shared constants and small helper functions that are reused across scripts. Use angle-bracket includes for the built-in keyboard.gph, mouse.gph, and remapper.gph headers.
Script Metadata
#pragma METAINFO("Button Helper", 1, 2, "YourName")METAINFO sets the script name, version (1.02 in this example), and credited author shown on Helios GPC 3 slots and used when publishing to Online Resources. Names and authors can be up to 127 bytes. It follows macros and conditional blocks like other directives. Scripts without it still compile and load. If the author is left blank when publishing, Helios fills it from your display name.
Supported Directives
| Directive | Use |
|---|---|
#define |
Create a compile-time value or macro |
#undef |
Remove a defined value |
#include |
Include another source file |
#if |
Compile when an expression is true |
#ifdef |
Compile when a name is defined |
#ifndef |
Compile when a name is not defined |
#else |
Alternate conditional branch |
#endif |
End a conditional block |
#pragma METAINFO |
Set the script name, version, and credited author |
Notes
- Keep includes small and readable.
- Prefer simple constants over clever macros.
- Use conditional blocks for debug logging or feature variants.