Aw say
Minimum requirements | ||
---|---|---|
Added in version 2.1 | ||
SDK | build 13 |
int aw_say (char *message)
Description
Speaks a message to all the neighbors.
Callback
None (returns immediately)
Notes
Triggers AW_EVENT_CHAT in all the neighbors that subscribe to the event.
The message will appear as "[bot name]: message" in the chat log of a browser. Either in normal black or bold black text. Console messages can be used to display messages in other colors or without the bot's name preceding the message.
When not in global mode, bots can determine if an avatar is within hearing range by subscribing to avatar_add and avatar_delete events. Any avatar for which an avatar_add event has been triggered but not an avatar_delete will be able to both hear and be heard by the bot (provided that it is subscribing to chat events).
Global mode bots should use console messages instead, as they have no reliable way of telling if an avatar is within hearing range or not.
The chat event will usually be triggered for any avatars within a 400 x 400 x 400 meter cube around the bot. This is commonly referred to as "hearing range". It is possible to change the volume of this cube by adding neighbor_range=<centimeters> to the [misc] section in the worlds.ini file of a world server. The default value being 20000 centimeters (or 200 meters) as the half the length of all edges on the cube.
If there are more than 50 avatars within hearing range of the bot, then it will usually only trigger chat events for the 50 closest. It is possible to change this limit by adding neighbor_limit=<avatars> to the [misc] section in the worlds.ini file of a world server. The default value being 50 avatars as the limit.
Public speakers are exempt from the neighbor limit and will both hear and be heard by all avatars within hearing range. The chat type would be set to AW_CHAT_BROADCAST which makes the message show up with bold text in browsers.
Arguments
- 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 messages per second (defined by AW_MAX_MESSAGES_PER_SECOND in Aw.h).
Returned attributes
None
Usage
aw_say ("Howdy :)");