BIS fnc getName: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ :\\\-\/|()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}")
(More information from the function code)
 
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| arma3
|game1= arma3
|version1= 1.00


|1.00
|gr1= Object Manipulation


|gr1 = Object Manipulation
|descr= Returns name of a unit. Name of unit is stored in it is namespace so it can be retrieved later, mainly for when unit dies. Name is stored in the variable '''BIS_fnc_getName_name'''.


| Returns name of a unit. Name of unit is stored in it is namespace so it can be retrieved later, mainly for when unit dies. Name is stored in the variable '''BIS_fnc_getName_name'''.
If the unit is alive, this function does [[name]] and returns the result, and saves the result to the variable on the unit. If the unit is dead, the function tries to retrieve the saved name from the variable on the unit, and returns "" if none is saved, unless forcedWhenDead is set to [[true]].


| [object] call [[BIS_fnc_getName]]
|s1= [object] call [[BIS_fnc_getName]]


|p1= object: [[Object]] - Object whose name should be returned
|p1= object: [[Object]] - object whose name should be returned


| [[String]] - Unit's name
|p2= forcedWhenDead: [[Boolean]] - (Optional, default [[false]]) forces the function to do [[name]] on the unit if it's dead and has no name saved in the variable. Might have inconsistent results.


|x1= <code><nowiki>[</nowiki>[[player]]] [[call]] [[BIS_fnc_getName]];</code>
|p3= maxCharacters: [[Number]] - (Optional, default -1) the name returned will be limited to this length. -1 for no limit. The name saved to the variable is not limited.
 
|r1= [[String]] - unit's name
 
|x1= <sqf>[player] call BIS_fnc_getName;</sqf>


|seealso= [[name]]
|seealso= [[name]]
}}
}}

Latest revision as of 02:54, 12 April 2026

Hover & click on the images for description

Description

Description:
Returns name of a unit. Name of unit is stored in it is namespace so it can be retrieved later, mainly for when unit dies. Name is stored in the variable BIS_fnc_getName_name. If the unit is alive, this function does name and returns the result, and saves the result to the variable on the unit. If the unit is dead, the function tries to retrieve the saved name from the variable on the unit, and returns "" if none is saved, unless forcedWhenDead is set to true.
Execution:
call
Groups:
Object Manipulation

Syntax

Syntax:
[object] call BIS_fnc_getName
Parameters:
object: Object - object whose name should be returned
forcedWhenDead: Boolean - (Optional, default false) forces the function to do name on the unit if it's dead and has no name saved in the variable. Might have inconsistent results.
maxCharacters: Number - (Optional, default -1) the name returned will be limited to this length. -1 for no limit. The name saved to the variable is not limited.
Return Value:
String - unit's name

Examples

Example 1:
[player] call BIS_fnc_getName;

Additional Information

See also:
name

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note