I/O Functions
In GPC scripting language, input/output (I/O) refers to the communication between the Titan One device and the "outside world". In our case, Inputs are the data coming from controller, and outputs are the data send to console. Each controller entry (buttons, analog sticks, sensors) has an data structure that stores its state information, such as current value, previous value and the elapsed time of activation. The I/O functions are mainly intended to read and write on this data structure.
Related GPC Functions:
1. get_val
Returns the current value of a controller entry.
Prototype:
int get_val ( <identifier> )
Parameters:
Return:
Current value of the controller entry specified by identifier, can range from -100 to 100, depending on entry type
Example:
2. set_val
Overwrite the current value of a controller entry.
Prototype:
set_val ( <identifier>, <value> )
Parameters:
<value> : the value to be written, can range from -100 to 100, depending on entry type
Return:
None
Example:
3. get_lval
Returns the previous value of a controller entry.
Prototype:
int get_lval ( <identifier> )
Parameters:
Return:
Previous value of the controller entry specified by identifier, can range from -100 to 100, depending on entry type
Example:
4. get_ptime
Returns the elapsed activation time (pressing) of a controller entry.
Prototype:
int get_ptime ( <identifier> )
Parameters:
Return:
The elapsed time of activation, e.g.: when the controller entry goes out of its rest position. The value is expressed in milliseconds and, due to hardware limitations, the maximum registered time is 4000 ms (4 seconds).
Example:
5. event_press
Returns TRUE when detected an activation event (pressing) of a controller entry.
Prototype:
int event_press ( <identifier> )
Parameters:
Return:
TRUE on the interaction that the specified controller entry gets out of its resting position; FALSE otherwise.
Example:
6. event_release
Returns TRUE when detected a deactivation event (releasing) of a controller entry.
Prototype:
int event_release ( <identifier> )
Parameters:
Return:
TRUE on the interaction that the specified controller entry returns to its resting position; FALSE otherwise.
Example:
7. swap
Swap the values between two controller entries.
Prototype:
swap ( <identifier1>, <identifier2> )
Parameters:
Return:
None
Example:
8. block
Blocks forwarding of a controller entry for a short period of time. Useful to assign two functions to a single button, where a quick button press can shoot some function in your GPC script, and a longer pressing maintain the original purpose of the button.
Prototype:
block ( <identifier>, <time> )
Parameters:
<time> : amount of time in milliseconds, allowed range from 20 to 4000 ms
Return:
None
Example:
9. sensitivity
Adjust the sensitivity of a controller entry.
Prototype:
sensitivity ( <identifier>, <midpoint>, <sensitivity> )
Parameters:
<midpoint> : change the midpoint value of an entry, e.g.: the default midpoint is 50%, if you change it to 35 you are defining two sensitivity ranges, a high sensitivity range (close to rest position) and a low sensitivity range (when far from rest position), as shown in the figure below:
If you configure this parameter with 80 you are defining a zone of low sensitivity when close to the rest position (better accuracy), and a zone of high sensitivity when far from rest position (fast movements).
<sensitivity>: angular adjustment, the value is multiplied to the current value of specified entry. 100 means multiply for 1, 143 means multiply for 1.43, 72 means multiply for 0.72
Return:
None
Example:
10. deadzone
Removes the deadzone of a pair of entries, usually of analog sticks.
Prototype:
deadzone ( <identifierX>, <identifierY>, <xdz_cir>, <ydz_rad> )
Parameters:
<xdz_cir> : X axis deadzone value or the DZ_CIRCLE constant
<ydz_rad> : Y axis deadzone value or the radius value of the circle
Return:
None
Example:
11. stickize
Transforms the values of a mouse input (or Wiimote IR) to analog stick.
Prototype:
stickize ( <identifierX>, <identifierY>, <radius> )
Parameters:
<radius> : the radius of the circle, as showed in the picture above. Allowed values range from 100 to 141. We suggest using 129 for PS3 and 113 for XBox 360
Return:
None
Example:
12. Identifiers
|