Aw console message
Minimum requirements | ||
---|---|---|
Added in version 3.3 | ||
SDK | build 24 |
int aw_console_message (int session_id)
Description
Sends a console message to users in a world.
Callback
None (returns immediately)
Notes
This method triggers AW_EVENT_CONSOLE_MESSAGE in all the recipients that subscribe to the event.
These messages allow bots control over how they appear in the chat window of a browser, including italics, bold, and color. They are distinct from chat messages in that they do not need to appear to come "from" anyone in particular.
Spoken messages from a user can be simulated by sending console messages in the format "Name:\tMessage" where Name is the name of the user, and Message is the chat message (e.g. "AWLD:\tHello!"). This allows for chat to be relayed through a bot if the AW_WORLD_DISABLE_CHAT option has been enabled (i.e. aw_bool (AW_WORLD_DISABLE_CHAT) returns 1).
Only world server administration instances or those owned by a caretaker (i.e. aw_bool (AW_WORLD_CARETAKER_CAPABILITY) returns 1) may use this method.
Arguments
- session_id
- Session number of the recipient. If set to 0 (zero) then it will send the message to everyone in the world.
Argument attributes
- AW_CONSOLE_MESSAGE
- AW_CONSOLE_BOLD
- AW_CONSOLE_ITALICS
- AW_CONSOLE_RED
- AW_CONSOLE_GREEN
- AW_CONSOLE_BLUE
Return values
- RC_SUCCESS
- RC_NOT_INITIALIZED
- RC_NO_INSTANCE
- RC_NO_CONNECTION
- The connection to the world is down.
Returned attributes
None
Usage
void console_greeting (int session) { int rc; /* send the message "Hello World", in bold red text */ aw_int_set (AW_CONSOLE_RED, 255); aw_int_set (AW_CONSOLE_GREEN, 0); aw_int_set (AW_CONSOLE_BLUE, 0); aw_bool_set (AW_CONSOLE_BOLD, 1); aw_bool_set (AW_CONSOLE_ITALICS, 1); aw_string_set (AW_CONSOLE_MESSAGE, "Hello World!"); rc = aw_console_message (session); if (rc != RC_SUCCESS) printf ("Console message failed (reason %d)\n", rc); }