FANDOM


The GetObjectType() NWScript command serves to identify what kind of object its parameter is, returning am OBJECT_TYPE_* constant. If its parameter is not a valid object, it returns 0 (not an OBJECT_TYPE_* constant).

This function has its limitations in that it cannot identify areas and modules. See the known issues for workarounds.

DefinitionEdit

int GetObjectType (object oTarget)

object oTarget 
The object whose type will be returned.

The return value is usually an OBJECT_TYPE_* constant. The exceptions are invalid objects, area objects, and the module object; zero is returned in each of these cases. Also of note is that OBJECT_TYPE_INVALID is returned for sound objects. (This is the only time OBJECT_TYPE_INVALID is returned, so one might consider "invalid" to mean "sound" in this particular case.)

Known issues Edit

There are two types of objects (areas and modules) that this command cannot identify. As workarounds, GetArea() and GetModule() can be used. Specifically, the expression

GetArea(oObject) == oObject

is true precisely when oObject is an area, and

GetModule() == oObject

is true precisely when oObject is the module.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.