GPC Developer Guides
...
Functions
Console Functions
Core Console Functions
function name description get console gets which console is currently connected set val sets the output value to send to the console set polar sets the stick output at a given angle and radius with a high resolution value block all inputs blocks all output from being sent to the console this cycle of main ps4 authtimeout check if ps4 authentication is timed out output reconnection check the output if reconnected output protocol sets output protocol get led returns the current state of a specified led get rumble returns the current value of a rumble motor get console get console gets which console is currently connected gpc main { if(get console() == pio ps4){ // if playstation console detected if(get controller() == pio ps4){ // if playstation controller detected set rgb(0,0,255); // set blue led } else { if(get controller() == pio xb1){ // if xbox controller detected set rgb(0,255,0); // set green led } } } if(get console() == pio xb1){ // if xbox console detected if(get controller() == pio xb1){ // if xbox controller detected set rgb(0,255,0); // set green led } else { if(get controller() == pio ps4){ set rgb(0,0,255); // set blue led } } } } set val set val overwrites the current value of a controller entry with the value that is specified in its second parameter what this means is whatever the output is from the controller for the specified button/axis, the set val command will overwrite that value with the value you specify it is mainly used in combos to set buttons in sequence, however, it can also be used in the main or user created function for example, if you were playing a shooter game and wished to create hair triggers a combo would not be suitable for such a function as you would want the output constant for however long the triggers are held down you could use the set val command within the main section to achieve that function, like so gpc main { if(get val(xb1 lt)) { // if lt / l2 is pressed set val(xb1 lt, 100); // set lt / l2 to 100 (fully pressed) } if(get val(xb1 rt)) { // if rt / r2 is pressed set val(xb1 rt, 100); // set rt / r2 to 100 (fully pressed) } } 🔴 syntax set val ( \<identifier> ); ⚪ parameters \<identifier> the identifier of a controller entry set polar set polar sets the stick output at a given angle and radius with a high resolution value gpc set polar(polar ls,250, 32000); 🔴 syntax set polar( \<stick> , \<angle> , \<radius> ); ⚪ parameters \<stick> defined stick \<angle> index point of the bit to be set with a range of 0 to 359 \<radius> index point of the bit to be set with a range of 32768 to 32767 🔵 returns nothing block all inputs block all input blocks all output from being sent to the console this cycle of main gpc main { if(get ival(ps4 ps)) { block all inputs(); } } ps4 authtimeout ps4 authtimeout returns the authentications timeout status on the ps4 in the form of an int as with output reconnection, this function is redundant since firmware 1 20 and above as partial ps4 cross over support is no longer required however, the function has not been removed as legacy cronuszen users and those not using a usb hub would still require it the main function of ps4 authtimeout is to enable you to script a warning when the cronuszen is close to automatically disconnecting and reconnecting to the console when the authentication times out on a ps4 this could be achieved using a script from our online library gpc int authcount; int notify = 3; //1 = 30 secs 2 = 1 min 3 = 1 min 30 secs and so on up to 16 main{ //ps4 cross over gaming section if(get console() == pio ps4 && get controller() != pio ps4){ authcount = ps4 authtimeout(); swap(ps4 share,ps4 touch); // swap back/select with touchpad press if(get val(ps4 share) && get val(ps4 r3)) { // press back/select and press rs/r3 to press share set val(ps4 touch, 0); set val(ps4 r3, 0); set val(ps4 share, 100); } if(get val(ps4 touch)) { // hold back/select and press a/cross to reset auth timeout if(event press(ps4 cross)){ output reconnection(); } set val(ps4 cross, 0); } if(authcount <= notify + 1) { combo run(notify); } } //ps4 cross over gaming section end } combo notify{ set rumble(rumble a, 100); set rumble(rumble b, 100); wait(150); reset rumble(); wait(250 authcount); } 🔴 syntax ps4 authtimeout ( ); ⚪ parameters none 🔵 returns the ps4 authentication timeout status this is a decedent count down with 1 being the last value returned before an automatic reconnection is performed by the cronuszen output reconnection output reconnection sets output protocol gpc if(out reconnection()) == pio ps4 get led get led returns a value in the form of an int which represents the current state of the chosen led the leds range from 0 3 four constants have been created to make it easier to remember which value is assigned to which led name description value led 1 led 1 / xbox 360 quadrant 1 0 led 2 led 2 / xbox 360 quadrant 2 1 led 3 led 3 / xbox 360 quadrant 3 2 led 4 led 4 / xbox 360 quadrant 4 3 the return value from this function informs you of the current state of the selected led the function returns a value ranging from 0 3; return value description 0 led off 1 led on 2 led blinking fast 3 led blinking slowly example of usage gpc main { if(get led(led 2) == 1) { // if led 2 is on // do something } } 🔴 syntax get led ( \<led identifier> ); ⚪ parameters \<led identifier> the identifier of an led 🔵 returns an int ranging from 0 3 which represents the current state get rumble get rumble returns the speed of the chosen rumble motor on the controller in the form of an int the value returned can range from 0 100 which represents the speed in a percentage ( % ) the rumble motors are numbered 0 3 to make it easier to remember which motor is which, four constants have been created name description value rumble a strong rumble motor (usually the left motor) 0 rumble b weak rumble motor (usually the right motor) 1 rumble rt right trigger motor (xbox one controllers only) 2 rumble lt left trigger motor (xbox one controllers only) 3 example of usage gpc main { if(get rumble(rumble a) > 50) { // if rumble motor a is running greater than 50% speed // do something } } 🔴 syntax get rumble ( \<rumble identifier> ); ⚪ parameters \<rumble identifier> the identifier of a rumble motor 🔵 returns an int ranging from 0 255 which represents the current speed of the chosen motor