(info) This AI is still in early stages of development.

Position-like Objects

If your data has {x, y} properties, Babel treats it like a Position object...

 

Overview

If you send data via Babel, and that data doesn't have a .type property but it does have both .x and .y properties, Babel adds .type = POSITION to your object.

The reason for this is simple - loads of AI chat messages refer to map locations, so Babel saves you some time by converting your {x, y} object in to a POSITION object. It won't remove any fields, it just adds a .type property – and it only does any of this if there isn't already a .type defined.

Uhm, what if I don't want it to?

Two easy ways to stop Babel doing this...

The first is somewhat obvious – make sure your object has a .type property (this also makes it at bit easier for receiving AIs to process your data).

If you don't want a .type property, then use the ready-made "removeType" replacer function when compiling your Babel messages:

// 100% .type-free -- guaranteed or your money back!
var babel = chat.toBabel("hello", "ai", {x:1, y:2}, chat.removeType);
Availability BETA

Requires:

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...

Â