Aw whisper

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13
Browserbuild 277


int aw_whisper (int session_id, const char *message)

Description

Whispers to another user.

Callback

None (returns immediately)

Notes

Triggers AW_EVENT_CHAT for a user, with AW_CHAT_TYPE set to AW_CHAT_WHISPER.

This method will whisper a message to the user with the session session_id. The target must be a neighbor of the bot, or an error occurs. If not in global mode then whether the user is in range or not can be determined by whether the bot has received an AW_EVENT_AVATAR_ADD for it without a corresponding AW_EVENT_AVATAR_DELETE.

The SDK application must call aw_state_change at least once before calling aw_whisper.

Arguments

session_id
Session number of recepient.
message
Message.

Argument attributes

None

Return values

RC_SUCCESS
RC_NOT_INITIALIZED
RC_NO_INSTANCE
RC_NO_CONNECTION
The connection to the world is down.
RC_NOT_YET
It would exceed the maximum number of whispers per second (defined by AW_MAX_WHISPERS_PER_SECOND in Aw.h).

Returned attributes

None

Usage

Whisper a welcome message to every user that enters the scene.

void avatar_add (void)
{
  char	message[256];
  
  sprintf (message,
           "Hello %s, welcome to my world :-)", 
           aw_string (AW_AVATAR_NAME));
  
  aw_whisper (aw_int (AW_AVATAR_SESSION), message);
}

aw_event_set (AW_EVENT_AVATAR_ADD, avatar_add);

See also