Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

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 (wink)

 
Div
classbox
Availability
Status
colourYellow
titlebeta

Requires:

Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

Babel API

Topics:

Child pages (Children Display)
alltrue
depthall
pageBabel API
excerpttrue