Core Controller Functions
Function Name
Description
Zen
Plus
Returns the current value of a controller entry
✔️
✔️
Returns the previous value of a controller entry
✔️
✔️
Returns the elapsed time of a controller entries state change
✔️
✔️
Returns the type of controller currently connected to the input port
✔️
✔️
Returns the current status of the battery for a wireless controller
✔️
✔️
Returns TRUE when a controller entry has been pressed
✔️
✔️
Returns TRUE when a controller entry has been released
✔️
✔️
Gets the input value of a button to check if it has been modified by the script.
✔️
❌
Gets the time the input value has been 0
✔️
❌
Swaps the input values to be sent to the console temporarily
✔️
✔️
locks the input from being sent to the console for the specified time
✔️
✔️
Changes the input sensitivity
✔️
✔️
Modifies the inner "deadzone", essentially pushes the starting value (when not 0) from the center by deadzone_x/deadzone_y or radius
✔️
✔️
Modifies outer deadzone, essentially forces the stick to not be further out than the radius from the inner point
✔️
✔️
Returns detailed information on the DualShock 4 touchpad state
✔️
✔️
Touches the DualShock 4 touchpad in a specific (X, Y) position
✔️
✔️
Turns off a wireless controller connected to the input port
✔️
✔️
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:
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:
get_val ( <identifier> );
<identifier> : the identifier of a controller entry.
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_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:
get_lval ( <identifier> );
<identifier> : the identifier of a controller entry.
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_ptime
on 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;
get_ptime ( <identifier> );
<identifier> : the identifier of a controller entry.
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_controller
returns 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.
get_controller();
None
A value representing which type of controller is currently connected
get_battery
get_battery
returns 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.
get_battery();
None
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:
event_press ( <identifier>);
<identifier> : the identifier of a controller entry
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;
event_release ( <identifier> );
<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.
get_brtime
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
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:
With the above code, whenever LT / L2 is pressed, RB / R2 will press the Right Stick click and vice versa.
swap ( <identifier1> , <identifier2> );
<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:
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;
block ( <identifier> , <milliseconds> );
<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);
sensitivity ( <identifier> , <midpoint> , <sensitivity> );
<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:
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 ( <identifier_x> , <identifier_y> , <dzone_x> / DZ_CIRCLE , <dzone_y> / <radius> );
<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 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.
stickize ( <identifier_x> , <identifier_y> , <radius> );
<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:
ps4_touchpad ( <PS4T_constant> );
<PS4T_constant> : A constant from the table above
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.
ps4_set_touchpad ( <X Value>, <Y Value> )
<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.
None
turn_off
turn_off
will switch off a wireless controller connected to the CronusZEN input port. Example of usage:
turn_off ( );
None
wiir_offscreen
wii_offscreen
checks to see if the Wiimote controller is pointing off screen.
Example of usage:
wii_offscreen ( );
None
TRUE if the Wiimote IR is pointing off screen, FALSE if it is not
Last updated