MV Open main menu at specific option?

Hi,

Is there a way to open the main menu at a specific option?

I'm using YEP_MainMenuManager, and have a common event with choices and text that can be accessed from the menu and acts as a guide. When the player closes the guide and returns to the menu, I would like the cursor to maintain its position at the 'Guide' option. Is there any way to achieve this? I've tried to use "SceneManager._scene._commandWindow.select(7);" but it doesn't work, and gives me a TypeError "Cannot read property 'select' of undefined" if I try to select anything else after that.

It does work if I type it in the console, but not if I type it in a script. Is there something I'm missing here....?

aphofailsatcoding.png


typeerror.png
Open Menu Screen pauses the event and changes scene. When you close the menu, the event will resume. The map scene does not have a _commandWindow property by default, i.e. it is undefined like the error says. I think you'll need a plugin for this, so...

I've moved this thread to JS Plugin Requests. Thank you.

I just wrote a small plugin for this, instructions are in its help description:
It seems to work for me with no other plugins active, but let me know if you have problems~

(Full code in spoiler below for easy reference.)
Spoiler: Full plugin code
JavaScript:
/*:
 * @plugindesc Open the pause menu to a specific command.
 * @author Caethyril
 * @help You can use this in a Script command:
 *     selectPauseMenuCommand(5);
 * The pause menu will select command #6 next time it opens.
 * This will reset after one use.
 * You can manually reset it by using a value of -1.
 *
 * This plugin does not add data to save files.
 *
 * Free to use and/or modify for any project.
 */

(function() {
'use strict';
    let menuIndex = -1;

    (function(alias) {
        Scene_Menu.prototype.start = function() {
            if (menuIndex >= 0) {
                this._commandWindow.select(menuIndex);
                menuIndex = -1;   // <- reset
            }
            alias.apply(this, arguments);
        };
    })(Scene_Menu.prototype.start);

    window.selectPauseMenuCommand = function(index) { menuIndex = index; };

})();
That works. Thank you!

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.

Original thread: https://forums.rpgmakerweb.com/threads/open-main-menu-at-specific-option.141224/