Input and outputUpdated 2026-07-24

Controller input and output functions

Read current, physical, and prior values; detect transitions; write outputs; and understand when script changes affect later reads.

Overview

Input helpers answer different questions. get_ival reads physical input before script changes, while get_val observes the current value in the processing path. set_val writes the outgoing value.

Transition and timing functions help avoid hand-built edge detectors. Check official identifier and value-range tables for the connected controller.

Key facts

  • set_val writes output.
  • get_ival reads physical input before script changes.
  • get_val and get_ival are not interchangeable after remapping or output modification.
  • Controller value ranges depend on the identifier type.

GPC syntax examples

Examples are intentionally small. Replace identifiers only with values documented for your target.

Physical input to controlled outputexample.gpc
main {
    if (get_ival(XB1_A) > 0) {
        set_val(XB1_A, 100);
    }
}

Functions, commands, and terms

Names below are catalog entries, not guessed signatures. Open the official sources for current parameter and return-value details.

NameKindPurpose
get_valfunction · Zen and Plus

Reads the current value of a controller identifier.

get_ivalfunction · Zen only

Reads physical input before script modifications.

get_lvalfunction · Zen and Plus

Reads the identifier's value from the previous processing cycle.

set_valfunction · Zen and Plus

Sets an identifier's outgoing value.

event_pressfunction · Zen and Plus

Reports a transition into the pressed state.

event_releasefunction · Zen and Plus

Reports a transition out of the pressed state.

get_ptimefunction · Zen and Plus

Returns elapsed time for the controller entry's current state.

get_controllerfunction · Zen and Plus

Returns the controller type connected to the input port.

get_batteryfunction · Zen and Plus

Returns wireless-controller battery status.

get_brtimefunction · Zen only

Returns how long the physical input value has been zero.

Common mistakes

Reading get_val when unmodified physical input is required.

Assuming all controls use the same numeric range.

Using level checks where a one-cycle event check is intended.

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