typeOf: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]3(\|.*)\]\]" to "{{GameCategory|arma3|Scripting Commands}}")
m (Some wiki formatting)
 
(30 intermediate revisions by 2 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


|gr1= Object Manipulation |GROUP1=
|game3= arma1
____________________________________________________________________________________________
|version3= 1.00


| Returns the config class name of given object or "" if object does not have a config class. |DESCRIPTION=
|game4= arma2
____________________________________________________________________________________________
|version4= 1.00


| [[typeOf]] object |SYNTAX=
|game5= arma2oa
|version5= 1.50


|p1= object: [[Object]] |PARAMETER1=
|game6= tkoh
|version6= 1.00


| [[String]] |RETURNVALUE=
|game7= arma3
____________________________________________________________________________________________
|version7= 0.50
 
|x1= <code>[[if]] ([[typeOf]] [[vehicle]] [[player]] == "B_Heli_Light_01_armed_F") [[then]] { [[hint]] "Player is in a AH-9 Pawnee"; };</code> |EXAMPLE1=
____________________________________________________________________________________________


| [[countType]], [[isKindOf]], [[configOf]] |SEEALSO=
|gr1= Object Manipulation
 
|descr= Returns the class name of a given object.
 
|s1= [[typeOf]] obj
 
|p1= obj: [[Object]]
 
|r1= [[String]] - config class name, or empty string if ''obj'' does not have a class
 
|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]]
}}
}}


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

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.