Functions Reference - TheCodeNugget/Arma3-PiShock GitHub Wiki

Introduction

These in-game functions allow easier usage of the extensions, since this mod is intended for local use, Authentication data for PiShock is stored in CBA settings which are accessed by these functions. This allows calling the API with just the Intensity and Duration info.

Functions

NUG_fnc_shock

Sends a shock request to the arma3_pishock extension.

[Intensity, Duration] call NUG_fnc_shock;

NUG_fnc_vibrate

Sends a vibrate request to the arma3_pishock extension.

[Intensity, Duration] call NUG_fnc_vibrate;

NUG_fnc_beep

Sends a beep request to the arma3_pishock extension.

[Duration] call NUG_fnc_beep;

Checks

All functions perform the 4 following checks to ensure safety and consent.

Consent Check

Checks if the function was executed with remoteExec and if the client running the function Allows Remote Commands If unauthorized remoteExecution is detected a BIS_fnc_error is called with the steamID of the caller for reporting purposes.

Killswitch Check

A killswitch keybind is implemented to the mod, All executions are prevented while killswitch is off.

Intensity and Duration checks

Checks if the given parameters are within allowed ranges a BIS_fnc_error is called if the values are out of range.

Cooldown Checks

Cooldowns can be set globally or on command basis, this checks if the enough time has passed since the last command.

Variables

A list of variables are attached to the client to keep track of eventHandlers and Cooldown Timings.

Variable Description
NUG_lastShockTime Records timestamp of the last shock.
NUG_lastVibrateTime Records timestamp of the last vibration.
NUG_lastBeepTime Records timestamp of the last beep.
NUG_shockEHIndex Index of the shock EH.
NUG_shockEHType Type of the shock EH
NUG_vibrateEHIndex Index of the vibrate EH.
NUG_vibrateEHType Type of the vibrate EH
NUG_beepEHIndex Index of the beep EH.
NUG_beepEHType Type of the beep EH.
NUG_debugEHIndex Index of the Response Display EH.

CBA Settings

CBA Settings can be accessed with the following handles.

PiShock Settings

Handle Type Description
NUG_piShock_enable Bool Main enable for piShock.
NUG_allow_remoteExec Bool Enables remoteExecution.
NUG_userName String PiShock Username.
NUG_shareCode String PiShock ShareCode.
NUG_APIKEY String PiShock API Key.
NUG_global_cooldown Integer Global cooldown for PiShock commands.

Shock Settings

Handle Type Description
NUG_shock_enabled Bool Enable for shock commands.
NUG_shock_handler Bool EventHandler for shocks.
NUG_shock_intensity Integer Intensity of the shock.
NUG_shock_duration Integer Duration of the shock.
NUG_shock_cooldown Integer Cooldown for shock commands.

Vibration Settings

Handle Type Description
NUG_vibrate_enabled Bool Enable for vibration commands.
NUG_vibrate_handler Bool EventHandler for vibrations.
NUG_vibrate_intensity Integer Intensity of the vibration.
NUG_vibrate_duration Integer Duration of the vibration.
NUG_vibrate_cooldown Integer Cooldown for vibration commands.

Beep Settings

Handle Type Description
NUG_beep_enabled Bool Enable for beep commands.
NUG_beep_handler Bool EventHandler for beeps.
NUG_beep_duration Integer Duration of the beep.
NUG_beep_cooldown Integer Cooldown for beep commands.

Debug Settings

Handle Type Description
NUG_response_display Bool Enable for response display.

Internal Functions

The following functions were created for internal use only, as such will not be documented at this time.

  • NUG_fnc_shockEH_handler

  • NUG_fnc_vibrateEH_handler

  • NUG_fnc_beepEH_handler

  • NUG_fnc_APIResponseDisplay_handler

  • NUG_fnc_killswitch_handler

  • NUG_fnc_allowRE_handler