This AI is still in early stages of development.
chat.toBabel()
- Aubergine
Syntax
var babelMessage = chat.toBabel(message[, dialect[, data[, replacer]]]);
Parameters
Parameter | Type | Mandatory | Notes | API Version |
---|---|---|---|---|
message | String | A basic message to send to the recipient, eg. "help" | 1.0 | |
dialect | String | The dialect of your Babel message – this is usually an abbreviation of the name of your AI, or "ai" if using the Standard Dialect. Default: | 1.0 | |
data | Variant | Optionally send data of any type with the message. Try and keep it small, it's being squeezed in to a chat message after all For more information on what is supported, see Data types. Default: | 1.0 | |
replacer | Function Array | Optionally specify a JSON replacer array or function to change values or filter out unwanted properties. Default: Don't change or remove any properties. Not applied to the following data types:
| 1.0 |
Return values
Value | Type | Notes | API Version |
---|---|---|---|
<babelMessage> | String | The message, dialect and data compiled in to a Babel-formatted string, ready for sending to a friendly AI via chat(). | 1.0 |
<error> | Error | Invalid parameters passed to function. Be sure to use Error Handling. | 1.0 |
Example
var babelMessage = chat.toBabel("defend", "ai", someStructureObj); chat(someAIplayer, babelMessage);
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...