R3vo/Sandbox1 – User
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. | - | ||
| thisList | "Variable defined by Triggers and Waypoints: 
 | - | ||
| this | 
 | See description. | - | |
| _y | Iterating over a HashMap with forEach will return the key as _x and the value as _y. | See description | ||
| _x | Represents the current element during a loop with: apply, count, configClasses, configProperties, findIf, forEach, select. | apply, count, configClasses, configProperties, findIf, forEach, select | - | |
| _units | ? | commandFSM doFSM onDoubleClick onMapSingleClick | - | |
| _topic | ? | ? | - | |
| _to | ? | ? | kbAddTopic onTeamSwitch | - | 
| _time | SQS ONLY. The time elapsed since the script started running. | In SQS scripts. | - | |
| _thisScript | The execVMed, called or spawned script handle from within itself. | See description. | - | |
| _thisFSM | ||||
| _thisEventHandler | The index for Event Handlers added with addEventHandler, addMPEventHandler or addMissionEventHandler. | addEventHandler addMissionEventHandler addMPEventHandler | ? | |
| _thisEvent | The name of the Event added with addEventHandler, addMPEventHandler or addMissionEventHandler as well as for config types EHs. | addEventHandler addMissionEventHandler addMPEventHandler | ||
| _thisArgs | Additional Event Handler arguments available with addMissionEventHandler | addMissionEventHandler | ||
| _thisArgs | Additional Event Handler arguments available with addMissionEventHandler | addMissionEventHandler | ||
| _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. | "addAction addEventHandler addMissionEventHandler addMPEventHandler addMusicEventHandler addPublicVariableEventHandler call ctrlAddEventHandler ctrlSetEventHandler displayAddEventHandler displaySetEventHandler editorSetEventHandler exec execFSM execVM inGameUISetEventHandler kbAddTopic onGroupIconClick setMusicEventHandler spawn try" | ||
| _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 | ? | ? | ||
| _fnc_scriptNameParent | From within a Function, name of the function that called the current one (_fnc_scriptName used when not defined) | ? | - | ? | 
| _fnc_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. | ? | ? | |
| _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 | onDoubleClick onMapSingleClick | ? | |
| _uid | ? | onPlayerDisconnected onPlayerConnected | ? | 
 
	