Plugin Error

Discussion in 'Learning Javascript' started by Indsh, Oct 20, 2017.

  1. Indsh

    Indsh Veteran Veteran

    Messages:
    217
    Likes Received:
    65
    Location:
    Bristol
    First Language:
    English
    Primarily Uses:
    N/A
    This code:

    var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
    // to be overridden by plugins
    _Game_Interpreter_pluginCommand.apply(this);

    }:

    Is coming up with this error:

    Cannot read property 'trim' of undefined

    Can anyone see what's going wroung?
     
    #1
  2. Gamefall Team

    Gamefall Team Nebula Games Leader Veteran

    Messages:
    344
    Likes Received:
    431
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMMV
    Probably, the error is this line:

    Code:
    _Game_Interpreter_pluginCommand.apply(this);
    Try this one:

    Code:
    _Game_Interpreter_pluginCommand.apply(this, arguments);
    or

    Code:
    _Game_Interpreter_pluginCommand.call(this, command, args);
     
    #2
    Indsh likes this.
  3. Indsh

    Indsh Veteran Veteran

    Messages:
    217
    Likes Received:
    65
    Location:
    Bristol
    First Language:
    English
    Primarily Uses:
    N/A
    amazing,

    _Game_Interpreter_pluginCommand.call(this, command, args);

    Is what I tried before and what I felt should work but

    _Game_Interpreter_pluginCommand.apply(this, arguments);

    Seems to be working now, on to the next issues
     
    #3

Share This Page