name: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ |()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}")
(Add specifics about identical names)
 
(42 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| ofp
|game1= ofp
|version1= 1.00


|1.00
|game2= ofpe
|version2= 1.00


|gr1= Unit Identity
|game3= arma1
|version3= 1.00
 
|game4= arma2
|version4= 1.00
 
|game5= arma2oa
|version5= 1.50


|gr2= Locations
|game6= tkoh
|version6= 1.00


| 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.<br>
|game7= arma3
When argument is [[Location]], the location's name is returned. To return the textual value of a location use [[text]] command instead.<br><br>
|version7= 0.50
{{Feature|arma3 | [[setName]] can be used on a person to set [[name]]. However in multiplayer [[name]] always returns [[profileName]].}}


| [[name]] object
|gr1= Unit Identity


|p1= object: [[Object]]
|gr2= Locations


| [[String]]
|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.


|s2= [[name]] location
|mp= [[name]] returns [[profileName]], eventually suffixed by the server in the event of identical names, e.g {{hl|username}}/{{hl|username (2)}}.


|p21= location: [[Location]]
|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.}}


|r2= [[String]]
|s1= [[name]] object
 
|x1= <code>_name = [[name]] [[player]];</code>


|x2= <code>_locationName = [[name]] myLocation;</code>
|p1= object: [[Object]]


|x3= <code>[[name]] [[nearestLocation]] [<nowiki/>[[position]] [[player]], "Hill"]; {{cc|""}}
|r1= [[String]]
[[text]] [[nearestLocation]] [<nowiki/>[[position]] [[player]], "Hill"]; {{cc|"Lesnoy Khrebet"}}</code>


|seealso= [[profileName]], [[setName]], [[nameSound]], [[setNameSound]], [[createLocation]], [[deleteLocation]], [[drawLocation]], [[locationPosition]], [[locationNull]], [[nearestLocation]], [[nearestLocations]], [[nearestLocationWithDubbing]]
|s2= [[name]] location
}}


<dl class="command_description">
|s2since= arma1 1.08
<!-- Note Section BEGIN -->


<dt class="note">[[User:kju|kju]]</dt>
|p21= location: [[Location]]
<dd class="note">[[Location]] variant appears to be only for the 3d editor.


<!-- Note Section END -->
|r2= [[String]] - the location's ''name''. To get its textual value, use [[text]] (see {{Link|#Example 3}})
</dl>
<dl class="command_description">
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on August 4, 2006 - 10:56</dd>
|x1= <sqf>_name = name player;</sqf>
<dt class="note">[[User:Hardrock|hardrock]]</dt>
<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.
|x2= <sqf>_locationName = name myLocation;</sqf>


<dd class="notedate">Posted on December 15, 2006 - 05:27</dd>
|x3= <sqf>
<dt class="note">[[User:Kronzky|Kronzky]]</dt>
name nearestLocation [position player, "Hill"]; // ""
<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:
text nearestLocation [position player, "Hill"]; // "Lesnoy Khrebet"
<code>[[hint]] [[format]] ["Unit's name: %1", _unitobject];</code>
</sqf>


<dd class="notedate">Posted on April 14, 2009</dd>
|seealso= [[profileName]] [[setName]] [[setIdentity]] [[nameSound]] [[setNameSound]] [[createLocation]] [[deleteLocation]] [[locationPosition]] [[nearestLocation]] [[nearestLocations]] [[nearestLocationWithDubbing]]
<dt class="note">[[User:Alef|alef]]</dt>
}}
<dd class="note">Will return <tt>Error: No vehicle</tt> for [[Multiplayer Scripting#Join In Progress|JIP]] players in [[init.sqf]], if no [[sleep]] were performed
<!-- Note Section END -->
</dl>


{{Note
|user= Kju
|timestamp= 20170130194200
|text= [[Location]] variant appears to be only for the 3d editor.
}}


[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
{{Note
[[Category:Scripting Commands OFP 1.46|{{uc:{{PAGENAME}}}}]]
|user= Alef
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
|timestamp= 20090414014100
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
|text= Will return {{hl|Error: No vehicle}} for [[Multiplayer Scripting#Join In Progress|JIP]] players in [[init.sqf]], if no [[sleep]] were performed.
{{GameCategory|arma1|Scripting Commands}}
}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}

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.