This AI is still in early stages of development.
Error Dialect
- Aubergine
Owned by Aubergine
A specific dialect for reporting errors within Babel...
Overview
Various errors can occur when AIs start speaking to each other, including:
- Game objects being destroyed before the recipient gets a message
- Processing a non-Babel message, or message corruption
- Any other weirdness that might happen
If an error occurs before a message is sent, the message won't get sent – your code should put Error Handling around chat.toBabel() to trap the error and thus decide how to handle the situation.
On the receiving end, if an error is generated during chat.fromBabel(), the return array will contain details of the error as follows:
[sender, to, errorMessage, "error", chatMsg]
Where:
- sender, to = values of parameters of same name you passed in to chat.fromBabel()
- errorMessage = a string containing a description of the error
- "error" = indicates the error dialect is being used
- chatMsg = the original message received in eventChat()
Assuming your script uses a switch statement to decide how to process different dialects, you can either:
- Check for the "error" dialect and act accordingly (eg. re-throw the error or send it to debug(), etc)
- Not check for the "error' dialect and basically ignore any errors
Up to you what you do
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...