---
title: Core Console Functions
slug: gpc/gpc-scripting-core-console-functions
description: Here is the list of the Core Console Functions.
icon: ◽
docTags: 
createdAt: 2021-12-08T18:03:17.000Z
---

| 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

:::CodeblockTabs
GPC

```apex
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:

:::CodeblockTabs
GPC

```apex
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> );&#x20;

⚪ **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

:::CodeblockTabs
GPC

```apex
set_polar(POLAR_LS,250, 32000);
```
:::

&#x20;🔴 **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

:::CodeblockTabs
GPC

```apex
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:

:::CodeblockTabs
GPC

```apex
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 (  );&#x20;

⚪&#x20;**Parameters**

None&#x20;

🔵&#x20;**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

:::CodeblockTabs
GPC

```apex
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;&#x20;

| Return Value | Description         |
| ------------ | ------------------- |
| 0            | LED Off             |
| 1            | LED On              |
| 2            | LED Blinking Fast   |
| 3            | LED Blinking Slowly |

Example of usage:

:::CodeblockTabs
GPC

```apex
main {
 
    if(get_led(LED_2) == 1) { // If LED 2 is On
        // Do Something
    }
 
}
```
:::

🔴 **Syntax**

**&#xD;**&#x67;et\_led ( \<Led\_Identifier>  );&#x20;

⚪&#x20;**Parameters**

\<Led\_Identifier> : The identifier of an LED&#x20;

🔵&#x20;**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:

:::CodeblockTabs
GPC

```apex
main {
 
    if(get_rumble(RUMBLE_A) > 50) {  // If Rumble Motor A is running greater than 50% speed...
        // Do Something
    }
 
}
```
:::

🔴 **Syntax**

get\_rumble ( \<rumble\_identifier> );

&#x20;⚪ **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&#x20;

