[MV] Command for closing the window/game

Good day to all!
I am using the SRD_TitleCommandCustomizer and for the "End game" main menu option, the code is:
1684491440868.png


For some reason, after updating from 1.5.1 to 1.6.2 this doesn't work properly anymore. My options are:
a)Update the plugin text to make it work
b)Call a common event with a script that closes the game window

Since not everybody will be familiar with option a)'s plugin, my quesiton is:
What script call do I need to put into the common event to close the game window? (if there is any)

Thanks!
Try this in the plugin parameter:
JavaScript:
SceneManager.exit.bind(SceneManager);
Or, in a Script event command:
JavaScript:
SceneManager.exit();
as a tiny update on caethyrils answer that could work, if in any
case "exit" doesn't work, replace it with "close".

the close(); or exit(); as scriptcall would work easely,
I dont know for SRD part though.
@ShadowDragon - afaik SceneManager.exit() has always been the MV/MZ "exit game" script call. close(), a.k.a. window.close(), is exactly what the OP said wasn't working for them.

Also, neither exit nor SceneManager.close are defined in the core scripts. Not sure where you got those from. 😅
it was from an MV tutorial, for scriptcall, depending on how the code
is written, it can change =) but it works on default way 🙂

maybe exit, close are default JS function, and not specific in the core required?
The close method was modified years ago to only function on additional windows that had been initially opened by script call:
Dammit. I just realized that it is not the command, but the plugin:
SRD_GameUpgrade seems to not be fully compatible with 1.6.2 ... That may be why I decided some years ago, not to update my RPG Maker MV from 1.5.1 . However I need to have 1.6.2 now to use steam achievements.
The issue is that the game freezes, if I use any of the methods mentioned above. In the main menu, or if I do the script call as "SceneManager.exit();". Once I disable the plugin, it works really well.

Within the plugin I found a plugin command "ForceClose" which works! It does the following:
Code:
SRD.PluginCommands['forceclose'] = function(args) {
    if(!GameWindowManager.window) return;
    GameWindowManager.window.close(true);
};


SceneManager.closeGame = function(force) {
    if(this._scene && this._scene.startFadeOut) {
        this._scene.startFadeOut();
    }
};

GameWindowManager.closeGame = function() {
    if(GameWindowManager.window) {
        GameWindowManager.window.close(true);
    } else {
        window.close(true);
    }
};

Can you guys see any potential harm in using that plugin command? "Force close" sounds pretty bad and I don't know which programs usually are run when you "soft close" the game. Don't want to mess with that :/
Can you guys see any potential harm in using that plugin command?
Looks OK to me! Generally if a plugin offers an alternative then you should use that instead of the standard approach. From the variable names I'm guessing it's related to SRD's Window Upgrade plugin.
Looks OK to me! Generally if a plugin offers an alternative then you should use that instead of the standard approach. From the variable names I'm guessing it's related to SRD's Window Upgrade plugin.
Yeah I get that. It is from the main plugin "SRD_GameUpgrade", but it affected the "TitleCommandCustomizer" from SRD as well. I don't use his Window Upgrade. At least I got this one fixed. Thanks to both of you! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/mv-command-for-closing-the-window-game.157643/