Aw avatar click

From ActiveWiki
Jump to: navigation, search
Minimum requirements
Added in version 2.2
SDKbuild 14
Worldbuild 21
Browserbuild 296


int aw_avatar_click (int session_id)

Description

Simulates left-clicking an avatar.

Callback

None (returns immediately)

Notes

This method triggers AW_EVENT_AVATAR_CLICK in all the neighbor SDK applications that have subscribed to the event. It is intended for use by the Active Worlds Browser to indicate when a user left-clicks on an avatar with the mouse. However it is also available for use by SDK applications which may wish to simulate user mouse actions for the purposes of testing, etc.

Arguments

session_id
Session number of the avatar to left-click.

Argument attributes

None

Return values

RC_SUCCESS
RC_NOT_INITIALIZED
RC_NO_INSTANCE
RC_NO_CONNECTION
The connection to the world is down.

Returned attributes

None

Usage

Simulate an avatar click in response to a spoken request.

void handle_chat (void)
{
  int rc;
  
  /* use stricmp or strcasecmp (*nix) for case-insensitive string comparison */
  if (strcmp (aw_string (AW_CHAT_MESSAGE), "click me") == 0)
  {
    rc = aw_avatar_click (aw_int (AW_CHAT_SESSION));
    if (rc != RC_SUCCESS)
      printf ("Avatar click failed (reason %d)\n", rc);
  }
}

/* subscribe to the chat event */
aw_event_set (AW_EVENT_CHAT, handle_chat);

See also