Basic GPC Structure

A GPC script can be split into sections. There can be a total of 8 different sections and, in any user made script, they should be laid out in the order shown in the example below. Only the main section is mandatory as it is the heart of any script and is run in a constant loop.

Definitions Section

// Definitions Section (OPTIONAL)
define zero = 0;
define one  = 1;
define two  = 2;

The definition section is used to assign values to words thus creating a named constant. Definitions must be placed before the main section.

In this example we define zero, one and two to the values 0, 1, 2 respectively. These are static values which cannot be altered during run time.So, should we use the word 'one' at any point in the script it is the same as typing the number 1.

Definitions

Putting it all together

// Definitions Section (OPTIONAL)
define zero = 0;
define one  = 1;
define two  = 2;

// Data Section (OPTIONAL)
data (zero, one, two, 10, 128, 40);

// Remapping Section (OPTIONAL)
remap XB1_LB -> XB1_RB;
remap XB1_RB -> XB1_LB;

// Variable Initialization Section (OPTIONAL)
int example1 = 10;
int example2, example3;
int example4 = 17;

// GPC Initialization Section (OPTIONAL)
init {
    if(get_controller() == PIO_PS4){
        example2 = 27;
    } else {
        example2 = 1;
    }
}

// GPC Main Section (MANDATORY)
main {
    if(example_function()){
        if(get_val(example3)){
            combo_run(testing);
        }
    }
}

// Combo Section (Optional)
combo testing{
    set_val(20, 100);
    wait(example1);
    wait(100);
}

// Function Section (Optional)
function example_function(){
    if(get_val(example2)){
        example3 = 18;
        return 1;
    } else if(get_val(example4)){
        example3 = 19;
        return 1;
    }
    return 0;
}

Last updated

Was this helpful?