Core Controller Functions
Function Name | Description |
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_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", and 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_adt | Returns the current value of an adaptive trigger entry. |
set_adt | Sets the value of an adaptive trigger entry. |
adt_off | Turns off an adaptive trigger. This will also reset any modifications done using set_adt. |
adt_cmp | Compares raw ADT data with an array that is used with addr. |
addr | Returns an offset rather than value. |
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:
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:
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:
🔴 Syntax
⚪ 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:
Info: ¹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.
Info: ²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 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 an 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_val command 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:
🔴 Syntax
⚪ 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 returns the value in milliseconds of an identifiers state change in the form of an 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.
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;
🔴 Syntax
⚪ Parameters
<identifier> : the identifier of a controller entry.
🔵 Returns
The elapsed time of a controller entry state changes. The value returned is in milliseconds with a range of 0 to 32767
get_controller returns a value in the form of an 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.
🔴 Syntax
⚪ Parameters
None
🔵 Returns
A value representing which type of controller is currently connected
get_battery returns the battery level, if applicable, of the connected controller in the form of 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.
🔴 Syntax
⚪ Parameters
None
🔵 Returns
A value ranging from 0 (Discharged) to 10 (Fully Charged) or 11 if charging
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 your sights. You could do this:
🔴 Syntax
⚪ Parameters
<identifier> : the identifier of a controller entry
🔵 Returns
Returns TRUE in the main iteration when a control value changes from FALSE to TRUE.
Main Section
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 that you only want to 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;
🔴 Syntax
⚪ Parameters
<identifier> : the identifier of a controller entry
get_ival gets the input value of a button to check if it has been modified by the script.
get_brtime can be used to simplify double pressing a button like so;
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 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 that 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:
With the above code, whenever LT / L2 is pressed, RB / R2 will press the Right Stick click and vice versa.
🔴 Syntax
⚪ Parameters
<identifier1> : the identifier of a controller entry
<identifier2> : the identifier of a controller entry
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 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 Cronus Zen to automatically perform a double jump for you if you held the button down, you could do this:
The above code will run the combo single_jump as soon as 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
⚪ Parameters
<identifier> : the identifier of a controller entry
<milliseconds> : Length of time in milliseconds to block forwarding for.
Allowed range 20 ~ 4000
sensitivity adjusts the sensitivity of an analog 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 sensitivity 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 value 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 Cronus Zen 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 adjusts the values of the output to alter the deadzone of two axis. The default deadzone programmed into consoles is 20%, which means a console will ignore any signal from an analog stick that 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 an additional 10% on both axis with the command:
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, which means 10% will be applied to Left Stick 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;
🔴 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
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 the PS3 has a square output for its analog 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 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 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:
🔴 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 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
turn_off will switch off a wireless controller connected to the CronusZEN input port. Example of usage:
🔴 Syntax
turn_off ( );
⚪ Parameters
None
wii_offscreen checks to see if the Wiimote controller is pointing off screen. Example of usage:
🔴 Syntax
wii_offscreen ( );
⚪ Parameters
None
🔵 Returns
TRUE if the Wiimote IR is pointing off screen, FALSE if it is not
get_adt returns the current value of an adaptive trigger entry. The raw values can also be viewed in Device Monitor by clicking Toggle PS5 ADT on the bottom right of the Device Monitor window. get_adt can be used to assign a value to the following.
- PS5_ADT_MODE (Can be viewed in Device Monitor)
- PS5_ADT_NR
- PS5_ADT_CR
- PS5_ADT_SR
- PS5_ADT_EF1
- PS5_ADT_EF2
- PS5_ADT_OFF
- PS5_ADT_START (Can be viewed in Device Monitor)
- PS5_ADT_FORCE1 (Can be viewed in Device Monitor)
- PS5_ADT_FORCE2 (Can be viewed in Device Monitor)
- PS5_ADT_STRENGTH_LOW (Can be viewed in Device Monitor)
- PS5_ADT_STRENGTH_MID (Can be viewed in Device Monitor)
- PS5_ADT_STRENGTH_HIGH (Can be viewed in Device Monitor)
- PS5_ADT_FREQ (Can be viewed in Device Monitor) As seen above not all entries can be viewed in Device Monitor although entries that can have a more substantial impact are visible. Example Useage:
This conditional statement¹ would return TRUE if R2 has a value of 0x26. This is a common value that R2 has when firing a weapon in most shooters such as MWIII It can also be used to check for a specific value or value range². For example:
Would return TRUE if R2 has a value other than 0 (zero). However, it is not recommended to do this when reading PS5_ADT_MODE as you will notice a value of 0x05 will be present if connected to a PS5 console when powered on and most shooters such as MWIII will also report a value of 0x25 when R2 is not being pressed. Below is an example for MWIII where if R2 is not held TRACE_1 is set to 1. Whereas if R2 is held TRACE_2 is set to 2:
🔴 Syntax
⚪ Parameters
<trigger> : Adaptive trigger can be either PS5_L2 or PS5_R2.
<identifier> : the identifier of an adaptive trigger.
🔵 Returns
The current value of the specified identifier. Can range from 0 to +255 depending on the entry type.
Notes:
Info: If is important to note for get_adt to function correctly you will need Adaptive Trigger support enabled in the game being played. This option can go by a few different names such as Adaptive Triggers, Full Haptics etc
set_adt can set a value of 0 to 255 to any adaptive trigger identifier covered in get_adt. Values to an Adaptive Trigger will override the rumble feeling felt from a game. An example can be seen below where both triggers have all aspects of the trigger set to 0. This can be useful if you need to read adt data from a game but would like to prevent the Adaptive Triggers from being psychically felt.
🔴 Syntax
⚪ Parameters
<trigger> : Adaptive trigger can be either PS5_L2 or PS5_R2.
<identifier> : the identifier of a controller entry.
🔵 Sets
Set the output value an an Adaptive Triggger.
adt_off can be used to turn off the adaptive triggers. This will also reset both triggers to their default state. The function can be helpful in clearing the effects done to the adaptive triggers using set_adt