typeOf: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^ ]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^ ]*)<\/code>" to "<code>$1$2$3</code>")
m (Some wiki formatting)
 
(7 intermediate revisions by the same user not shown)
Line 24: Line 24:
|gr1= Object Manipulation
|gr1= Object Manipulation


|descr= Returns the config class name of given object or {{ic|""}} if object does not have a config class.
|descr= Returns the class name of a given object.


|s1= [[typeOf]] object
|s1= [[typeOf]] obj


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


|r1= [[String]] - Config class or {{ic|""}}
|r1= [[String]] - config class name, or empty string if ''obj'' does not have a class


|x1= <code>if (typeOf vehicle [[player]] == "B_Heli_Light_01_armed_F") [[then]] { [[hint]] "Player is in a AH-9 Pawnee"; };</code>
|x1= <sqf>if (typeOf vehicle player == "B_Heli_Light_01_armed_F") then { hint "Player is in a AH-9 Pawnee"; };</sqf>


|seealso= [[countType]] [[isKindOf]] [[configOf]]
|seealso= [[countType]] [[isKindOf]] [[configOf]]
}}
}}


<dl class="command_description">
{{Note
 
|user= Hardrock
<dt></dt>
|timestamp= 20060804120300
<dd class="notedate">Posted on August 4, 2006 - 12:03</dd>
|text= Try using this on an object pre-placed in the mission editor such as a house:
<dt class="note">[[User:Hardrock|hardrock]]</dt>
<sqf>hint typeOf _object; // Shows the class name (XXX)</sqf>
<dd class="note">{{GVI|ofp|1.90}} Try using this on an object pre-placed in the mission editor such as a house:
Now place an object in the editor, save the map, and open up the [[Mission.sqm]]. Find the line: vehicle = "XXX", and replace XXX with the name of the object that you found above.
<code>hint format ["%1", typeOf [[object]]]; {{cc|Shows the class name (XXX)}}</code>
Save it, and load the map. This method is no longer available since {{arma1}}.
Now place an object in the editor, save the map, and open up the [[Mission.sqm]]. Find the line: vehicle = "XXX", and replace XXX with the name of the object that you found above. Save it, and load the map. This method is no longer available since {{arma1}}.
|game= ofp
</dl>
|version= 1.90
}}

Latest revision as of 14:26, 4 August 2023

Hover & click on the images for description

Description

Description:
Returns the class name of a given object.
Groups:
Object Manipulation

Syntax

Syntax:
typeOf obj
Parameters:
obj: Object
Return Value:
String - config class name, or empty string if obj does not have a class

Examples

Example 1:
if (typeOf vehicle player == "B_Heli_Light_01_armed_F") then { hint "Player is in a AH-9 Pawnee"; };

Additional Information

See also:
countType isKindOf configOf

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
Hardrock - c
Posted on Aug 04, 2006 - 12:03 (UTC)

Try using this on an object pre-placed in the mission editor such as a house:

hint typeOf _object; // Shows the class name (XXX)
Now place an object in the editor, save the map, and open up the Mission.sqm. Find the line: vehicle = "XXX", and replace XXX with the name of the object that you found above. Save it, and load the map. This method is no longer available since Armed Assault.