Functions

This reference lists the public functions intended for GPC3 script authors. It focuses on the calls a user script needs to read input, write output, run combos, handle timing, perform math, and work with keyboard and mouse state.

The scope is the documented script-authoring API: functions a user or AI assistant would use when writing a GPC3 script.

Function Groups

Group Use it for
Input Read controller values, physical input, edge events, and hold timing
Output Set controller output and temporarily block inputs
Combo Start, stop, pause, resume, and compose timed combos
Time Read timers and build cooldowns, double taps, and periodic checks
Math Clamp, scale, curve, smooth, randomize, and calculate values
Keyboard & Mouse Read and write host keyboard/mouse state when available
Polar Sticks Read and write stick angles and radius
Memory & Persistent Data Copy script data and save small settings
System Print debug output and write reusable helper functions

Core Workflow

Most controller scripts start with this flow:

Step Action
1 Read input with get_val(), get_actual(), or an event function.
2 Decide what should happen this tick.
3 Set output with set_val() or start/stop a combo.
4 Use clamp() when math can push analog values outside the normal range.

gpc
bool remap_enabled = FALSE;

main {
    if (event_active(BUTTON_11)) {
        remap_enabled = !remap_enabled;
        printf("Accessibility remap: %b", remap_enabled);
    }

    if (remap_enabled) {
        fix32 source = get_val(BUTTON_15);
        set_val(BUTTON_14, source);
        set_val(BUTTON_15, 0);
    }
}

Values and Types

Controller values usually use these ranges:

Input type Typical range
Digital buttons 0 or 100
Analog triggers 0 to 100
Stick axes -100 to 100

Use int for whole-number flags, counters, indexes, and millisecond values. Use fix32 for analog math, sensitivity values, curves, smoothing, and fractional calculations.

What To Read First