vehicleVarName: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(48 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= arma1
|version1= 1.00


|1.00|= Game version
|game2= arma2
|version2= 1.00


|arg= global |=  
|game3= arma2oa
|version3= 1.50


|eff= local |= Effects in MP
|game4= tkoh
____________________________________________________________________________________________
|version4= 1.00


| Returns the name of the variable which contains a primary editor reference to this object. This is the variable given in the Insert Unit dialog / name field, in the editor. It can be changed using [[setVehicleVarName]]. <br>
|game5= arma3
If ''object'' refers to a vehicle that wasn't given a name in the editor, the return value is an empty string, "".
|version5= 0.50
<br>Since it is possible to [[setVehicleVarName]] individually on each PC, the value of [[vehicleVarName]] returned will be [[local]] to the PC on which command is executed. |= Description
____________________________________________________________________________________________


| '''vehicleVarName''' object |= Syntax
|arg= global


|p1= object: [[Object]] |= Parameter 1
|gr1= Object Manipulation


| [[String]] |= Return value
|descr= Returns the variable name that contains a primary editor reference to this object. This is the variable given in the ''Insert Unit dialog / name field'' in the editor. It can be changed using [[setVehicleVarName]].
____________________________________________________________________________________________
 
|x1= <code>[[hint]] [[vehicleVarName]] [[player]];</code> |= Example 1


{{Feature|informative|Respawned unit will have the same vehicleVarName as the corpse left behind, however actual [[missionNamespace]] variable of the same name will only contain respawned unit.}}


| [[setVehicleVarName]] |= See also
|s1= [[vehicleVarName]] object


}}
|p1= object: [[Object]]


<h3 style="display:none">Notes</h3>
|r1= [[String]] - variable name, if none was set, an empty string is returned
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x1= <sqf>hint vehicleVarName player;</sqf>
</dl>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[setVehicleVarName]] [[BIS_fnc_objectVar]]
}}


[[Category:Scripting Commands|VEHICLEVARNAME]]
{{Note
[[Category:Scripting Commands ArmA|VEHICLEVARNAME]]
|user= Killzone_Kid
[[Category:Scripting Commands ArmA2|VEHICLEVARNAME]]
|timestamp= 20150419084500
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
|text= To get variable names referencing an object in mission namespace:
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
<sqf>
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
KK_fnc_objectVarNames = {
 
private "_names";
<!-- CONTINUE Notes -->
_names = [];
<dl class="command_description">
<dd class="notedate">Posted on April 19, 2015 - 08:45 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">
To get variable names referencing an object in mission namespace:
<code>KK_fnc_objectVarNames <nowiki>=</nowiki> {
[[private]] "_names";
_names <nowiki>=</nowiki> [];
{
{
[[if]] ([[missionNamespace]] [[getVariable]] _x [[isEqualTo]] _this) [[then]] {
if (missionNamespace getVariable _x isEqualTo _this) then {
_names [[pushBack]] _x;
_names pushBack _x;
};
};
} [[forEach]] [[allVariables]] [[missionNamespace]];
} forEach allVariables missionNamespace;
_names
_names
};
};


 
// Example
//example
myGroup = group player;
myGroup <nowiki>=</nowiki> [[group]] [[player]];
aGroup = group player;
aGroup <nowiki>=</nowiki> [[group]] [[player]];
hint str (group player call KK_fnc_objectVarNames); // ["agroup", "mygroup"]
[[hint]] [[str]] ([[group]] [[player]] [[call]] KK_fnc_objectVarNames); //["agroup","mygroup"]</code>
</sqf>
</dd>
}}
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 20:33, 28 February 2024

Hover & click on the images for description

Description

Description:
Returns the variable name that contains a primary editor reference to this object. This is the variable given in the Insert Unit dialog / name field in the editor. It can be changed using setVehicleVarName.
Respawned unit will have the same vehicleVarName as the corpse left behind, however actual missionNamespace variable of the same name will only contain respawned unit.
Groups:
Object Manipulation

Syntax

Syntax:
vehicleVarName object
Parameters:
object: Object
Return Value:
String - variable name, if none was set, an empty string is returned

Examples

Example 1:
hint vehicleVarName player;

Additional Information

See also:
setVehicleVarName BIS_fnc_objectVar

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Killzone_Kid - c
Posted on Apr 19, 2015 - 08:45 (UTC)
To get variable names referencing an object in mission namespace:
KK_fnc_objectVarNames = { private "_names"; _names = []; { if (missionNamespace getVariable _x isEqualTo _this) then { _names pushBack _x; }; } forEach allVariables missionNamespace; _names }; // Example myGroup = group player; aGroup = group player; hint str (group player call KK_fnc_objectVarNames); // ["agroup", "mygroup"]