AW AVATAR GESTURE

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


AW_AVATAR_GESTURE

Type

Integer

Description

Gesture that the avatar of a user is performing.

Notes

This is the value set for AW_MY_GESTURE when the user called aw_state_change. It is a one-based index into the list of gestures available for the avatar. A value of 0 indicates that no gesture is in progress. If the user is moving while a gesture is in progress then any avatar state changes will have AW_AVATAR_GESTURE set to the index of that gesture.

For SDK build 27, world build 44, browser build 430; and later: It is also used by aw_avatar_set to force users into performing a gesture.

For browser build 434 and later: The browser will call aw_state_change with gesture 0 when the seq file of a gesture finishes playing. Prior to this change it was difficult to tell if a gesture is triggered multiple times in a row.

Usage

static int previous[65536]; /* stores the previous value of gesture, per session */

void handle_avatar_add (void)
{
  int session = aw_int (AW_AVATAR_SESSION);
  
  previous[session] = 0;
}

void handle_avatar_change (void)
{
  int session = aw_int (AW_AVATAR_SESSION);
  int gesture = aw_int (AW_AVATAR_GESTURE);
  
  if (gesture == previous[session])
    return;
  
  if (previous[session] != 0)
    printf ("%s has finished gesture %d\n",
            aw_string (AW_AVATAR_NAME),
            previous[session]);
  
  if (gesture != 0)
    printf ("%s has triggered gesture %d\n",
            aw_string (AW_AVATAR_NAME),
            gesture);
  
  previous[session] = gesture;
}

aw_event_set (AW_EVENT_AVATAR_ADD, handle_avatar_add);
aw_event_set (AW_EVENT_AVATAR_CHANGE, handle_avatar_change);

Used by

See also