Difference between revisions of "DCS func getCategory"
From DCS World Wiki - Hoggitworld.com
Line 13: | Line 13: | ||
|par4= [[DCS_Class_Airbase|Airbase]] | |par4= [[DCS_Class_Airbase|Airbase]] | ||
− | |desc= Returns an enumerator of the category for the specific object. The enumerator returned is dependent on the category of the object and how the function is called. | + | |desc= Returns an enumerator of the category for the specific object. The enumerator returned is dependent on the category of the object and how the function is called. As of DCS 2.9.2 when this function is called on an Object, Unit, Weapon, or Airbase a 2nd value will be returned which details the object sub-category value. |
See enumerators Group.Category, Object.Category, and Spot.Category for further reference. | See enumerators Group.Category, Object.Category, and Spot.Category for further reference. | ||
Line 19: | Line 19: | ||
Function also works with [[DCS_Class_Unit|Unit]], [[DCS_Class_Weapon|Weapon]], [[DCS_Class_Static_Object|Static Object]], [[DCS_Class_Scenery_Object|Scenery Object]], [[DCS_Class_Airbase|Airbase]]. | Function also works with [[DCS_Class_Unit|Unit]], [[DCS_Class_Weapon|Weapon]], [[DCS_Class_Static_Object|Static Object]], [[DCS_Class_Scenery_Object|Scenery Object]], [[DCS_Class_Airbase|Airbase]]. | ||
− | |||
− | |||
− | |||
− | + | |rtnType= enum, enum | |
− | |||
− | |rtnType= enum | ||
|rtnExample= number | |rtnExample= number | ||
Line 53: | Line 48: | ||
local unit = Unit.getByName("CVN75") | local unit = Unit.getByName("CVN75") | ||
− | env.info(unit:getCategory() -> 3 (unit category for a ship) | + | env.info(unit:getCategory() -> 1, 3 (Object category for a unit, unit category for a ship) |
env.info(Object.getCategory(unit) - > 1 (object category for a unit) | env.info(Object.getCategory(unit) - > 1 (object category for a unit) | ||
env.info(Airbase.getCategory(unit) -> 2 (airbase category for a ship) | env.info(Airbase.getCategory(unit) -> 2 (airbase category for a ship) | ||
|notes= From DCS 1.5.7 and DCS 2.1.1 (Nov 2017) this function was broken. It has been fixed in DCS 2.9.1 (Nov 2023). In this timeframe it would always return the result of Object.getCategory() no matter how the function was called. Users were required to use getDesc().category to get the correct category value within its subclass. | |notes= From DCS 1.5.7 and DCS 2.1.1 (Nov 2017) this function was broken. It has been fixed in DCS 2.9.1 (Nov 2023). In this timeframe it would always return the result of Object.getCategory() no matter how the function was called. Users were required to use getDesc().category to get the correct category value within its subclass. | ||
+ | |||
+ | DCS 2.9.2 reverted the change in DCS 2.9.1. Now all callings of the function on objects will return the Object | ||
}} | }} | ||
[[Category:Class Functions|getCategory]] | [[Category:Class Functions|getCategory]] | ||
[[Category:Game Patch 1.2.0|getCategory]] | [[Category:Game Patch 1.2.0|getCategory]] |