AW OBJECT ID

From ActiveWiki
Jump to: navigation, search


Minimum requirements
Added in version 4.1
SDKbuild 53


AW_OBJECT_ID

Type

Integer

Description

An identifier for which all objects in a world have their own unique value.

Notes

This attribute provides an alternative to using AW_OBJECT_NUMBER, AW_OBJECT_X and AW_OBJECT_Z when refering to an object, and it will only be used when AW_OBJECT_NUMBER is set to 0.

It can be particularly useful when refering to already existing objects and provides a somewhat faster access for the world server to it's database. It is a primary key of the world's cell database and so it does not change during update/change operations. It can be any number except for 0 which is considered to be invalid.

How numbers are assigned

This number is assigned to an object when it gets added to a world. The first one is assigned 1 and it increases by 1 each time an object is added. This is done separately for each world hosted on the same server.

Shortcomings

It is impossible to tell, using only AW_OBJECT_ID, for which call an AW_CALLBACK_OBJECT_RESULT was triggered when creating objects (using aw_object_add or aw_object_load). This is because AW_OBJECT_ID has not been assigned a number after the call, so there is nothing to compare it to in the callback, as opposed to AW_OBJECT_NUMBER which is assigned by the SDK. An alternative would be to use AW_OBJECT_CALLBACK_REFERENCE.

When an object is changed it will generate the events AW_EVENT_OBJECT_ADD followed by AW_EVENT_OBJECT_DELETE for those who are receiving live-updates and global mode bots. Both of these events will have AW_OBJECT_ID set to the same number. If AW_OBJECT_NUMBER in AW_EVENT_OBJECT_DELETE differs from the one in AW_EVENT_OBJECT_ADD then an object was changed. If both events had the same AW_OBJECT_NUMBER then an object was added and then deleted.

Used by

See also