R3vo/Sandbox1 – User

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Blanked the page)
Tag: Blanking
mNo edit summary
Line 1: Line 1:
{{TOC|side}}
__NOEDITSECTION__
'''Magic variables''' are engine-maintained [[Variables|variables]] that serve a specific purpose within a given scope and are often used by the engine to push data to a given [[Script File|script]] or [[Code|code]] fragment.<br>They are usually no longer present after leaving the scope (e.g. after code execution or after a [[forEach]] statement).


{| class="wikitable sortable"
|-
! Variable !! Description !! Data Types !! Used In !! Introduced With
|-
| thisTrigger
|
Refers to the [[Triggers|trigger]] object itself - accessible within the '''Condition''', '''On Activation''' or '''On Deactivation''' script.
|
[[Object]]
|
[[Trigger]]s
| -
|-
|
thisList
|
"[[Variables|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 [[Object]]s
|
[[Trigger]]s & [[Waypoint]]s
| -
|-
|
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 [[Mission Editor: Triggers|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)"
|
See description.
|
[[Object]] or [[Boolean]]
|
-
|-
|
_y
|
Iterating over a [[HashMap]] with [[forEach]] will return the key as [[#x|_x]] and the value as [[#y|_y]].
|
[[Anything]]
|
See description
|
{{GVI|arma3|2.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 [[Object]]s
|
commandFSM
doFSM
onDoubleClick
onMapSingleClick
|
-
|-
|
_topic
|
?
|
?
|
[[kbAddTopic]]
|
-
|-
|
_to
|
?
|
?
|
kbAddTopic
onTeamSwitch
|
-
|-
|
_time
|
'''[[SQS Syntax|SQS]] ONLY.''' The time elapsed since the script started running.
|
[[Number]]
|
In SQS scripts.
|
-
|-
|
_thisScript
|
The [[execVM]]ed, [[call]]ed or [[spawn]]ed [[Script Handle|script handle]] from within itself.
|
[[Script Handle]]
|
See description.
|
-
|-
|
_thisFSM
|
The [[FSM]] id for FSMs executed with [[execFSM]].
|
[[Number]]
|
[[execFSM]]
|
{{GVI|arma3|1.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
|
{{GVI|arma3|2.06}}
|-
|
_thisArgs
|
Additional Event Handler arguments available with [[addMissionEventHandler]]
|
[[String]]
|
addMissionEventHandler
|
{{GVI|arma3|1.54}}
|-
|
_thisArgs
|
Additional Event Handler arguments available with [[addMissionEventHandler]]
|
[[String]]
|
addMissionEventHandler
|
{{GVI|arma3|1.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"
|
{{GVI|arma3|1.54}}
|-
|
_target
|
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.
|
?
|
" addAction
commandFSM
doFSM"
|
?
|-
|
_shift
|
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.
|
?
|
onDoubleClick
onMapSingleClick
|
?
|-
|
_sentenceId
|
|
?
|
kbAddTopic
|
?
|-
|
_pos
|
|
?
|
onDoubleClick
onMapSingleClick
onShowNewObject
|
?
|-
|
_owner
|
|
?
|
onPlayerDisconnected
onPlayerConnected
|
?
|-
|
_new
|
|
?
|
 addEditorObject
|
?
|-
|
_name
|
|
?
|
onPlayerDisconnected
onPlayerConnected
|
?
|-
|
_leader
|
|
?
|
commandFSM
doFSM
|
?
|-
|
_jip
|
|
?
|
onPlayerDisconnected
onPlayerConnected
|
?
|-
|
_isSelected
|
|
?
|
 onHCGroupSelectionChanged
|
?
|-
|
_isHighCommand
|
|
?
|
onCommandModeChanged
|
?
|-
|
_id
|
|
?
|
onPlayerDisconnected
|
?
|-
|
_group
|
|
?
|
onHCGroupSelectionChanged
|
?
|-
|
_from
|
|
?
|
kbAddTopic
onTeamSwitch
|
?
|-
|
_forEachIndex
|
Represents the (zero-based) index of a [[forEach]] [[#x|_x]] element.
|
?
|
[[forEach]]
|
?
|-
|
_fnc_scriptNameParent
|
{{Feature|Informative|not engine-maintained, but added by functions_f/'''initFunctions.sqf''' script – see [[scriptName]]}}
From within a [[:Category:Functions|Function]], name of the function that called the current one ([[#fnc_scriptName|_fnc_scriptName]] used when not defined)
|
?
|
-
|
?
|-
|
_fnc_scriptName
|
{{Feature|Informative|not engine-maintained, but added by functions_f/'''initFunctions.sqf''' script – see [[scriptName]]}} From within a [[:Category:Functions|Function]], the '''TAG_fnc_functionName''' function name as string (e.g. "myTag_fnc_myFunction")
|
?
|
-
|
?
|-
|
_exception
|
[[Exception handling]] using a [[try]]-[[catch]] statement declares this variable which contains details about the [[throw|thrown]] exception in the try block.
|
?
|
[[try]]-[[catch]]
|
?
|-
|
_destination
|
[[Exception handling]] using a [[try]]-[[catch]] statement declares this variable which contains details about the [[throw|thrown]] exception in the try block.
|
?
|
commandFSM
doFSM
|
?
|-
|
_alt
|
True or false depending on whether ALT Key was pressed
|
[[Boolean]]
|
onDoubleClick
onMapSingleClick
|
?
|-
|
 _uid
|
?
|
[[String]]
|
onPlayerDisconnected
onPlayerConnected
|
?
|}
[[Category: Scripting Topics]]

Revision as of 13:26, 14 November 2021

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)"

See description.

Object or Boolean

-

_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

String

addMissionEventHandler

Arma 3 logo black.png1.54

_thisArgs

Additional Event Handler arguments available with addMissionEventHandler

String

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

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.

?

" addAction

commandFSM
doFSM"


?

_shift

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.

?

onDoubleClick

onMapSingleClick

?

_sentenceId

?

kbAddTopic

?

_pos


?

onDoubleClick
onMapSingleClick
onShowNewObject

?

_owner


?

onPlayerDisconnected

onPlayerConnected

?

_new

?

 addEditorObject

?

_name

?

onPlayerDisconnected
onPlayerConnected

?

_leader

?

commandFSM

doFSM

?

_jip

?

onPlayerDisconnected

onPlayerConnected

?

_isSelected


?

 onHCGroupSelectionChanged

?

_isHighCommand


?

onCommandModeChanged

?

_id



?

onPlayerDisconnected

?

_group

?

onHCGroupSelectionChanged

?

_from

?

kbAddTopic
onTeamSwitch

?

_forEachIndex

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

?

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)

?

-

?

_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")

?

-

?

_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

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

?

commandFSM
doFSM

?

_alt

True or false depending on whether ALT Key was pressed

Boolean

onDoubleClick

onMapSingleClick

?

 _uid

?

String

onPlayerDisconnected

onPlayerConnected

?