typeOf: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "<dd class="notedate">Posted on ([^<>]+) " to "<dd class="notedate">Posted on $1</dd> ")
(Added display and control)
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| ofpr
|game1= ofp
|version1= 1.90


|1.90
|game2= ofpe
|version2= 1.00
 
|game3= arma1
|version3= 1.00
 
|game4= arma2
|version4= 1.00
 
|game5= arma2oa
|version5= 1.50
 
|game6= tkoh
|version6= 1.00
 
|game7= arma3
|version7= 0.50


|gr1= Object Manipulation
|gr1= Object Manipulation


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


| [[typeOf]] object
|s1= [[typeOf]] target


|p1= object: [[Object]]
|p1= target: [[Object]], since {{GVI|arma3|2.22}} [[Control]], [[Display]]


| [[String]]
|r1= [[String]] - config class name, or empty string if ''target'' 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>


| [[countType]], [[isKindOf]], [[configOf]]
|x1= <sqf>if (typeOf vehicle player == "B_Heli_Light_01_armed_F") then { hint "Player is in a AH-9 Pawnee"; };</sqf>
 
|x2= <sqf>
// Since 2.22
typeOf (findDisplay 313); // "Display3DEN"
</sqf>
 
|seealso= [[countType]] [[isKindOf]] [[configOf]] [[ctrlClassName]]
}}
}}


<dl class="command_description">
{{Note
<!-- Note Section BEGIN -->
|user= Hardrock
<dd class="notedate">Posted on August 4, 2006 - 12:03</dd>
|timestamp= 20060804120300
<dt class="note">[[User:Hardrock|hardrock]]
|text= Try using this on an object pre-placed in the mission editor such as a house:
<dd class="note">(CWR 1.90) Try using this on an object pre-placed in the mission editor (such as a house): [[hint]] [[format]]["%1", [[typeOf]] [[object]] 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 ArmA)
<sqf>hint typeOf _object; // Shows the class name (XXX)</sqf>
<!-- Note Section END -->
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.
</dl>
Save it, and load the map. This method is no longer available since {{arma1}}.
 
|game= ofp
[[Category:Scripting Commands OFP 1.46|{{uc:{{PAGENAME}}}}]]
|version= 1.90
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}

Latest revision as of 11:42, 21 March 2026

Hover & click on the images for description

Description

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

Syntax

Syntax:
typeOf target
Parameters:
target: Object, since Arma 3 logo black.png 2.22 Control, Display
Return Value:
String - config class name, or empty string if target 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"; };
Example 2:
// Since 2.22 typeOf (findDisplay 313); // "Display3DEN"

Additional Information

See also:
countType isKindOf configOf ctrlClassName

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
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.