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.
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.
get_valfunction · Zen and PlusReads the current value of a controller identifier.
get_ivalfunction · Zen onlyReads physical input before script modifications.
get_lvalfunction · Zen and PlusReads the identifier's value from the previous processing cycle.
set_valfunction · Zen and PlusSets an identifier's outgoing value.
event_pressfunction · Zen and PlusReports a transition into the pressed state.
event_releasefunction · Zen and PlusReports a transition out of the pressed state.
get_ptimefunction · Zen and PlusReturns elapsed time for the controller entry's current state.
get_controllerfunction · Zen and PlusReturns the controller type connected to the input port.
get_batteryfunction · Zen and PlusReturns wireless-controller battery status.
get_brtimefunction · Zen onlyReturns 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
Declare static controller remaps and disabled outputs before runtime, and distinguish them from per-frame set_val logic.
Executioninit and main execution modelKnow what runs once, what loops, and why blocking or one-time work belongs in the correct execution block.
ExecutionStarting, stopping, and testing combosControl named combo instances from main and avoid restarting an active sequence every loop.