GPC Developer Guides

Basic Syntax

this is basic syntax of a gpc script gpc define cronus = 120; int zen = 100; main { if (get val(xb1 a)) { combo run(jump); } } combo jump { set val(xb1 a, 100); wait(cronus); set val(xb1 a, 0); wait(zen); } instruction separation as in c, gpc requires instructions to be terminated with a semicolon at the end of each statement however, the closing tag of a block code automatically implies a semicolon, so a semicolon is not needed when terminating the last line of a gpc block gpc main { sensitivity(xb1 ly, not use, 80); a = b ( c + 20 ) } although the semicolon is not required in the final line of a block, it is considered good practice to use one so it is not missed should you expand on the code at a later date nesting code nesting code, or creating a logic block, binds code together a block starts with a { and end with a } what this does is nest the code with the { and } meaning that the code is only executed when the statement before it is active gpc main { //main start if(get val(ps4 r2)) { //block 1 start if(get val(ps4 l2)) { //block 2 start combo run(rapid fire ads); } //block 2 end else { //block 3 start combo run(rapid fire); } //block 3 end } //block 1 end } //main end in this example, blocks 2 & 3 are ignored unless block 1 is active so if the r2 button is not pressed, nothing happens if r2 is pressed, then the cronus zen looks at block 2 if l2 is pressed, it will run the combo rapid fire ads and ignore block 3 however, if l2 is not pressed, it will ignore block 2 and instead execute the code in block 3 and then run combo rapid fire nesting is implied if you only have one line of code after a statement as in this example; gpc main { if(get val(xb1 rt) > 95) combo run(rapid fire); } when compiled, the line combo run(rapid fire); will automatically be nested within the if statement if you wish for more than one line of code to only be executed when the statement before them is active, then you must use { and } commenting code a comment is text which is ignored by the compiler comments are usually used to annotate code for future reference or to add notes for others looking at the code however, they can also be used to make certain lines of code inactive to aid when debugging scripts if you have programmed in c before then gpc comments will be familiar to you as it uses the same style there are two types of comments, the single line comment and the multi line comment single line comment the // (two slashes) characters create a single line comment and can be followed by any sequence of characters a new line terminates this form of comment as shown below gpc main { // a single line comment if(get val(xb1 rt) > 95) // another single line comment combo run(rapid fire); } multi line comment the / (slash, asterisk) characters start a multi line comment and can also be followed by any sequence of characters the multi line comment terminates when the first / (asterisk, slash) is found as shown below gpc main { / a multi line comment if(get val(xb1 rt) > 95) combo run(rapid fire); / } as the comment terminates when a / (asterisk, slash) is found, this style of commenting cannot be nested as shown below gpc main { / a multi line comment if(get val(xb1 rt) > 95) combo run(rapid fire); / this will cause a problem / / }