For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add a one-time setup phase

init runs once before the first main cycle:

one-time-setup-phase.gpc
int fire_button;

init {
    if(get_console() == PIO_PS5) {
        fire_button = PS5_R2;
    } else {
        fire_button = XB1_RT;
    }
}

main {
    if(get_ival(fire_button)) {
        set_val(fire_button, 100);
    }
}

Good init work includes selecting platform identifiers, loading persistent settings, initializing cached values, and choosing a start mode. Do not repeatedly perform one-time work in main.

Last updated