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

Command Mode

Quick start guide for creating and using commands...

 

Overview

In this mode, Chat monitors all messages from the player to detect command keywords. When a keyword is found, the associated command handler function is triggered to process the message.

Step 1

Define your Command Handler Function:

var myCommand = function myCommand(command, player, message, conversation) {
  // command = command name (string)
  // player = id of player who sent the command (number)
  // message = array of words in chat message (message[0] == command)
  // conversation = conversation object associated with player
 
  // do some stuff
 
  // if you want a message sent to the player,
  // return a string or an array of strings
  return "done";
}

Step 2

Register the command:

chat.on("foo", myCommand);

Step 3

Triggering a command from a script using chat() with applicable Player Scope or player id:

chat(ALLIES, "foo"); // "done"

Triggering a command from the console:

Press Enter then type command .foo then press Enter to send.

Notes

Commands from a player will not be processed if there is an active Conversation with the player – during an active conversation all messages are sent to the Conversation Handler Function instead.

Looking for a list of available chat commands? See:

Availability BETA

Requires:

Contents

Jump to:

Chat API

Topics: