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

Checkpoint exercise

Write a script that:

  1. Toggles enabled on a Cross press.

  2. While enabled, copies raw L2 to R2.

  3. Writes enabled to TRACE_1 and raw L2 to TRACE_2.

  4. Suppresses Cross from the output only on the toggle cycle.


One solution:

checkpoint-exercise.gpc
int enabled;
int raw_l2;

main {
    raw_l2 = get_ival(PS5_L2);

    if(event_press(PS5_CROSS)) {
        enabled = !enabled;
        set_val(PS5_CROSS, 0);
    }

    if(enabled) {
        set_val(PS5_R2, raw_l2);
    }

    set_val(TRACE_1, enabled);
    set_val(TRACE_2, raw_l2);
}

Last updated