Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Excerpt

Compiles a Babel format message, ready for sending to your AI buddies...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
var babelMessage = chat.toBabel(message[, dialect[, data[, replacer]]]);

Parameters

ParameterTypeMandatoryNotesAPI Version
messageString(tick)A basic message to send to the recipient, eg. "help"1.0
dialectString(error)

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: "ai" (standard dialect)

1.0
dataVariant(error)

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

For more information on what is supported, see Data types.

Default: undefined

1.0
replacer

Function

Array

(error)

Optionally specify a JSON replacer array or function to change values or filter out unwanted properties.

Default: Don't change or remove any properties.

Note

Not applied to the following data types:

1.0

Return values

ValueTypeNotesAPI 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

Code Block
themeRDark
languagejavascript
linenumberstrue
var babelMessage = chat.toBabel("defend", "ai", someStructureObj);
 
chat(someAIplayer, babelMessage);
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