cronuszens.com
make-a-script

How to Make Your Own Cronus Zen Script

Cronus Zen scripts are written in GPC, a small language that looks like C. You write a .gpc text file and the Zen runs a compiled form of it. Write it in any text editor, then program it to a slot from Studio in Chrome, Edge or Opera, which compiles it as it programs. Collective Minds' Zen Studio has its own editor, and its Build and Run tests a script without programming a slot.

What a script is made of

PartWhat it does
defineGives a fixed value a name, such as the button a script uses
int variablesValues the script changes as it runs, such as a timing in milliseconds
initRuns once, when the slot loads
mainRuns over and over while the slot is active: it reads your controller and decides what the console gets
comboA timed sequence: set inputs, wait a number of milliseconds, set them again
functionA block of code you call from main or a combo

The functions most scripts use

  • get_ival reads what your controller sent, and get_val reads the value as main has changed it so far. Buttons and triggers run from 0 to 100, stick axes from -100 to 100.
  • set_val sets what the console gets: set_val(PS4_SQUARE, 100) presses Square and set_val(PS4_SQUARE, 0) lets it go.
  • event_press and event_release are true only at the moment a button goes down or comes up.
  • combo_run starts a combo, and combo_running says whether it still is.
  • get_pvar reads a saved value and set_pvar saves one, in SPVAR_1 to SPVAR_64, so settings survive a power-off.
  • cls_oled, print and rect_oled draw on the Zen's 128 by 64 screen.
  • block_all_inputs stops anything reaching the console, which is how menus keep your presses out of the game.

Buttons have PlayStation names such as PS4_SQUARE and Xbox names such as XB1_X. Both point at the same input, so one script works with either controller.

Example: a timed NBA 2K shot

In NBA 2K a jump shot on Square releases when Square is let go, so holding it for a set time is the core of a timed shot. This script does that when you click the right stick: it holds Square for 550 ms, and holding L2 while you press D-pad Up or Down changes the time by 5 ms and saves it.

int hold = 550;

init {
    hold = get_pvar(SPVAR_1, 100, 1500, 550);
}

main {
    if (get_ival(PS4_L2) > 50) {
        if (event_press(PS4_UP)) {
            hold = min(hold + 5, 1500);
            set_pvar(SPVAR_1, hold);
        }
        if (event_press(PS4_DOWN)) {
            hold = max(hold - 5, 100);
            set_pvar(SPVAR_1, hold);
        }
        set_val(PS4_UP, 0);
        set_val(PS4_DOWN, 0);
    }

    if (event_press(PS4_R3)) combo_run(Shot);
    set_val(PS4_R3, 0);
}

combo Shot {
    set_val(PS4_SQUARE, 100);
    wait(hold);
    set_val(PS4_SQUARE, 0);
    wait(50);
}
  • init reads the saved time from SPVAR_1, between 100 and 1500 ms, and uses 550 the first time.
  • With L2 held, D-pad Up and Down change the time and save it straight away, and set_val(PS4_UP, 0) keeps those presses out of the game.
  • Clicking R3 starts the Shot combo, and set_val(PS4_R3, 0) stops the click itself reaching the game.
  • Shot holds Square for hold milliseconds, lets go, and keeps it released for 50 ms so the game sees the release.

Shot early? Raise the time. Late? Lower it. How a 2K27 auto green Zen script times your shot explains the green window and the online delay this number has to cover.

Put it on your Zen

  1. Save the file with a .gpc ending.
  2. Plug the Zen's PROG port into your computer and connect it in Studio (connect-pc).
  3. Press Add a script on a slot and use the Your own file tab, or drag the file onto the slot.
  4. Press Program.
  5. If it does not compile, Show details gives the line to fix.
  6. Plug the Zen into your console and press the right blue button until that slot shows.

Mistakes that stop a script

  • return only works inside a function. In main, use if and else instead, or the compiler stops with Cannot use 'return' outside of a function.
  • Saved values stay on a slot when you program another script over it. That is why get_pvar takes a lowest value, a highest value and a default: anything the last script left outside your range falls back to the default.
  • If your script draws on the screen, call cls_oled when it starts, or the Zen's own scrolling file name can draw over yours.
  • Block the buttons your menu uses while it is open, with block_all_inputs or set_val(button, 0), or every press that changes a setting also reaches the game.
  • A script written for an older Zen Studio can define its own version of a function that is now built in. The compiler refuses it until that function is renamed.

Read a full script

Shot Tuner is our free NBA 2K script, published as readable source. It takes the shot on the right stick with a Timing and Tempo you set, saves three settings with get_pvar and set_pvar, and draws its own menu on the Zen's screen, opened with L2 + OPTIONS like cronus2K's. A .cz file from cronuszens.com is a sealed build: it can be programmed, not opened as code.

Before you play online

A script you wrote counts the same as any other. Activision says it detects the Zen by how your inputs behave, and 2K has banned NBA 2K27 accounts for scripts used as shooting aids. Read bans first.

Previous and next guide

Tools and scripts