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

The smallest useful script

Every GPC script needs main logic. Zen runs it repeatedly from top to bottom, once per VM cycle.

smallest-useful-script.gpc
main {
    if(get_val(PS5_L2)) {
        set_val(PS5_R1, 100);
    }
}

What each part does

Function
Purpose

get_val(PS5_L2)

Reads the current L2 value.

set_val(PS5_R1, 100)

Writes a fully pressed R1 to the outgoing report.


How it runs

1

Read

get_val(PS5_L2) reads the current L2 value.

2

Evaluate

Any nonzero value is true in an if condition.

3

Write

While L2 is active, set_val(PS5_R1, 100) makes the outgoing R1 value fully pressed.

4

Send

At the end of main, Zen finalizes and sends the output report.

This does not create a permanent state. The condition is evaluated again on the next VM cycle.

Can I use more than one main section?

Zen Studio Live accepts more than one main section and merges them into one combined section. Use a single main section in new scripts unless splitting generated source is genuinely useful.

Last updated