- Joined
- May 25, 2018
- Messages
- 27
- Reaction score
- 15
- First Language
- Italian
- Primarily Uses
- RMMV
Hi!
first thing first I hope this is the right place to ask. I have been all day wondering, trying and smashing my head on desk, wall and almost jumping myself outt he window. XD
In short I have a problem (or two probably) with setClickHandler. I made a menu with custom icons that does replace the commands, and they are working, until you press on the "skill", "equip" and "status" buttons. If I click one of this buttons in fact, it does bring me to the Scene_Menu.prototype.commandPersonal (where you have to select with cursor the character), but then is a dead end. Pressing again mouse after selected one of the characters does nothing. My guess at this point is that the script doesn't know which button was pressed and which character was selected. And I have no clue how to tell him this. I followed in part this guide. Thank you to any that can help. I'm gonna post the main part of the code in case need. Perhaps could have cut a lot of coding with a different method :x
first thing first I hope this is the right place to ask. I have been all day wondering, trying and smashing my head on desk, wall and almost jumping myself outt he window. XD
In short I have a problem (or two probably) with setClickHandler. I made a menu with custom icons that does replace the commands, and they are working, until you press on the "skill", "equip" and "status" buttons. If I click one of this buttons in fact, it does bring me to the Scene_Menu.prototype.commandPersonal (where you have to select with cursor the character), but then is a dead end. Pressing again mouse after selected one of the characters does nothing. My guess at this point is that the script doesn't know which button was pressed and which character was selected. And I have no clue how to tell him this. I followed in part this guide. Thank you to any that can help. I'm gonna post the main part of the code in case need. Perhaps could have cut a lot of coding with a different method :x
Code:
Scene_Menu.prototype.createCommandImages = function() {
this._menuCmdBackground = new Sprite();
this._menuCmdBackground2 = new Sprite();
this._itemButton = new Sprite_Button();
this._skillsButton = new Sprite_Button();
this._equipButton = new Sprite_Button();
this._statusButton = new Sprite_Button();
this._formationButton = new Sprite_Button();
this._saveButton = new Sprite_Button();
this._optionsButton = new Sprite_Button();
this._endButton = new Sprite_Button();
this._menuCmdBackground.bitmap = ImageManager.loadSystem(menuCommandBackground);
this._menuCmdBackground2.bitmap = ImageManager.loadSystem(menuCommandBackground2);
this._itemButton.bitmap = ImageManager.loadSystem("cmdBtn_A1");
this._skillsButton.bitmap = ImageManager.loadSystem("cmdBtn_A2");
this._equipButton.bitmap = ImageManager.loadSystem("cmdBtn_A3");
this._statusButton.bitmap = ImageManager.loadSystem("cmdBtn_A4");
this._formationButton.bitmap = ImageManager.loadSystem("cmdBtn_A5");
this._saveButton.bitmap = ImageManager.loadSystem("cmdBtn_A6");
this._optionsButton.bitmap = ImageManager.loadSystem("cmdBtn_A7");
this._endButton.bitmap = ImageManager.loadSystem("cmdBtn_A8");
this._itemButton.x = 496;
this._skillsButton.x = this._itemButton.x + 36;
this._equipButton.x = this._skillsButton.x + 36;
this._statusButton.x = this._equipButton.x + 36;
this._formationButton.x = this._statusButton.x + 36;
this._saveButton.x = this._formationButton.x + 36;
this._optionsButton.x = this._saveButton.x + 36;
this._endButton.x = this._optionsButton.x + 36;
this._itemButton.y = this._skillsButton.y = this._equipButton.y = this._statusButton.y
= this._formationButton.y = this._saveButton.y = this._optionsButton.y = this._endButton.y = this._endButton.y = 51;
this.addChild(this._itemButton);
this.addChild(this._skillsButton);
this.addChild(this._equipButton);
this.addChild(this._statusButton);
this.addChild(this._formationButton);
this.addChild(this._saveButton);
this.addChild(this._optionsButton);
this.addChild(this._endButton);
};
Scene_Menu.prototype.createCommandWindow = function() {
this._commandWindow = new Window_MenuCommand(0, 0);
this._commandWindow.visible = false;
this._commandWindow.x = Graphics.boxWidth;
this._commandWindow.y = Graphics.boxHeight;
this._commandWindow.setHandler('item', this.commandItem.bind(this));
this._commandWindow.setHandler('skill', this.commandPersonal.bind(this));
this._commandWindow.setHandler('equip', this.commandPersonal.bind(this));
this._commandWindow.setHandler('status', this.commandPersonal.bind(this));
this._commandWindow.setHandler('formation', this.commandFormation.bind(this));
this._commandWindow.setHandler('options', this.commandOptions.bind(this));
this._commandWindow.setHandler('save', this.commandSave.bind(this));
this._commandWindow.setHandler('gameEnd', this.commandGameEnd.bind(this));
this._commandWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._commandWindow);
};
Scene_Menu.prototype.update = function() {
Scene_MenuBase.prototype.update.call(this);
// item image button
this._itemButton.setClickHandler(this.commandItem.bind(this));
// skill image button
this._skillsButton.setClickHandler(this.commandPersonal.bind(this));
// equip image button
this._equipButton.setClickHandler(this.commandPersonal.bind(this));
// status image button
this._statusButton.setClickHandler(this.commandPersonal.bind(this));
// formation image button
this._formationButton.setClickHandler(this.commandFormation.bind(this));
// save image button
this._saveButton.setClickHandler(this.commandSave.bind(this));
// options image button
this._optionsButton.setClickHandler(this.commandOptions.bind(this));
// end image button
this._endButton.setClickHandler(this.commandGameEnd.bind(this));
};
// This is the part where my code having trouble
Scene_Menu.prototype.commandPersonal = function() {
this._statusWindow.setFormationMode(false);
this._statusWindow.selectLast();
this._statusWindow.activate();
this._statusWindow.setHandler('ok', this.onPersonalOk.bind(this));
this._statusWindow.setHandler('cancel', this.onPersonalCancel.bind(this));
};
Scene_Menu.prototype.onPersonalOk = function() {
switch (this._commandWindow.currentSymbol()) {
case 'skill':
SceneManager.push(Scene_Skill);
break;
case 'equip':
SceneManager.push(Scene_Equip);
break;
case 'status':
SceneManager.push(Scene_Status);
break;
};
};
Scene_Menu.prototype.onPersonalCancel = function() {
this._statusWindow.deselect();
this._commandWindow.activate();
};

