CzenScripts field guide

How to Write Your Own Cronus Zen Script: Complete GPC Guide

Want to build your own Cronus Zen script? This beginner-friendly GPC scripting guide explains how Cronus Zen scripts work, how to create your first .gpc file, use buttons and variables, build toggles and combos, compile your code and test it in Zen Studio.

Shane T 19 min read
How to Write Your Own Cronus Zen Script: Complete GPC Guide
Before you begin

Start with the recommended baseline, change one value at a time, and test each adjustment under consistent conditions.

How to Write Your Own Cronus Zen Script: Complete GPC Guide

Downloading existing Cronus Zen scripts is easy, but learning how to write your own Cronus Zen script gives you much more control over what your device actually does.

Cronus Zen scripts are written using GPC, a programming language designed specifically around controller input and the Cronus scripting environment. Official Cronus documentation describes GPC as a C-based language and provides a compiler inside Zen Studio for creating and testing scripts.

You don't need to be an experienced programmer to get started.

A basic GPC script can be surprisingly small.

Once you understand a few concepts such as:

  • main
  • variables
  • if statements
  • controller identifiers
  • get_val
  • set_val
  • toggles
  • combos
  • functions

you can begin building your own controller configurations.

This guide will take you from an empty Zen Studio file to your first working GPC script.

If you haven't configured your Cronus Zen yet, start with the Complete Cronus Zen Guide before beginning.

CzenScripts also maintains dedicated setup, firmware, USB and troubleshooting resources in the CzenScripts Guides Hub. Those pages are currently part of the site's guide structure.


What Is a Cronus Zen GPC Script?

A GPC script is a text file containing instructions that the Cronus Zen scripting engine can execute.

The file normally uses the:

.gpc

extension.

Instead of modifying a game, GPC works with controller input and output.

A script can detect things such as:

  • A button being pressed
  • A button being released
  • How far a trigger is pressed
  • Analog-stick movement
  • A combination of controller inputs
  • Whether a particular mode has been enabled

It can then alter controller output or perform another supported GPC action.

The official GPC documentation states that the main section is the only mandatory section of a script and that it runs continuously as part of the Zen's virtual-machine loop.

That makes main the best place to begin.


What You Need to Write a Cronus Zen Script

Before writing your first script, you'll need:

  • Cronus Zen
  • Zen Studio
  • A USB data cable
  • A compatible controller
  • Your Cronus Zen connected through its programming connection

If Zen Studio isn't detecting your device, don't start troubleshooting your GPC code yet.

First follow the Zen Studio Not Detecting Cronus Zen Guide.

You can also check the Cronus Zen USB Ports Guide if you're uncertain about which connection to use.


Step 1: Create a New GPC File

Open Zen Studio.

Go to:

File → New → Empty File

This opens a new file in the Zen Studio Compiler.

Cronus' official beginner tutorial currently uses this same workflow for starting a new GPC script.

You can now begin writing code.


Step 2: Understand the Main Section

The simplest possible GPC structure is:



main {

}

That's it.

The main block is where most of the script's ongoing logic begins.

Cronus' documentation describes main as the central section of a GPC script. The Zen repeatedly processes the code inside it and produces controller output from those instructions.

You can think of it roughly as:



Read controller
↓
Run main code
↓
Generate controller output
↓
Start again

This loop happens continuously while the script is active.


Step 3: Learn Controller Identifiers

To make the script do something useful, you need to tell it which controller input you want to work with.

GPC provides identifiers representing controller buttons, triggers and analog sticks.

For example, Xbox-style identifiers include names such as:



XB1_A
XB1_B
XB1_X
XB1_Y

XB1_LB
XB1_RB

XB1_LT
XB1_RT

XB1_LX
XB1_LY
XB1_RX
XB1_RY

The same concept applies to supported PlayStation controller identifiers.

Cronus maintains controller-identifier references within its GPC documentation, including current PlayStation controller input identifiers.

Once you understand identifiers, you can start checking what the controller is doing.


Step 4: Read Controller Input With get_val

One of the most useful GPC functions is:



get_val()

It allows your script to read the current value associated with an input.

For example:



main {

if(get_val(XB1_A)) {

}

}

This effectively means:

If the A button currently has a value, execute the code inside this block.

The curly brackets determine which instructions belong to the if condition.

This concept is fundamental to GPC scripting.


Step 5: Change Controller Output With set_val

If get_val reads an input, set_val can be used to change an output value.

For example:



set_val(XB1_B, 100);

A value of 100 represents a fully active button value in a typical button example.

Putting these concepts together gives us:



main {

if(get_val(XB1_A)) {

set_val(XB1_B, 100);

}

}

The script checks whether A is being pressed.

If it is, the script outputs B at full value.

This isn't necessarily something you'd need in a finished script, but it demonstrates one of the most important concepts in GPC:

input → condition → output


Step 6: Learn GPC Syntax

GPC has programming rules called syntax.

For example:



set_val(XB1_A, 100);

ends with:



;

The semicolon tells the compiler that the instruction has finished.

Cronus' current syntax documentation specifies semicolon termination for GPC statements, similar to C-style languages.

Blocks use curly brackets:



main {

}

Conditions use parentheses:



if(get_val(XB1_A)) {

}

A missing semicolon or bracket is enough to generate a compiler error.


Step 7: Add Variables

Once your script becomes more complex, you'll want to store information.

That's what variables are for.

For example:



int enabled = 0;

This creates a variable named:



enabled

and gives it an initial value of:



0

You could later change it:



enabled = 1;

Variables are especially useful for:

  • Settings
  • Modes
  • Counters
  • Menu positions
  • Adjustable values
  • Toggle states

Current GPC documentation says global variables are declared outside main and init, are case-sensitive, and can then be accessed from areas including main, init, combos and functions.

For example:



int enabled = 0;

main {

}


Step 8: Create a Toggle

Toggles are one of the most useful concepts when writing Cronus Zen scripts.

Imagine pressing one button to turn something on, then pressing it again to turn it off.

You could write:



int enabled = 0;

main {

if(event_press(XB1_A)) {

enabled = !enabled;

}

}

The important line is:



enabled = !enabled;

If enabled is currently 0, it becomes 1.

If it is 1, it becomes 0.

The official variable documentation specifically demonstrates using integer variables as boolean-style toggles with event_press.


Your First Complete Cronus Zen Script

Let's turn that into a small learning script.

This example uses the Zen's LEDs to show whether a mode is enabled.



int enabled = 0;

main {

if(event_press(XB1_A)) {

enabled = !enabled;

}

if(enabled) {

set_rgb(0, 255, 0);

} else {

set_rgb(255, 0, 0);

}

}

Pressing A changes the state of the enabled variable.

When enabled:



set_rgb(0, 255, 0);

sets the supported Zen LED output to green.

When disabled:



set_rgb(255, 0, 0);

sets it to red.

Cronus currently documents set_rgb as a device function accepting red, green and blue values from 0–255.

This little script demonstrates several core GPC concepts:

  • Variables
  • main
  • if
  • else
  • event_press
  • Toggle logic
  • Calling a GPC function

Once you understand this script, much larger scripts become easier to read.


Step 9: Understand event_press vs get_val

These two concepts are easy to confuse.

Consider:



get_val(XB1_A)

This checks the current value of A.

If you hold A down, it remains active.

Now consider:



event_press(XB1_A)

This is useful when you care about the moment the button is pressed.

That's why event_press works particularly well for:

  • Toggle switches
  • Menu navigation
  • Changing profiles
  • Increasing settings
  • Decreasing settings

If you used a continuously active condition to flip a toggle, the variable could keep changing while the button remained held.

Using the press event avoids that problem.


Step 10: Learn GPC Combos

A combo is a separate sequence of timed instructions.

Combos are extremely important in more advanced GPC scripts because they allow instructions to occur over time without stuffing all of your timing logic directly into main.

The general structure looks like:



combo ExampleCombo {

// action

wait(100);

// another action

wait(100);

}

The number supplied to wait() represents time in milliseconds.

Cronus' official documentation explains that combos process groups of instructions according to the wait commands that follow them.

A combo can be started from main:



combo_run(ExampleCombo);

This makes combos useful for building reusable timed sequences.


Step 11: Use Conditions

You don't want every piece of your script running all the time.

That's where conditions become important.

You've already seen:



if(condition) {

}

You can also use:



else {

}

For example:



if(enabled) {

set_rgb(0, 255, 0);

} else {

set_rgb(255, 0, 0);

}

You can combine conditions too.

For example:



if(get_val(XB1_LB) && get_val(XB1_RB)) {

}

The:



&&

operator means AND.

So both conditions need to be true.

Other logic you'll eventually encounter includes concepts such as:



||
!
==
!=
>
<
>=
<=

Learning these operators lets you create increasingly precise behaviour.


Step 12: Add Adjustable Values

Hard-coding every value makes a script difficult to customize.

Instead of doing this repeatedly:



set_val(XB1_B, 50);

you could create a variable:



int output_strength = 50;

Then use:



set_val(XB1_B, output_strength);

Now you only need to change:



output_strength

to modify the behaviour.

You can eventually let the controller modify the variable itself.

For example, one button could increase a value and another could decrease it.

That is how many configurable GPC menus are built.


Step 13: Create Your Own Functions

As scripts become larger, repeating the same code everywhere gets messy.

GPC supports user-created functions.

The structure is:



function MyFunction() {

}

You can then call it from other parts of the script.

For example:



main {

MyFunction();

}

function MyFunction() {

}

Functions can also accept parameters and return values.

Official Cronus documentation describes user-created functions as reusable blocks that can be called from init, main, combos or other supported areas, while also supporting parameters and return values.

Functions become especially valuable when your script grows beyond a few dozen lines.


Step 14: Understand init

Another useful GPC section is:



init {

}

Unlike main, which runs repeatedly, init runs when the script is initialized.

That makes it useful for preparing values or setting up the initial state of your script.

For example:



int mode;

init {

mode = 1;

}

main {

}

Cronus' current GPC structure documentation describes init as an optional section that runs once when the script is loaded into the virtual machine.


A Useful GPC Script Structure

Once your script becomes larger, keeping everything organized makes debugging dramatically easier.

A clean structure might look something like this:



// ============================================
// SCRIPT NAME
// ============================================


// DEFINITIONS


// VARIABLES

int enabled = 0;
int mode = 1;


// INITIALIZATION

init {

}


// MAIN LOOP

main {

}


// COMBOS


// FUNCTIONS

Not every script needs every section.

In fact, main is the only mandatory part of a user-created GPC script according to the current official structure guide.

Start simple and add sections only when you need them.


Step 15: Comment Your Code

Comments don't affect how the script runs.

They're notes for you.

A single-line comment starts with:



//

For example:



// Toggle script on or off

if(event_press(XB1_A)) {

enabled = !enabled;

}

Good comments become extremely valuable once your script reaches hundreds or thousands of lines.

Instead of wondering:

Why did I write this?

you already have the answer.


Step 16: Compile Your Cronus Zen Script

Once you've written some code, you need to make sure the compiler accepts it.

In Zen Studio you can compile your script using the Compiler controls.

Cronus' current beginner tutorial lists:

F7 → Compile

for checking a script for compilation errors.

When your script builds successfully, Zen Studio's output panel will indicate that compilation completed.

If it doesn't compile, read the reported error.

Common mistakes include:

  • Missing semicolon
  • Missing bracket
  • Misspelled identifier
  • Incorrect function name
  • Variable declared in the wrong place
  • Invalid combo structure
  • Calling something that hasn't been defined correctly

Don't immediately rewrite the entire script.

Start with the line number identified by the compiler.


Step 17: Test With Build and Run

You shouldn't program an unfinished script to a memory slot every time you change one line.

Zen Studio provides a Build and Run workflow for testing.

The official Cronus beginner tutorial currently lists F5 as the shortcut for Build and Run when the Zen is connected appropriately.

This lets you:

  1. Edit code.
  2. Compile it.
  3. Run it.
  4. Test the controller.
  5. Change the code.
  6. Test again.

That feedback loop is one of the fastest ways to learn GPC.


Step 18: Use Device Monitor for Debugging

Zen Studio also includes Device Monitor.

This is extremely useful when a script isn't behaving how you expected.

Cronus describes Device Monitor as a debugging tool that displays real-time information from the Zen, including I/O and other device information.

Current GPC documentation also supports trace values that can be viewed in Device Monitor, with F3 listed as the shortcut for opening it.

For example, you could trace a variable while debugging rather than guessing what value it contains.

That's a much better programming habit than changing random parts of the script until something happens.


Step 19: Program the Finished Script to Cronus Zen

Once your script:

  • Compiles correctly
  • Works in testing
  • Uses the controls you want
  • Doesn't conflict with normal controller operation

you can program it to a Cronus Zen memory slot.

If you haven't done that before, follow the CzenScripts GPC Script Installation Guide.

That guide covers getting a .gpc file onto the device after you've finished writing it.


Step 20: Build an OLED Menu

After you've mastered the basics, one of the biggest upgrades you can make is adding an OLED menu.

Cronus Zen exposes OLED-specific GPC functionality for controlling the device display.

Instead of requiring someone to edit:



int strength = 20;

inside the source code, you could eventually create a menu where the controller adjusts that value.

A more advanced menu might display:



SETTINGS

MODE: 2
STRENGTH: 20
STATUS: ON

Controller buttons could then:

  • Move through menu pages
  • Increase values
  • Decrease values
  • Enable settings
  • Save configuration

This is one of the main differences between a basic beginner GPC and a polished Cronus Zen script.


Persistent Settings

Another advanced feature is persistent storage.

Without persistent memory, changing a variable while your script is running may not necessarily preserve that value after the script or device reloads.

Cronus Zen supports slot-specific persistent variables, allowing a script to save appropriate configuration values. The current documentation describes up to 64 private variables for each Zen memory slot.

This makes persistent memory useful for things such as:

  • Menu settings
  • Profile selections
  • User configuration
  • Strength values
  • Toggle states

However, persistent values should be written deliberately rather than continuously.

The official documentation warns against repeatedly writing persistent values from every iteration of main, because those values use device memory designed for a finite number of write cycles.


Don't Build Everything at Once

One of the biggest beginner mistakes is attempting to create a huge script immediately.

Don't start with:

  • Ten menus
  • Twenty profiles
  • Dozens of variables
  • Persistent memory
  • Custom OLED graphics
  • Multiple controller types
  • Hundreds of lines of code

Start with:



main {

}

Then add one feature.

Compile.

Test it.

Add another feature.

Compile.

Test again.

A script that has been built and tested incrementally is dramatically easier to debug.


A Better Development Workflow

Use this process:

1. Define the idea

Write down what you want your script to do.

2. Identify inputs

Which controller buttons or sticks should control it?

3. Create variables

What settings need to be remembered?

4. Write the smallest possible version

Ignore menus and visual effects initially.

5. Compile

Fix every compiler error.

6. Build and Run

Test the behaviour.

7. Use Device Monitor

Inspect controller values and debug variables.

8. Refactor

Move repeated logic into functions.

9. Add configuration

Create toggles and adjustable values.

10. Add the interface

Only then consider OLED menus and persistent settings.

This approach produces cleaner code and makes bugs much easier to isolate.


Use the CzenScripts Free Script Generator as a Starting Point

If staring at:



main {

}

feels intimidating, you don't necessarily need to begin completely from scratch.

CzenScripts has a Free Cronus Zen Script Generator that can give you a generated GPC structure to inspect and experiment with.

The generator currently exists alongside the other CzenScripts setup and script tools.

A useful learning process is:

Generate → inspect → modify → compile → test

Instead of treating generated code as a black box, open it in Zen Studio and study how each section works.


Learn From Existing Scripts

Reading existing code is one of the fastest ways to improve.

Try identifying:

  • Where variables are declared
  • What happens in main
  • How toggles work
  • Which controller identifiers are used
  • Which logic has been moved into functions
  • How combos are structured
  • How settings are stored
  • How menus are implemented

The important part is understanding why each section exists.

CzenScripts maintains a broad catalog of game-specific Zen scripts, while the site also includes dedicated script comparison and instruction tools.

You can explore the Cronus Zen Script Finder or Cronus Zen Script Comparison Tool to see the different types of script features people build.


Common GPC Coding Mistakes

Missing semicolons

Wrong:



enabled = 1

Correct:



enabled = 1;


Missing curly brackets

Nested sections must open and close correctly.



if(enabled) {

// code

}


Variable declared in the wrong location

Global variables belong outside main and init under the documented GPC structure.


Incorrect capitalization

GPC variables are case-sensitive.

These are different:



enabled
Enabled
ENABLED


Building too much before testing

Compile after every meaningful addition.

Ten lines of broken code are much easier to troubleshoot than 500.


Using unexplained numbers everywhere

Instead of:



int a = 25;
int b = 50;
int c = 10;

use names that explain their purpose:



int menu_page = 1;
int output_strength = 50;
int adjustment_step = 5;

Future you will appreciate it.


How to Make Your Cronus Zen Script Better

Once your first script works, focus on structure and usability rather than simply adding more features.

Useful improvements include:

Clear variable names

Prefer:



menu_enabled

over:



x

Reusable functions

Don't write identical logic five times.

Comments

Explain unusual code.

Adjustable values

Avoid unnecessary hard-coded values.

Clean button combinations

Avoid controls that interfere with normal gameplay.

OLED feedback

Tell users what's active.

Persistent settings

Save appropriate configuration.

Error-resistant values

Set sensible minimum and maximum ranges.

Organized sections

Keep variables, main logic, combos and functions clearly separated.

These changes are what turn an experiment into a script that other people can actually understand.


Can You Write a Cronus Zen Script Without Knowing C?

Yes.

Knowing C or another programming language will make GPC easier to learn, but it isn't required.

GPC uses familiar programming concepts including:

  • Variables
  • Functions
  • Conditions
  • Operators
  • Blocks
  • Loops performed by main
  • Timed combos

Cronus explicitly describes GPC as C-based, so experience with C-style programming transfers naturally.

But you can learn these concepts directly through GPC.


How Long Does It Take to Learn GPC?

You can understand the fundamental structure surprisingly quickly.

The bigger challenge is learning to organize complicated scripts.

A sensible learning path is:

Stage 1

main, identifiers, get_val, set_val

Stage 2

variables and conditions

Stage 3

toggles and button events

Stage 4

combos

Stage 5

functions

Stage 6

adjustable values

Stage 7

Device Monitor and debugging

Stage 8

OLED menus

Stage 9

persistent settings

Stage 10

larger multi-profile scripts

Don't skip directly to Stage 10.


Frequently Asked Questions

What programming language does Cronus Zen use?

Cronus Zen uses GPC, a C-based scripting language designed for the Cronus scripting platform.

What file type does a Cronus Zen script use?

Cronus Zen source scripts use the .gpc file format, which can be opened and managed through Zen Studio's compiler/file-management system.

Do I need coding experience to write a Cronus Zen script?

No. Basic programming knowledge helps, but GPC can be learned directly by starting with main, conditions, controller identifiers and variables.

What is the most important section of a GPC script?

main is the only mandatory section and forms the core execution loop of a GPC script.

What software do I use to create a Cronus Zen script?

Use the Compiler inside Zen Studio, which Cronus currently describes as an IDE for editing and compiling GPC source files.

How do I check a GPC script for errors?

Compile it inside Zen Studio. Cronus' current beginner tutorial lists F7 as the compile shortcut.

How do I test a script?

Zen Studio's Build and Run function can compile and send a script to a connected Zen for testing. The current official tutorial lists F5 for Build and Run.

How do I debug a Cronus Zen script?

Use the Zen Studio Device Monitor and trace values to inspect what the device and your script are doing in real time.

Can I create an OLED menu?

Yes. Cronus Zen provides dedicated GPC functions for controlling the Zen OLED display.

Can Cronus Zen remember my script settings?

Yes. GPC provides persistent variables that can preserve supported values for individual Zen memory slots.

Where can I install my finished script?

Once your .gpc file is ready, follow the CzenScripts GPC Script Installation Guide.


Final Thoughts

Learning how to write your own Cronus Zen script becomes much easier once you stop viewing a complete script as one enormous piece of code.

Nearly everything starts with:



main {

}

From there, you learn how to read controller inputs.

Then you add conditions.

Then variables.

Then toggles.

Then combos and functions.

Eventually, you can add adjustable settings, persistent storage and full OLED menus.

The most important habit is to build incrementally.

Write one feature → compile → test → debug → continue.

If you want a starting structure rather than a completely empty file, try the CzenScripts Free Cronus Zen Script Generator.

Once you've created your script, use the GPC Script Installation Guide to program it onto your Zen.

For additional setup and troubleshooting help, visit the CzenScripts Guides Hub.

And if you'd rather use an existing script while learning how GPC works, browse the CzenScripts Script Finder or the current Cronus Zen script catalog. The catalog includes dedicated collections for games such as Warzone, Fortnite, Apex Legends, Rainbow Six Siege and others.

CzenScripts updates

Get new settings guides first

Receive new script guides, setup updates and CzenScripts releases directly in your inbox.