For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

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.

Code-Snippet

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 range:

Code-Snippet

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

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.


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. Unlike get_val, it is not affected by any code before it.

Code-Snippet

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. When an identifiers value changes from FALSE to TRUE or vice versa, the counter is reset to 0.

Code-Snippet

Syntax

get_ptime ( <identifier> );

Parameters

<identifier> : the identifier of a controller entry.

Returns

The elapsed time of a controller entry state changes in milliseconds (0 to 32767).


get_controller

get_controller returns an int which represents the controller type currently connected.

Code-Snippet

Syntax

get_controller();

Parameters

None

Returns

A value representing which type of controller is currently connected.


get_battery

get_battery returns the battery level ranging from 0 to 11. 0 is discharged, 10 is fully charged, and 11 is charging.

Code-Snippet

Syntax

get_battery();

Parameters

None

Returns

0 (Discharged) to 10 (Fully Charged) or 11 (Charging).


event_press

event_press returns TRUE in the main iteration when a control changes from FALSE to TRUE.

Code-Snippet

Syntax

event_press ( <identifier> );

Parameters

<identifier> : the identifier of a controller entry.

Returns

TRUE at the moment of pressing.


event_release

event_release returns TRUE when a control changes from TRUE to FALSE.

Code-Snippet

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.

Code-Snippet


get_brtime

get_brtime checks how long it has been since the button was last released.

Code-Snippet


swap

swap swaps the values of two controller entries.

Code-Snippet

Syntax

swap ( <identifier1> , <identifier2> );


block

block prevents forwarding for a set time (20 to 4000 ms).

Code-Snippet

Syntax

block ( <identifier> , <milliseconds> );


get_adt (Adaptive Triggers)

get_adt returns values for PS5 adaptive triggers.

Code-Snippet

Syntax

get_adt ( <trigger>, <identifier> );


set_adt

set_adt sets values (0-255) for adaptive trigger identifiers.

Code-Snippet

Syntax

set_adt ( <trigger>, <identifier>, <value> );

Last updated