Need help with this custom command.

vectorinox

Airport Luggage
Veteran
Joined
Jun 20, 2016
Messages
45
Reaction score
9
First Language
Singlish
Primarily Uses
I tried making a simple plugin to add "Exit to Desktop" command in the option, derived from ARP_TitleCommandExit.

(function() {

var _Window_Options_makeCommandList = Window_Options.prototype.makeCommandList;
Window_Options.prototype.makeCommandList = function() {
_Window_Options_makeCommandList.call(this);
this.addCommand("Exit to Desktop", 'exitGame');
};
Scene_Options_createOptionsWindow = Scene_Options.prototype.createOptionsWindow;
Scene_Options.prototype.createOptionsWindow = function() {
Scene_Options_createOptionsWindow.call(this);
this._OptionsWindow.setHandler('exitGame', this.commandExitGame.bind(this));
};
Window_Options.prototype.commandExitGame = function() {
SceneManager.exit();
};

})();
It doesn't work. When the plugin load, the "Exit to Desktop" command shows up in the Options but it does nothing, also there's an error: "cannot read property 'setHandler' of undefined". What am I missing?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,117
Reaction score
1,525
First Language
EN
Primarily Uses
RMMZ
...also there's an error: "cannot read property 'setHandler' of undefined". What am I missing?
This error means this._OptionsWindow is not defined. Try _optionsWindow (lowercase 'o') instead, i.e.
Code:
this._optionsWindow.setHandler('exitGame', this.commandExitGame.bind(this));
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top