[Solved] Replacing "Options" with "Quit" in Scene_Title

Status
Not open for further replies.

Oatilis

Veteran
Veteran
Joined
Mar 16, 2016
Messages
37
Reaction score
12
First Language
Hebrew
Primarily Uses
So, in the scenes JS file this code creates the main title menu:

JavaScript:
Scene_Title.prototype.createCommandWindow = function() {
    this._commandWindow = new Window_TitleCommand();
    this._commandWindow.setHandler('newGame',  this.commandNewGame.bind(this));
    this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
    this._commandWindow.setHandler('options',  this.commandOptions.bind(this));
    this.addWindow(this._commandWindow);
};
I'm trying to remove the options command and replace it with an exit command (quitting the game). Just to try it out, I commented out the options command and created a new gameEnd command:

JavaScript:
Scene_Title.prototype.createCommandWindow = function() {
    this._commandWindow = new Window_TitleCommand();
    this._commandWindow.setHandler('newGame',  this.commandNewGame.bind(this));
    this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
    // this._commandWindow.setHandler('options',  this.commandOptions.bind(this));
    this._commandWindow.setHandler('gameEnd', this.commandGameEnd.bind(this));
    this.addWindow(this._commandWindow);
};



Scene_Title.prototype.commandGameEnd = function() {
    SceneManager.exit();
};
However, the "Options" command still appears on the title menu (and the Game End option doesn't).
I figured, maybe the code I changed just sets up the handlers, and it doesn't actually create the title menu, but I couldn't find anywhere else in the codebase that addresses the title menu commands.

So, what am I missing?

P.S.
I saw people refer to SceneManager.exit() as the quit command, but I can't find this method in the class either, so I'm not sure this is actually going to work. Still I don't even see the command in the menu...
 
Last edited:

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
529
Reaction score
275
First Language
thai
Primarily Uses
RMMV
if you use other plugin that messing with title menu
maybe that one overide the code
you can try make and override one out as plugin too
because edit the original js is not recommended
you can forget what you did in a long run
and end up can't find the bug
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,028
First Language
Dutch
Primarily Uses
RMMV
there are many plugins that add just a exit command to the menu.
why not use that, it is not recommand to mess wit hteh main core files,
but rather alias the function and than add it.

here is a link to 1 of the many.
 

Oatilis

Veteran
Veteran
Joined
Mar 16, 2016
Messages
37
Reaction score
12
First Language
Hebrew
Primarily Uses
I know it's better to alias methods, but I also want to understand what's going on.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
That function you're editing is the one that handles what happens when someone clicks on each command on the command window. By commenting it out, I'd expect that the options command is still visible, but it doesn't do anything when you select it.

The function you're looking to change is actually the one in the Window_TitleCommand object that draws the commands:

Code:
Window_TitleCommand.prototype.makeCommandList = function() {
    this.addCommand(TextManager.newGame,   'newGame');
    this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());
    this.addCommand(TextManager.options,   'options');
};
You'd probably change the last line to this.addCommand('Quit', 'gameEnd');
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
529
Reaction score
275
First Language
thai
Primarily Uses
RMMV
I know it's better to alias methods, but I also want to understand what's going on.
then next time open up the existing plugin and learn from it
 

Oatilis

Veteran
Veteran
Joined
Mar 16, 2016
Messages
37
Reaction score
12
First Language
Hebrew
Primarily Uses
then next time open up the existing plugin and learn from it
I tried looking into Yanfly's menu plugin, but still, couldn't find where exactly the menu was being created.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,351
Reaction score
8,532
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.


@Oatilis Next time please report it solved. We won't always see it posted or in the title.
 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,854
Messages
1,016,998
Members
137,562
Latest member
tamedeathman
Top