AW AVATAR NAME

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


AW_AVATAR_NAME

Type

String (read only)

Description

Name of avatar for which an event or callback was triggered.

Notes

It will have square brackets around bot names (e.g. [MyBot]) and double quotation marks around tourist names (e.g. "Visitor").

It is also possible to determine if an avatar is a citizen, bot, or tourist by examining its citizen and privilege number (i.e. AW_AVATAR_CITIZEN and AW_AVATAR_PRIVILEGE).

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 (name[0] == '\"')
  {
    /* tourist */
    printf ("%s has arrived\n", name); 
  }
  else if (name[0] == '[')
  {
    /* bot */
    printf ("%s, owned by #%d has arrived\n", name, privilege);
  }
  else
  {
    /* 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);
    }
  }
}

aw_event_set (AW_EVENT_AVATAR_ADD, handle_avatar_add);

Used by

See also