Aw avatar location

From ActiveWiki
Jump to: navigation, search


Minimum requirements
Added in version 4.1
SDKbuild 65


int aw_avatar_location (int citizen, int session, char *name)

Description

Queries an avatar's location in world.

Callback

AW_CALLBACK_AVATAR_LOCATION

Arguments

citizen
Citizen number.
session
Session number.
name
Name.

Only one of the arguments can be used as the search criteria. The other arguments must be set to 0 or NULL respectively.

Argument attributes

None

Return values

RC_SUCCESS (1) (2)
RC_NOT_INITIALIZED (1)
RC_NO_INSTANCE (1)
RC_NO_CONNECTION (1)
The connection to the world is down.
RC_UNAUTHORIZED (2)
Only world server administration instances or those owned by a caretaker (i.e. aw_bool (AW_WORLD_CARETAKER_CAPABILITY) returns 1) may use this method.
RC_NO_SUCH_CITIZEN (2)
No avatar with a matching citizen number or name.
RC_NO_SUCH_SESSION (2)
No avatar with a matching session number.

(1) Possible return values when a callback is installed.

(2) Returned by the world server.

Returned attributes

AW_AVATAR_SESSION (1)
AW_AVATAR_NAME (1)
AW_AVATAR_X
AW_AVATAR_Y
AW_AVATAR_Z
AW_AVATAR_YAW
AW_AVATAR_PITCH
AW_AVATAR_TYPE
AW_AVATAR_GESTURE
AW_AVATAR_STATE
AW_AVATAR_VERSION
AW_AVATAR_CITIZEN (1)
AW_AVATAR_PRIVILEGE
AW_AVATAR_LOCK
AW_PLUGIN_STRING

(1) If the world server returned something other than RC_SUCCESS then this attribute is set to the value passed to aw_avatar_location.

(All other attributes are set to 0 or "" when a query fails.)

Usage

void handle_avatar_location (int rc)
{
  if (rc != RC_SUCCESS)
  {
    printf ("Unable to locate avatar (reason %d)\n", rc);
  }
  else
  {
    printf ("Avatar %s (session %d) located at %d %d %d\n",
      aw_string (AW_AVATAR_NAME), aw_int (AW_AVATAR_SESSION),
      aw_int (AW_AVATAR_X), aw_int (AW_AVATAR_Y), aw_int (AW_AVATAR_Z));
  }
}

/* locate the avatar with session number 4711 */
aw_callback_set (AW_CALLBACK_AVATAR_LOCATION, handle_avatar_location);
aw_avatar_location (0, 4711, NULL);