AW AVATAR CITIZEN

From ActiveWiki
Revision as of 17:42, 1 September 2008 by Macavity (talk | contribs) (Added in)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Minimum requirements
Added in version 3.1
SDKbuild 18
Worldbuild 28
Browserbuild 361


AW_AVATAR_CITIZEN

Type

Integer (read only)

Description

Citizen number of an avatar.

Notes

For citizens, this attribute is the citizen number of the user controlling the avatar.

For bots and tourists, this attribute is zero.

For bots, AW_AVATAR_PRIVILEGE is the citizen number of the owner.

It is also possible to determine if an avatar is a citizen, bot, or tourist by examining the first character in its name (i.e. AW_AVATAR_NAME).

Usage

void handle_avatar_add ()
{
  int citizen   = aw_int (AW_AVATAR_CITIZEN);
  int privilege = aw_int (AW_AVATAR_PRIVILEGE);
  char *name    = aw_string (AW_AVATAR_NAME);
  
  if (citizen > 0)
  {
    /* citizen */
    if (privilege == citizen)
    {
      /* has not acquired privileges */
     printf ("%s, citizen #%d has arrived\n", name, citizen);
    }
    else
    {
      /* has acquired privileges */
      printf ("%s, citizen #%d using privileges of #%d, has arrived\n", name, citizen, privilege);
    }
  }
  else if (privilege > 0)
  {
    /* bot */
    printf ("%s, owned by #%d has arrived\n", name, privilege);
  }
  else
  {
    /* tourist */
    printf ("%s has arrived\n", name); 
  }
}

aw_event_set (AW_EVENT_AVATAR_ADD, handle_avatar_add);

Used by

See also