(alias addCommand) Add (or change) a command of events. The command is a string. The command in the event must be of the form

"name: json value"

Example 1 :

"FOO: {'bar': 'hello'}"

Example 2 :

"BAR: 10"

Example 3 :

"TEST: {'one': 5, 'two': [9, 5], 'three': {'a': 10, 'b': 'yep'}}"

Note that single quotes are replaced by double quotes to have a valid JSON.



  • name {String}

    Command Name. Alphanumeric character, "?", "!" and "_"

  • callback {Function}

    Function called when the command is executed. The function of 3 parameters:

    • params {Object} : The parameters sent when calling the command.
    • event {Event} : The event in question
    • name {String} : The command name

    The function should contain a line that calls the method "nextCommand()"

    Example. A command in the event :

    "commands": [
        "FOO: {'bar': 'hello'}"

    Adding the command :

    Interpreter.addCommand('FOO', function(params, name) {
        console.log(;    // =>  "hello"
        console.log(name);          // =>  "FOO"
        console.log(this.event);    // => Game_Character Class
        this.nextCommand();         // Always put the following line to jump to the next command