name: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Add specifics about identical names)
 
(86 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofp |= Game name
|game1= ofp
|version1= 1.00


|1.00|= Game version
|game2= ofpe
____________________________________________________________________________________________
|version2= 1.00


| The name given to a unit using the [[setIdentity]] instruction or selected randomly by the game engine if [[setIdentity]] has not been used on the unit.
|game3= arma1
|version3= 1.00


If used on vehicle, name of first crew member (in order commander, driver, gunner).
|game4= arma2
|version4= 1.00


If used on an object, "Error: No unit" is being returned. |= Description
|game5= arma2oa
____________________________________________________________________________________________
|version5= 1.50


| [[String]] <nowiki>=</nowiki> '''name''' object |= Syntax
|game6= tkoh
|version6= 1.00


|p1= object: [[Object]] |= Parameter 1
|game7= arma3
|version7= 0.50


| [[String]] |= Return value
|gr1= Unit Identity
____________________________________________________________________________________________
 
|x1= <code>_name <nowiki>=</nowiki> '''name''' [[vehicle]] [[player]]</code> |= Example 1
____________________________________________________________________________________________


| |= See also
|gr2= Locations


}}
|descr= When argument is [[Object]], the command returns the name given to a unit using the [[setIdentity]] instruction or selected randomly by the game engine if [[setIdentity]] has not been used on the unit.
If used on vehicle, name of first crew member (in order commander, driver, gunner). If used on an object, "Error: No unit" is being returned.
 
|mp=  [[name]] returns [[profileName]], eventually suffixed by the server in the event of identical names, e.g {{hl|username}}/{{hl|username (2)}}.
 
|pr= {{Feature|important|If the provided unit is dead and has been removed from its group, its identity has then been purged to save memory and using [[name]] on it will result in a logged error.}}
 
|s1= [[name]] object
 
|p1= object: [[Object]]
 
|r1= [[String]]
 
|s2= [[name]] location


<h3 style="display:none">Notes</h3>
|s2since= arma1 1.08
<dl class="command_description">
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on August 4, 2006 - 10:56
|p21= location: [[Location]]
<dt class="note">'''[[User:Hardrock|hardrock]]'''<dd class="note">''Notes from before the conversion:''


Name will return an error for units that have been dead for more than a few seconds.
|r2= [[String]] - the location's ''name''. To get its textual value, use [[text]] (see {{Link|#Example 3}})


<dd class="notedate">Posted on December 15, 2006 - 05:27
|x1= <sqf>_name = name player;</sqf>
<dt class="note">'''[[User:Kronzky|Kronzky]]'''<dd class="note">To return the name of the unit that was given in the editor's "name" field, call up the unit's object in a format statement:
hint format["Unit's name: %1",_unitobject]


<dd class="notedate">Posted on April 14, 2009
|x2= <sqf>_locationName = name myLocation;</sqf>
<dt class="note">'''[[User:Alef|alef]]'''
<dd class="note">Will return
Error: No vehicle
for JIP players in init.sqf, if no [[sleep]] were performed
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|x3= <sqf>
name nearestLocation [position player, "Hill"]; // ""
text nearestLocation [position player, "Hill"]; // "Lesnoy Khrebet"
</sqf>


|seealso= [[profileName]] [[setName]] [[setIdentity]] [[nameSound]] [[setNameSound]] [[createLocation]] [[deleteLocation]] [[locationPosition]] [[nearestLocation]] [[nearestLocations]] [[nearestLocationWithDubbing]]
}}


[[Category:Scripting Commands|NAME]]
{{Note
[[Category:Scripting Commands OFP 1.96|NAME]]
|user= Kju
[[Category:Scripting Commands OFP 1.46|NAME]]
|timestamp= 20170130194200
[[Category:Scripting Commands ArmA|NAME]]
|text= [[Location]] variant appears to be only for the 3d editor.
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
 
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]]
{{Note
|user= Alef
|timestamp= 20090414014100
|text= Will return {{hl|Error: No vehicle}} for [[Multiplayer Scripting#Join In Progress|JIP]] players in [[init.sqf]], if no [[sleep]] were performed.
}}

Latest revision as of 19:45, 20 April 2023

Hover & click on the images for description

Description

Description:
When argument is Object, the command returns the name given to a unit using the setIdentity instruction or selected randomly by the game engine if setIdentity has not been used on the unit. If used on vehicle, name of first crew member (in order commander, driver, gunner). If used on an object, "Error: No unit" is being returned.
Multiplayer:
name returns profileName, eventually suffixed by the server in the event of identical names, e.g username/username (2).
Problems:
If the provided unit is dead and has been removed from its group, its identity has then been purged to save memory and using name on it will result in a logged error.
Groups:
Unit IdentityLocations

Syntax

Syntax:
name object
Parameters:
object: Object
Return Value:
String

Alternative Syntax

Syntax:
name location
Parameters:
location: Location
Return Value:
String - the location's name. To get its textual value, use text (see Example 3)

Examples

Example 1:
_name = name player;
Example 2:
_locationName = name myLocation;
Example 3:
name nearestLocation [position player, "Hill"]; // "" text nearestLocation [position player, "Hill"]; // "Lesnoy Khrebet"

Additional Information

See also:
profileName setName setIdentity nameSound setNameSound createLocation deleteLocation locationPosition nearestLocation nearestLocations nearestLocationWithDubbing

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
Kju - c
Posted on Jan 30, 2017 - 19:42 (UTC)
Location variant appears to be only for the 3d editor.
Alef - c
Posted on Apr 14, 2009 - 01:41 (UTC)
Will return Error: No vehicle for JIP players in init.sqf, if no sleep were performed.