typeOf: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Some wiki formatting)
 
(59 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofpr |= Game name
|game1= ofp
|version1= 1.90


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


| Returns the class type of a given object . |= Description
|game3= arma1
____________________________________________________________________________________________
|version3= 1.00


| [[String]] <nowiki>=</nowiki>  '''typeOf''' vehicleName |= Syntax
|game4= arma2
|version4= 1.00


|p1= vehicleName: [[Object]] |= Parameter 1
|game5= arma2oa
|version5= 1.50


| [[String]] |= Return value
|game6= tkoh
____________________________________________________________________________________________
|version6= 1.00
 
|x1= <pre>_class = typeOf _mi24</pre> |= Example 1
____________________________________________________________________________________________


| [[countType]], [[isKindOf]] |= See also
|game7= arma3
|version7= 0.50


}}
|gr1= Object Manipulation
 
|descr= Returns the class name of a given object.


<h3 style="display:none">Notes</h3>
|s1= [[typeOf]] obj
<dl class="command_description">
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on August 4, 2006 - 12:03</dd>
|p1= obj: [[Object]]
<dt class="note">'''[[User:Hardrock|hardrock]]'''</dt><dd class="note">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.</dd>


<!-- Note Section END -->
|r1= [[String]] - config class name, or empty string if ''obj'' does not have a class
</dl>


<h3 style="display:none">Bottom Section</h3>
|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]]
}}


[[Category:Scripting Commands|TYPEOF]]
{{Note
[[Category:Scripting Commands OFP 1.96|TYPEOF]]
|user= Hardrock
[[Category:Scripting Commands OFP 1.46|TYPEOF]]
|timestamp= 20060804120300
[[Category:Scripting Commands ArmA|TYPEOF]]
|text= Try using this on an object pre-placed in the mission editor such as a house:
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]]
<sqf>hint typeOf _object; // Shows the class name (XXX)</sqf>
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
|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.