[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,823
Reaction score
991
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
772
Reaction score
482
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,327
Reaction score
8,521
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

YES! officially released my games soundtrack on Itunes, Spotify, and Amazon..... kinda cool!

Another old age version of Reid. Trying out different style.
Hey everyone! Not sure how many people know about Cafofo Music on Itch.io, but I highly recommend their Sound Effects! It is amazing quality AND quantity and best of all, they are having a 50% sale! I can't express how much I love sales.
Wow.... My last map GIF got 47 likes, 16 retweet and 2,105 views on Twitter in 24 hours. My game thread here's only got 3k views in 6-7 months. I guess building my Twitter was insanely worth it. :LZSexcite:

Forum statistics

Threads
105,593
Messages
1,014,875
Members
137,264
Latest member
ZeoValinferno
Top