typeOf: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(80 intermediate revisions by 16 users not shown)
Line 1: Line 1:
<h2 style="color:#000066">'''typeOf ''vehicle'''''</h2>
{{RV|type=command


'''Operand types:'''
|game1= ofp
|version1= 1.90


vehicle: [[Object]]
|game2= ofpe
|version2= 1.00


'''Type of returned value:'''
|game3= arma1
|version3= 1.00


[[String]]
|game4= arma2
|version4= 1.00


'''Description:'''
|game5= arma2oa
|version5= 1.50


Returns the class type of a given object or vehicle.
|game6= tkoh
|version6= 1.00


'''Example:'''
|game7= arma3
|version7= 0.50


_class = '''typeOf''' _mi24
|gr1= Object Manipulation


|descr= Returns the class name of a given object.


'''Comments'''
|s1= [[typeOf]] obj


Comments by ''General Barron''
|p1= obj: [[Object]]


Try using this on an object pre-placed in the mission editor (such as a house):
|r1= [[String]] - config class name, or empty string if ''obj'' does not have a class


hint format["%1", '''''typeof''''' object xxx]
|x1= <sqf>if (typeOf vehicle player == "B_Heli_Light_01_armed_F") then { hint "Player is in a AH-9 Pawnee"; };</sqf>


Now place an object in the editor, save the map, and open up the mission.sqm.
|seealso= [[countType]] [[isKindOf]] [[configOf]]
Find the line: vehicle="XXX", and replace XXX with the name of the object that you found above.
}}
Save it, and load the map. You just placed a new house!
 
{{Note
|user= Hardrock
|timestamp= 20060804120300
|text= Try using this on an object pre-placed in the mission editor such as a house:
<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 15: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.