R3vo/Sandbox1 – User

From Bohemia Interactive Community
< User:R3vo
Revision as of 13:42, 14 November 2021 by R3vo (talk | contribs)
Jump to navigation Jump to search

Magic variables are engine-maintained variables that serve a specific purpose within a given scope and are often used by the engine to push data to a given script or code fragment.
They are usually no longer present after leaving the scope (e.g. after code execution or after a forEach statement).

Variable Description Data Types Used In Introduced With
thisTrigger

Refers to the trigger object itself - accessible within the Condition, On Activation or On Deactivation script.

Object

Triggers

-

thisList

"Variable defined by Triggers and Waypoints:

  • Triggers:
    • accessible within the Condition, On Activation or On Deactivation script
    • defines an array of objects that have been detected by the trigger (same as what is returned by the list command)
    • thisList in a trigger's On Deactivation field seems to be undefined, and should not be used. It will either return an empty array, or possibly the contents of a different trigger.
  • Waypoints:
    • accessible within the Condition or On Activation script
    • defines an array containing all group members that completed the respective waypoint"

Array of Objects

Triggers & Waypoints

-

this

  • In Addons' config files (e.g. UserActions, onInit, etc.): The object to which the entry belongs
  • In Dialogs: The player unit that activated control (e.g. via mouseEnter). false if non-activated
  • In Object's ""Init"" line: The object to which the init line belongs
  • In Triggers
    • ""Condition"" line: The Boolean return value of the trigger's conditions (e.g. ""East Not Present"" etc)
    • ""On Activation/Deactivation"" line: Seems to always return false
  • In Waypoints
    • ""Condition"" or ""On Activation/Deactivation"" line: The group leader that completed the respective waypoint (or driver, if waypoint is assigned to a vehicle)"

Object or Boolean

See description.

-

_y

Iterating over a HashMap with forEach will return the key as _x and the value as _y.

Anything

See description.

Arma 3 logo black.png2.02

_x

Represents the current element during a loop with: apply, count, configClasses, configProperties, findIf, forEach, select.

Anything

apply, count, configClasses, configProperties, findIf, forEach, select

-

_units

?

Array of Objects

commandFSM, doFSM, onDoubleClick, onMapSingleClick

-

_topic

?

?

kbAddTopic

-

_to

?

?

kbAddTopic, onTeamSwitch

-

_time

SQS ONLY. The time elapsed since the script started running.

Number

In SQS scripts.

-

_thisScript

The execVMed, called or spawned script handle from within itself.

Script Handle

See description.

-

_thisFSM

The FSM id for FSMs executed with execFSM.

Number

execFSM

Arma 3 logo black.png1.54

_thisEventHandler

The index for Event Handlers added with addEventHandler, addMPEventHandler or addMissionEventHandler.

Number

addEventHandler, addMissionEventHandler, addMPEventHandler

?

_thisEvent

The name of the Event added with addEventHandler, addMPEventHandler or addMissionEventHandler as well as for config types EHs.

String

addEventHandler, addMissionEventHandler, addMPEventHandler

Arma 3 logo black.png2.06

_thisArgs

Additional event handler arguments available with addMissionEventHandler.

Array

addMissionEventHandler

Arma 3 logo black.png1.54

_this

Is used to make arguments of a script call (call, exec, execVM, spawn) visible and accessible to the script, also used in Event Handlers to pass appropriate params.

String

addAction, addEventHandler, addMissionEventHandler, addMPEventHandler, addMusicEventHandler, addPublicVariableEventHandler, call, ctrlAddEventHandler, ctrlSetEventHandler, displayAddEventHandler, displaySetEventHandler, editorSetEventHandler, exec, execFSM, execVM, inGameUISetEventHandler, kbAddTopic, onGroupIconClick, setMusicEventHandler, spawn, try

Arma 3 logo black.png1.54

_target

?

?

addAction, commandFSM, doFSM

?

_shift

?

?

onDoubleClick, onMapSingleClick

?

_sentenceId

?

?

kbAddTopic

?

_pos

?

?

onDoubleClick, onMapSingleClick, onShowNewObject

?

_owner

?

?

onPlayerDisconnected, onPlayerConnected

?

_new

Contains the newly created object. Old 3D-Editor only.

Object

addEditorObject

?

_name

?

?

onPlayerDisconnected, onPlayerConnected

?

_leader

?

?

commandFSM, doFSM

?

_jip

?

?

onPlayerDisconnected, onPlayerConnected

?

_isSelected

?

?

onHCGroupSelectionChanged

?

_isHighCommand

Returns true if player is in high command.

Boolean

onCommandModeChanged

?

_id

?

?

onPlayerDisconnected

?

_group

Contains the newly selected group.

Group

onHCGroupSelectionChanged

?

_from

?

?

kbAddTopic, onTeamSwitch

?

_forEachIndex

Represents the (zero-based) index of a forEach _x element.

Number

forEach

?

_fnc_scriptNameParent

not engine-maintained, but added by functions_f/initFunctions.sqf script – see scriptName

From within a Function, name of the function that called the current one (_fnc_scriptName used when not defined)

String

-

?

_fnc_scriptName

not engine-maintained, but added by functions_f/initFunctions.sqf script – see scriptName
From within a Function, the TAG_fnc_functionName function name as string (e.g. "myTag_fnc_myFunction")

String

-

?

_exception

Exception handling using a try-catch statement declares this variable which contains details about the thrown exception in the try block.

?

try-catch

?

_destination

?

?

commandFSM, doFSM

?

_alt

True or false depending on whether ALT Key was pressed

Boolean

onDoubleClick, onMapSingleClick

?

_uid

User ID of leaving player.

String

onPlayerDisconnected, onPlayerConnected

?