This AI is still in early stages of development.
chat.fromBabel()
- Aubergine
Owned by Aubergine
Converts a Babel format message in to an array...
Syntax
var result = chat.fromBabel(sender, to, message);
Parameters
Parameter | Type | Mandatory | Notes | API Version |
---|---|---|---|---|
sender | Number | The ID of the player who sent the message. Same value as first parameter of eventChat() | 1.0 | |
to | Number Constant | Who the message was sent to (either numeric player ID or Player Scope constant) Same value as second parameter of eventChat() | 1.0 | |
message | String | A Babel formatted message that you want to decompile. Same value as third parameter of eventChat() – use chat.isBabel() to determine if the received message is in Babel format first though! | 1.0 |
Return values
Value | Type | Notes | API Version |
---|---|---|---|
<result> | Array of Variant | An array that looks like this:
The values are as follows:
| 1.0 |
<error> | Invalid parameters passed to function. See Error Dialect for more information on what's in the return value. | 1.0 |
Example
function eventChat(sender, to, message) { if (chat.isBabel(message)) { // use .fromBabel() array as params to custom event... eventChatAI.apply(this, chat.fromBabel(sender, to, message)); } else { // process other kinds of message } } function eventChatAI(sender, to, message, dialect, data) { // do stuff }
Contents
Jump to:
Babel API
Topics:
- Data types — Babel supports most types of data...
- Error Dialect — A specific dialect for reporting errors within Babel...
- Babel on Warzone 3.1 — Babel handles Warzone 3.1 gracefully...
- Position-like Objects — If your data has {x, y} properties, Babel treats it like a Position object...
- chat.toBabel() — Compiles a Babel format message, ready for sending to your AI buddies...
- chat.isBabel() — Quickly determine if a received message is in Babel format...
- chat.fromBabel() — Converts a Babel format message in to an array...
- Handling Dialects — Some ideas on how to handle multiple dialects...