AW EVENT CHAT

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


AW_EVENT_CHAT

Description

User said something.

Notes

The avatars for which this event is triggered are governed by neighbor restrictions. If not in global mode, whether chat will be received from a user can be determined by whether that user has triggered an AW_EVENT_AVATAR_ADD event without a corresponding AW_EVENT_AVATAR_DELETE.

In addition chat and whispers, console messages may also fill the browser's chat window. This event is not triggered when a console message is received; such messages are handled by the AW_EVENT_CONSOLE_MESSAGE event.

In order to receive this event, the application must first announce its position by calling aw_state_change at least once, or enter a world in global mode.

Attributes

AW_AVATAR_NAME
AW_CHAT_MESSAGE
AW_CHAT_TYPE
AW_CHAT_CITIZEN
AW_CHAT_SESSION (1)

(1) Be careful not to confuse this attribute with AW_AVATAR_SESSION and AW_OBJECT_SESSION, both of which are undefined for this event.

Usage

static char* chat_type[] = {"said", "broadcasted", "whispered", "disconnected"};

void handle_chat (void)
{
  printf ("%s %s %s\n",
          aw_string (AW_AVATAR_NAME),
          chat_type[ aw_int (AW_CHAT_TYPE)],
          aw_string (AW_CHAT_MESSAGE));
}

aw_event_set (AW_EVENT_CHAT, handle_chat);

See also