I was wondering about how to handle plugin code that doesn't properly create a scene. Specifically, I'm looking at Scene_MenuBase as an example and how to fix a case where the scene constructor doesn't exist in the code (well, it does but it's completely unusable and returns an error when the constructor is called.
As an example of what I need help with, the following code from the abandoned poker/card match plugin which I found over here is telling me that apply is not a part of an undefined reference, which if resolved may well provide a base to pick up from where the original author left off. Here's the scene constructor from the casino.js file that's a part of the plugin set:
As an example of what I need help with, the following code from the abandoned poker/card match plugin which I found over here is telling me that apply is not a part of an undefined reference, which if resolved may well provide a base to pick up from where the original author left off. Here's the scene constructor from the casino.js file that's a part of the plugin set:
JavaScript:
function Scene_Casino() {
this.initialize.apply(this, arguments);
}
Scene_Casino.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Casino.prototype.constructor = Scene_Casino;
Scene_Casino.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_Casino.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createDummyWindow();
this.createGoldWindow();
this.createPokaraWindow();
this.createMatchesWindow();
};
Scene_Casino.prototype.createCommandWindow = function() {
this._commandWindow = new Window_CasinoCommand(Graphics.boxWidth);
this._commandWindow.setHandler('pokara', this.commandPokara.bind(this));
this._commandWindow.setHandler('matches', this.commandMatches.bind(this));
this._commandWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._commandWindow);
};
Scene_Casino.prototype.createDummyWindow = function() {
var wy = this._commandWindow.y + this._commandWindow.height;
var wh = Graphics.boxHeight - wy;
this._dummyWindow = new Window_Base(0, wy, Graphics.boxWidth, wh);
this.addWindow(this._dummyWindow);
};
Scene_Casino.prototype.createGoldWindow = function() {
this._goldWindow = new Window_Gold(0, 0);
this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height;
this.addWindow(this._goldWindow);
};
Scene_Casino.prototype.createMatchesWindow = function() {
var wy = this._commandWindow.y + this._commandWindow.height;
var wh = Graphics.boxHeight - wy;
this._matchesWindow = new Window_CasinoMatches(0, wy, Graphics.boxWidth, wh);
this._matchesWindow.hide();
this._matchesWindow.setHandler('cancel', this.onMatchesCancel.bind(this));
this.addWindow(this._matchesWindow);
};
Scene_Casino.prototype.createPokaraWindow = function() {
var wy = this._commandWindow.y + this._commandWindow.height;
var wh = Graphics.boxHeight - wy - this._goldWindow.height;
this._pokaraWindow = new Window_CasinoPokara(0, wy, Graphics.boxWidth, wh, this);
this._pokaraWindow.hide();
this._pokaraWindow.setHandler('cancel', this.onPokaraCancel.bind(this));
this.addWindow(this._pokaraWindow);
};
Scene_Casino.prototype.commandPokara = function() {
this._dummyWindow.hide();
this._matchesWindow.hide();
this._goldWindow.show();
this._goldWindow.refresh();
this._pokaraWindow.show();
this._pokaraWindow.refresh();
this._pokaraWindow.activate();
};
Scene_Casino.prototype.commandMatches = function() {
this._dummyWindow.hide();
this._pokaraWindow.hide();
this._goldWindow.hide();
this._matchesWindow.show();
this._matchesWindow.refresh();
this._matchesWindow.activate();
};
Scene_Casino.prototype.onPokaraCancel = function() {
this._pokaraWindow.deactivate();
this._commandWindow.activate();
};
Scene_Casino.prototype.onMatchesCancel = function() {
this._matchesWindow.deactivate();
this._commandWindow.activate();
};