GetObjectType(object)

From NWN Lexicon
Jump to navigationJump to search

Determines what type the object is.

int GetObjectType(
    object oTarget
);

Parameters

oTarget
The object to find its type.

Description

Returns the object type (OBJECT_TYPE_*) of oTarget and 0 if the object is invalid or there is no defined constant (see Known Bugs).


Remarks

Returns OBJECT_TYPE_ALL or OBJECT_TYPE_INVALID (both are the same value) for sound objects.

Returns 0 for areas or modules (no constant defined/"invalid"). These can also be tested with GetArea, using code similar to: if(GetArea(oObject) == oObject)


Known Bugs

This function doesn't return -1 on error as it claims in the function's description in the Script Editor. Nor does it return OBJECT_TYPE_INVALID for invalid objects. Return value on error is always 0.

Sound objects return OBJECT_TYPE_INVALID / OBJECT_TYPE_ALL and Area and Modules have no defined return value thus return 0 (see Remarks above).


Version

1.61

See Also

constants: 

OBJECT_TYPE_* Constants


 author: Tom Cassiotis, editor: Charles Feduke, additional contributor(s): Sunjammer