Hey folks,
I'm in the middle of building a command window but everytime I test, it keeps telling me Cannot set property 'command1' of undefined.
I'm not sure what I'm missing here.
Any and all help is welcome.
Here is the code:
I'm in the middle of building a command window but everytime I test, it keeps telling me Cannot set property 'command1' of undefined.
I'm not sure what I'm missing here.
Any and all help is welcome.
Here is the code:
var parameters = PluginManager.parameters("NSS-Gathering_System");
Input.keyMapper["80"] = "testScene";
_alias_scene_map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
_alias_scene_map_update.call(this);
if (Input.isTriggered("testScene")) SceneManager.push(Scene_GatheringWindow);
};
function Scene_GatheringWindow() {
this.initialize.apply(this, arguments);
};
Scene_GatheringWindow.prototype = Object.create(Scene_MenuBase.prototype);
Scene_GatheringWindow.prototype.constructor = Scene_GatheringWindow;
Scene_GatheringWindow.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_GatheringWindow.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this._gatherTitle = new Window_GatherTitle(0, 0, Graphics.boxWidth, Graphics.boxHeight / 6);
this.addWindow(this._gatherTitle);
this._gatheringMenu = new Window_GSelect(0, Graphics.boxHeight / 6, Graphics.boxWidth / 4, Graphics.boxWidth /2);
this._gatheringMenu.setHandler("command1", this.command1.bind(this));
this._gatheringMenu.setHandler("command2", this.command2.bind(this));
this._gatheringMenu.setHandler("command3", this.command3.bind(this));
this.addWindow(this._gatheringMenu);
this._gatheringMenu.deactivate();
};
Scene_GatheringWindow.prototype.command1 = function() {
$gameVariables.setValue(1, 10);
};
Scene_GatheringWindow.prototype.command2 = function() {
$gameVariables.setValue(2, 10);
};
Scene_GatheringWindow.prototype.command3 = function(){
$gameVariables.setValue(3, 10);
};
Scene_GatheringWindow.prototype.start = function() {
Scene_MenuBase.prototype.start.call(this);
this._gatherTitle.refresh();
this._gatheringMenu.refresh();
};
Scene_GatheringWindow.prototype.update = function() {
Scene_MenuBase.prototype.update.call(this);
if (Input.isTriggered("cancel")) this.popScene();;
};
// Title Window
function Window_GatherTitle() {
this.initialize.apply(this, arguments);
};
Window_GatherTitle.prototype = Object.create(Window_Base.prototype);
Window_GatherTitle.prototype.constructor = Window_GatherTitle;
Window_GatherTitle.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};
Window_GatherTitle.prototype.refresh = function(x, y) {
this.contents.clear();
this.drawText("Test", 0, 0)
};
// Selection Window
function Window_GSelect() {
this.initialize.apply(this, arguments);
};
Window_GSelect.prototype = Object.create(Window_Command.prototype);
Window_GSelect.prototype.constructor = Window_GSelect;
Window_GSelect.prototype.initialize = function (x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.opacity = 0;
};
Window_GSelect.prototype.makeCommandList = function() {
var action1Name = String(parameters['Action 1 Name']);
var action2Name = String(parameters['Action 2 Name']);
var action3Name = String(parameters['Action 3 Name']);
this.addCommand(action1Name, "command1");
this.addCommand(action2Name, "command2");
this.addCommand(action3Name, "command3");
};