DCS func getCategory
From DCS World Wiki - Hoggitworld.com
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to:navigation, search
Envrioment: | Mission Scripting | ||
Function: | getCategory | Added with: 1.2.0 | |
Member Of: | Object, Group, Spot, Airbase | ||
Syntax: | enum, enum Object.getCategory(Class Self ) | ||
Description: | 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. Function also works with Unit, Weapon, Static Object, Scenery Object, Airbase.
| ||
Return Value: | enum, enum | ||
Return Example: | number | ||
Examples: | The following is run on a ship unit named CVN75.
local unit = Unit.getByName("CVN75") 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(Airbase.getCategory(unit) -> 2 (airbase category for a ship) | ||
Related Functions: | Object Functions: isExist, destroy, getCategory, getTypeName, getDesc, hasAttribute, getName, getPoint, getPosition, getVelocity, inAir
Group Functions: isExist, activate, destroy, getCategory, getCoalition, getName, getID, getUnit, getUnits, getSize, getInitialSize, getController, enableEmission Spot Functions: createLaser. createInfraRed, destroy, getCategory, getPoint, setPoint, getCode, setCode | ||
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 |