Plugin functions keep crashing the game

I have programming experience but am fairly new to both Javascript and the RPGM engine, and I think I'm misunderstanding something very basic. I'm tinkering with Yanfly's Equip Battle Skills plugin in MV 1.5.0 and things aren't working as expected. The following is with a fresh project, a freshly downloaded copy of EBS, no other plugins running and no other changes to the code besides the one mentioned.

The help file of EBS lists several functions that should be usable in script calls, but whenever I try to call one it crashes the game. Right now I'm trying to get the getBattleSkillMaxPlus function to work as it's very simple and should just return an integer. Note that simply using the plugin to equip skills works just fine.

Here's the relevant code from the (unaltered) plugin:

Code:
Game_Actor.prototype.clearBattleSkillMaxPlus = function() {
    this._battleSkillMaxPlus = 0;
};

Game_Actor.prototype.getBattleSkillMaxPlus = function() {
    if (this._battleSkillMaxPlus === undefined) {
      this.clearBattleSkillMaxPlus();
    }
    return this._battleSkillMaxPlus;
};

I created an event with the following script:

Code:
console.log($dataActors[1].name);
console.log($dataActors[1].getBattleSkillMaxPlus());

...which produces the following error when triggered:

menuTest1.png


I changed the function itself to pass _name and _battleSkillMaxPlus to some other variables and report them. This change is made to EBS itself rather than through another plugin:

Code:
Game_Actor.prototype.getBattleSkillMaxPlus = function() {
    if (this._battleSkillMaxPlus === undefined) {
      this.clearBattleSkillMaxPlus();
    }

    var tempName = this._name;
    var tempValue = this._battleSkillMaxPlus;
    console.log(tempName);
    console.log(tempValue);
    return tempValue;
};

This works as expected. Each actor gets reported twice at the start of the game as things are initialized, so the function clearly works when called from other parts of the plugin:

menuTest2.png


...But it refuses to return the value for any code I write that calls it from the outside. This version also crashes when I use the event.

Am I doing something wrong?
I think you're supposed to call $gameActors for that to work, not $dataActors.
I reduced the script to just this line:

Code:
console.log($gameActors[1].getBattleSkillMaxPlus());

I still got an error, but a different one:

"TypeError: Cannot read property 'getBattleSkillMaxPlus' of undefined"
Where exactly is the event being called? If it's before the game starts, it won't find $gameActors because it doesn't exist yet.
I placed an event just north of the party's starting position and it's triggered by facing it and pressing the action button. So this is after the game starts.
Try $gameActors.actor(1).getBattleSkillMaxPlus();

$gameActors on its own can't identify what you're looking for.
That did it. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/plugin-functions-keep-crashing-the-game.80290/