This AI is still in early stages of development.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Converts a Babel format message in to an array...

 

Syntax

var result = chat.fromBabel(sender, to, message);

Parameters

ParameterTypeMandatoryNotesAPI Version
sender

Number

(tick)

The ID of the player who sent the message.

Same value as first parameter of eventChat()

1.0
to

Number

Constant

(tick)

Who the message was sent to (either numeric player ID or Player Scope constant)

Same value as second parameter of eventChat() 

1.0
messageString(tick)

A Babel formatted message that you want to decompile.

Same value as third parameter of eventChat() – use chat.isBabel() to determine if the received message is in Babel format first though!

1.0

Return values

ValueTypeNotesAPI Version
<result>Array of Variant

An array that looks like this:

[sender, to, message, dialect, data]

The values are as follows:

  • sender – the id of the player who sent the message
  • to – the id of the player who the message was sent to (or Player Scope constant)
  • message – the "message" component of the Babel message
  • dialect – the "dialect" component of the Babel message (defaults to "ai" if sender did not specify it)
  • data – the "data" component of the Babel message (or undefined if no data sent)
1.0
<error>

Error Dialect

Invalid parameters passed to function. See Error Dialect for more information on what's in the return value.1.0

Example

function eventChat(sender, to, message) {
	if (chat.isBabel(message)) {
		// use .fromBabel() array as params to custom event...
		eventChatAI.apply(this, chat.fromBabel(sender, to, message));
	} else {
		// process other kinds of message
	}
}
 
function eventChatAI(sender, to, message, dialect, data) {
	// do stuff
}
Availability BETA

Requires:

Contents

Jump to:

Babel API

Topics:

 

  • No labels