Core Controller Functions

Function Name

Description

Zen

Plus

get_val

Returns the current value of a controller entry

✔️

✔️

get_lval

Returns the previous value of a controller entry

✔️

✔️

get_ptime

Returns the elapsed time of a controller entries state change

✔️

✔️

get_controller

Returns the type of controller currently connected to the input port

✔️

✔️

get_battery

Returns the current status of the battery for a wireless controller

✔️

✔️

event_press

Returns TRUE when a controller entry has been pressed

✔️

✔️

event_release

Returns TRUE when a controller entry has been released

✔️

✔️

get_ival

Gets the input value of a button to check if it has been modified by the script.

✔️

get_paddle

Returns the current value of a paddle entry

✔️

get_brtime

Gets the time the input value has been 0

✔️

swap

Swaps the input values to be sent to the console temporarily

✔️

✔️

block

locks the input from being sent to the console for the specified time

✔️

✔️

sensitivity

Changes the input sensitivity

✔️

✔️

deadzone

Modifies the inner "deadzone", essentially pushes the starting value (when not 0) from the center by deadzone_x/deadzone_y or radius

✔️

✔️

stickize

Modifies outer deadzone, essentially forces the stick to not be further out than the radius from the inner point

✔️

✔️

ps4_touchpad

Returns detailed information on the DualShock 4 touchpad state

✔️

✔️

ps4_set_touchpad

Touches the DualShock 4 touchpad in a specific (X, Y) position

✔️

✔️

turn_off

Turns off a wireless controller connected to the input port

✔️

✔️

wiir_offscreen

Returns TRUE if the IR sensor on a Wiimote is off screen

✔️

✔️

get_val

get_val returns the current value of a controller entry in the form of an int. This value represents a percentage %.

GPC supports treating an int as a boolean value. This means get_val can be used to test whether a controller button, trigger or stick is being pressed or not. For example:

if(get_val(PS4_R1))

This conditional statement¹ would return TRUE if R1/RB has a value other than 0 (zero).

It can also be used to check for a specific value or value range². For example:

if(get_val(PS4_R2) > 50)

Would return TRUE if R2/RT was being pressed more than 50% of its total range.

Since get_val returns an int, the returned value can be stored in a variable, like so:

int myvar;
main {
myvar = get_val(XB1_LT);
}

🔴 Syntax

get_val ( <identifier> );

Parameters

<identifier> : the identifier of a controller entry.

🔵 Returns

The current value of the specified identifier. Can range from -100 to +100 depending on the entry type.

Notes:

¹A conditional statement is a set of rules performed if a certain condition is met. It is sometimes referred to as an If-Then statement, because IF a condition is met, THEN an action is performed.

²Buttons/Bumpers, Triggers and Sticks each have their own range of returned values. Buttons/Bumpers will return either 0 (not pressed) or 100 (pressed). Triggers will return a value range of 0 to 100, depending on whether a trigger is not pressed at all (0) or a percentage of how far the trigger is pulled. Sticks return a value that represents it’s position along an axis (X/Y). As such, the return range of a stick is -100 to 100.

get_lval

get_lval is similar to get_val with the exception that it returns the value of the specified identifier in the previous iteration (run) of the main loop. This value is also returned as a int and represents a percentage %.

However, get_lval gets its data from the input report so, unlike get_val, is not affected by any code before it. For example, if you were to use the set_valcommand to overwrite the output of an identifier, get_lval would still return the previous value of the identifier. You can see this in action by running the following command on your Cronus Zen and pressing the right trigger:

main {
set_val(XB1_RT, 0);
set_val(TRACE_1, get_lval(XB1_RT));
set_val(TRACE_2, get_val(XB1_RT));
}

🔴 Syntax

get_lval ( <identifier> );

Parameters

<identifier> : the identifier of a controller entry.

🔵 Returns

The previous value of the specified identifier. Can range from -100 to +100 depending on the entry type.

get_ptime

get_ptime returns the value in milliseconds of an identifiers state change in the form of a int. What this means is when an identifiers value changes from FALSE to TRUE or vice versa, the counter for get_ptimeon that identifier is reset to 0.

Therefore the clock is always running for this function so it should be used with another command, such as get_val.

For example, using get_ptime in an if statement on its own like the example below would give an undesired result as the statement would be TRUE if the button was pressed or not for greater than 200 milliseconds.

if (get_ptime(XB360_A) > 200)

Using get_ptime in combination with the command get_val would modify the statement to only return TRUE if the button had been pressed for longer than 200 milliseconds, as shown below;

if (get_val(XB360_A) && get_ptime(XB360_A) > 200)

🔴 Syntax

get_ptime ( <identifier> );

Parameters

<identifier> : the identifier of a controller entry.

🔵 Returns

The elapsed time of a controller entries state change. Value returned is in milliseconds with a range of 0 to 32 767

get_controller

get_controllerreturns a value in the form of a int which represents the controller type currently connected to the input port of the Cronus.

To save you from having to remember which value relates to the type of controller, the constants have been created.

Cronus Zen
CronusMax Plus
Cronus Zen

Constants

NAME

Description

VALUE

PIO_NONE

No Controller Connected

0

PIO_PS3

Playstation 3 Controller

1

PIO_XB360

XBOX 360 Controller

2

PIO_WII

WII Controller

3

PIO_PS4

Playstation 4 Controller

4

PIO_XB1

XBOX One Controller

5

CronusMax Plus

Constants

Name

Description

Value

PIO_PS3

Playstation 3 Controller

1

PIO_XB360

XBOX 360 Controller

2

PIO_WII

WII Controller

3

PIO_PS4

Playstation 4 Controller

4

PIO_XB1

XBOX One Controller

5

main {
if(get_controller() == PIO_XB1) { // if the connected device is an XB1
// controller, this will evaluate to TRUE
// and code inside will execute.
}
}

🔴 Syntax

get_controller();

Parameters

None

🔵 Returns

A value representing which type of controller is currently connected

get_battery

get_batteryreturns the battery level, if applicable, of the connected controller in the form on an int ranging from 0 to 11. With 0 being discharged, 10 being fully charged and 11 being charging.

If no battery is connected, for example a wired controller is connected, then it returns 10.

main {
if(get_battery() <= 2) {
}
}

🔴 Syntax

get_battery();

Parameters

None

🔵 Returns

A value ranging from 0 (Discharged) to 10 (Fully Charged) or 11 if charging

event_press

event_press returns TRUE in the main iteration when a control changes from FALSE to TRUE. Therefore, even if a button is pressed and held down, event_press would only return TRUE at the moment it is pressed and not while the button was held. This makes it perfect for combos you only wish to run once when a button is pressed.

For example, if you were playing a first person shooter, using a sniper rifle and you wanted the Cronus to automatically scope when you aimed down you sights. You could do this:

main {
if(event_press(XB1_LT)){
combo_run(scope_in);
}
}
combo scope_in {
wait(400);
set_val(XB1_RS, 100);
wait(200);
}

🔴 Syntax

event_press ( <identifier>);

Parameters

<identifier> : the identifier of a controller entry

🔵 Returns

Returns TRUE in the main iteration when a control value changes from FALSE to TRUE.

event_release

event_release is the opposite of event_press, it returns TRUE in the main iteration when a control changes from TRUE to FALSE. This makes it ideally suited to run code which you only want run once when a button is released.

For example, if you were playing a shooter game and wanted the gun to be automatically reloaded whenever you stopped shooting, you could do this;

main {
if(event_release(XB1_RT)){
combo_run(reload);
}
}
combo reload {
wait(200);
set_val(XB1_X, 100);
wait(200);
}

🔴 Syntax

event_release ( <identifier> );

Parameters

<identifier> : the identifier of a controller entry

get_ival

get_ival gets the input value of a button to check if it has been modified by the script.

main {
if(get_ival(XB1_A) && get_ptime(XB1_A) < 500){
set_val(XB1_UP,100);
}
}

get_paddle

get_paddle returns the current value of a paddle entry

main {
if(get_paddle(XB1_PR1)){
set_val(XB1_PR1,100);
}
}

get_brtime

get_brtime can be used to simplify double pressing a button like so;

main{
if (event_press(XB1_A) && get_brtime(XB1_A) < 300) {
/ Do something /
}
}

That would only trigger when XB1_A has been released less than 300ms (which would happen for a rapid press, release, press cycle)it's a companion to get_ptime which gets the press time... it works by checking how long it has been since the last time the button was last pressed (meaning, if used with event_release it would result in the timings being off from the point of releasing the button).

swap

swap does as the name implies, it swaps the values of two controller entries. This makes it useful for remapping buttons on the fly.

For example, if you were playing a shooter game which zooms the scope with a Right Stick Click when you Aim Down the Sights but you wished to move that function to the Right Bumper Button so it does not interfere with your aiming, you could do this:

main {
if(get_val(XB1_LT)) { // If LT / L2 is pressed...
swap(XB1_RS, XB1_RB); // Swap RS /R3 and RB / R2
}
}

With the above code, whenever LT / L2 is pressed, RB / R2 will press the Right Stick click and vice versa.

🔴 Syntax

swap ( <identifier1> , <identifier2> );

Parameters

<identifier1> : the identifier of a controller entry <identifier2> : the identifier of a controller entry

block

block prevents the forwarding of a controller entry for a set period of time which is set in milliseconds. This time can range from 20 to 4000 milliseconds. It it is extremely useful when you wish to get two uses from a single button. For example, if you were playing a platform game and wished for the CronusMAX PLUS to automatically perform a double jump for you if you held the button down, you could do this:

main {
if(get_val(XB1_A)){ // If A / Cross is held...
if(event_press(XB1_A)){ // When first pressed....
combo_run(single_jump); // Run combo single jump
}
block(XB1_A, 500); // Block the forwarding of A / Cross from the controller for 500 ms
}
}
combo single_jump {
set_val(XB1_A, 100);
wait(300);
}

The above code will run the combo single_jump as soon at the button is pressed. If the button is released within 500 milliseconds then there is no further output to the console. However, if the button is held for longer than 500 milliseconds then the normal output of that button resumes. Output with a quick tap of the button:

Output when the button is held;

🔴 Syntax

block ( <identifier> , <milliseconds> );

Parameters

<identifier> : the identifier of a controller entry <milliseconds> : Length of time in milliseconds to block forwarding for. Allowed range 20 ~ 4000

sensitivity

sensitivity adjusts the sensitivity of an analogue controller entry, usually this is an axis.

The function takes three parameters, the control to be modified, the midpoint and the sensitivity multiplier.

Midpoint sets the midpoint value of the controller entry. The default value is 50%. By changing this value, you are setting two sensitivity ranges. With a value lower than 50% a high senstivity range is created closer to the rest position and a low sensitivity range when far from the rest position. A value above 50% creates the opposite effect.

The Sensitivity multiplier is the amount the input vale is multiplied by. The parameter is passed in percentage. So 40 would mean multiply by 0.40, 100 means multiply by 1.00 and 140 means multiply by 1.40.

How these translate into the difference between the input into the CronusMAX PLUS and the output to the console can be seen below.

With a midpoint of 35% and a sensitivity of 100 using the command - sensitivity(XB1_LX, 35, 100);

With a midpoint of 70% and a sensitivity of 140 using the command - sensitivity(XB1_LX, 70, 140);

🔴 Syntax

sensitivity ( <identifier> , <midpoint> , <sensitivity> );

Parameters

<identifier> : the identifier of a controller entry <midpoint> : sets the midpoint value <sensitivity> : the ratio of the sensitivity adjustment

deadzone

deadzone adjusts the values of the output to alter the deadzone of two axis. The default deadzone programmed into consoles is 20%, this means a console will ignore any signal from an analogue stick which is below 20%. The CronusZEN can adjust the output signals relative to the input.

For example, if you wished to remove 10% of the deadzone, the CronusZEN will output and additional 10% on both axis with the command:

deadzone(XB1_LX, XB1_LY , 10, 10);

With the above command, a physical movement of 10% on the Left stick of either the Horizontal or Vertical Axis would output as 20%. An additional 10% is added to the output up until 90%. Any movement from 90% or greater will output 100%, as shown on the graph below:

The above code will create a square deadzone, that means 10% will be applied to both sticks at all times. However, the deadzone function can also be used to create a circular deadzone using the predefined constant, DZ_CIRLCE (which equals 101). When you use DZ_CIRCLE (or 101) in the third parameter instead of a value, the forth parameter then sets the radius of the circle instead of the value for the Y axis. Example when using the DZ_CIRCLE constant;

deadzone(XB1_LX, XB1_LY , DZ_CIRCLE , 10);

🔴 Syntax

deadzone ( <identifier_x> , <identifier_y> , <dzone_x> / DZ_CIRCLE , <dzone_y> / <radius> );

Parameters

<identifier_x> : a controller entry which represents an X axis <identifier_y> : a controller entry which represents a Y axis <dzone_x> / DZ_CIRCLE : X axis deadzone value / DZ_CIRCLE constant <dzone_y> / <radius> : Y axis deadzone value / The radius value of the circle

sticksize

stickize transforms the values of a Wiimote IR or mouse input to an analog stick. It does this by setting the radial output of the translation from their movements to the analogue stick, as shown in the diagram below;

Insert Diagram

As the PS3 has a square output for its analogue sticks, we recommend a value of 129 is used on that console. The Xbox 360, Xbox One and PS4 all use a radial output so we recommend a value of 113 is used on those consoles.

🔴 Syntax

stickize ( <identifier_x> , <identifier_y> , <radius> );

Parameters

<identifier_x> : a controller entry which represents an X axis <identifier_y> : a controller entry which represents a Y axis<radius> : The radius value of the circle.

ps4_touchpad

ps4_touchpad returns detailed information on the current state of the touchpad. Like get_val, it returns an int. ps4_touchpad can give you information on where two fingers are positioned on the touchpad and their X / Y coordinates. This is done via six constants;

PS4T_ Constant

Value

Returns

PS4T_P1

1

TRUE if at least one finger is on the touchpad, FALSE if none

PS4T_P1X

2

X axis value of the first finger on the touchpad

PS4T_P1Y

3

Y axis value of the first finger on the touchpad

PS4T_P2

16

TRUE if two fingers are on the touchpad, FALSE if less than two.

PS4T_P2X

32

X axis value of the second finger on the touchpad

PS4T_P2Y

48

Y axis value of the second finger on the touchpad

To get the value of a one of the above constants, simply use it in the ps4_touchpad parameter. For example, to read the state of all the constants, you could do this:

main {
if(ps4_touchpad(PS4T_P1)) { // If at least one finger is on touchpad...
set_val(TRACE_1, 1); // Set TRACE_1 to 1
set_val(TRACE_2, ps4_touchpad(PS4T_P1X)); // Set TRACE_2 to X coordinate of touchpoint 1
set_val(TRACE_3, ps4_touchpad(PS4T_P1Y)); // Set TRACE_3 to Y coordinate of touchpoint 1
} else { // If no fingers are on the touchpad...
set_val(TRACE_1, 0); // Set TRACE_1 to 0
}
if(ps4_touchpad(PS4T_P2)) { // If two fingers is on touchpad...
set_val(TRACE_4, 1); // Set TRACE_4 to 1
set_val(TRACE_5, ps4_touchpad(PS4T_P2X)); // Set TRACE_5 to X coordinate of touchpoint 2
set_val(TRACE_6, ps4_touchpad(PS4T_P2Y)); // Set TRACE_6 to Y coordinate of touchpoint 2
} else { // If less than two fingers on the touchpad...
set_val(TRACE_4, 0); // Set TRACE_4 to 0
}
}

🔴 Syntax

ps4_touchpad ( <PS4T_constant> );

Parameters

<PS4T_constant> : A constant from the table above

🔵 Returns

An int value related to the PS4T_ constant used

ps4_set_touchpad

ps4_set_touchpad will touch the DualShock 4 touchpad in a specific (X, Y) position.

🔴 Syntax

ps4_set_touchpad ( <X Value>, <Y Value> )

Parameters

<X Value> : X position in the DualShock 4 touchpad, ranging from -100 to 100.<Y Value> : Y position in the DualShock 4 touchpad, ranging from -100 to 100.

🔵 Returns

None

combo Touch_And_Click_DS4Touchpad {
ps4_set_touchpad(90, 45);
set_val(PS4_TOUCH, 100);
wait(80);
}

turn_off

turn_off will switch off a wireless controller connected to the CronusZEN input port. Example of usage:

main {
if(event_press(XB1_RS)) { // If RS / R3 is pressed...
turn_off(); // Turn off wireless controller
}
}

🔴 Syntax

turn_off ( );

Parameters

None

wiir_offscreen

wii_offscreen checks to see if the Wiimote controller is pointing off screen.

Example of usage:

main {
if(wii_offscreen()) {
// Do Something
}
}

🔴 Syntax

wii_offscreen ( );

Parameters

None

🔵 Returns

TRUE if the Wiimote IR is pointing off screen, FALSE if it is not