GPC Developer Guides
A Simple Tutorial
step 1 load zen studio and click file > new > empty file step 2 copy and paste the following code into the gpc code editor within zen studio gpc main{ if(get val(xb1 rt)){ combo run(rapid fire); } } combo rapid fire{ set val(xb1 rt, 100); wait(40); set val(xb1 rt, 0); wait(30); set val(xb1 rt, 0); } step 3 compile the code to check for errors to do this, either press f7 on your keyboard or go to the compiler drop down menu in zen studio and select compile the output window below the gpc editor should give you this message; gpc gpc build started 1 new compilation completed with 0 warning(s) total byte size 148 bytes (0 23%) total variables used 3 of which 3 are dedicated to combos (0 59%) if your cronus zen is connected via the prog usb port and you have a controller connected, you can see this script in action by using the build and run option this is accessed by either pressing f5 or selecting build and run in the compiler drop down menu this function will compile the code and then send it to your cronus zen so you can test it script breakdown what this script does is run the combo named rapid fire whenever the right trigger has a value or is pressed if the right trigger is still held when the combo ends, it will be run again to analyze how the cronus zen is told how to do this we must first break the script down into its two sections, the main and combo sections the main section gpc main{ if(get val(xb1 rt)){ combo run(rapid fire); } } as explained here , the main section is run in a loop by the cronus zen the virtual machine in the cronus zen runs through the code in order and when it reaches the end of the code, data is sent to the console and then the virtual machine starts the next loop gpc if (get val(xb1 rt)) the above code tells the cronus zen that if the statement is true, run the nested code in this case, if xb1 rt (right trigger) has a value greater than 0 (zero) so is pressed or not at rest gpc { combo run(rapid fire); } above is the code nested within the if statement nesting code creates a hierarchical structure an open curly bracket { starts the nesting and a closed curly bracket } ends it by nesting code within the if statement, we are telling the cronus zen that we only wish for that code to be executed only when the if statement is true gpc combo run(rapid fire); this line simply tells the cronus zen to run the combo named rapid fire it is important to note that if the cronus zen receives this instruction and the combo is already running it will not do anything it will only run the combo again if it has finished this means that if you hold down the right trigger with this code active, the cronus zen start the combo and then run it again as soon as it has ended therefore, running the combo in an indefinite loop or until such time as the right trigger is released the combo section gpc combo rapid fire{ set val(xb1 rt, 100); wait(40); set val(xb1 rt, 0); wait(30); set val(xb1 rt, 0); } this is the combo that the cronus zen is instructed to run when the right trigger is pressed when run, a combo runs through the code until it gets to a wait statement the wait statement instructs combo to execute the commands above it for a set amount of time which is expressed in milliseconds gpc set val(xb1 rt, 100); wait(40); these lines instruct the combo to set the value of the right trigger to 100 (or fully pressed) for 40 milliseconds gpc set val(xb1 rt, 0); wait(30); once the 40 milliseconds has passed, these lines instruct the combo to set the right trigger to 0 (release) for 30 milliseconds additional detail on how a combo operates can be found here expanding the code now that you understand how this script works, we will make it more complex and change when the combo is run look at this line in the main section gpc if(get val(xb1 rt)){ and change it to gpc if(get val(xb1 rt) && !get val(xb1 lt)){ by introducing && !get val(xb1 lt) into the if statement we are telling the cronus zen to only run the combo if the right trigger has a value and the left trigger does not && means 'and' in gpc and ! means not so the if statement now reads 'if right trigger has a value and left trigger does not this means when using this code in game the cronus zen will only rapid fire your gun when you are not aiming down the sights you can use the build and run function to see this code in action