MV How to have the cursor on a different option of the menu by default.

Hi all!

Im doing some tutorials and i would like to open my main menu and have the cursor selecting another option of the menu, not the first one(index 0 i suppose?) So if my menu is Inventory, skills, tutorials and save. Instead of opening my menu and having the cursor on inventory, I would like to have the cursor selecting tutorials.

thanks!
If your window extends Window_Selectable, it should have a default select method that you can pass an index to. The default logic often has a method called selectLast or reselect that will store the index of a given window when it was last used to reselect that index.

You should be able to do something like:
JavaScript:
SceneManager._scene._commandWindow.select(1);

Since you mentioned the menu, I'm assuming you're in the Menu Scene (Scene_Menu), which has:
  • Window_MenuCommand (the window that lets you select a command)
  • Window_Gold (the window showing how much gold you have)
  • Window_MenuStatus (the status of your party)
They're stored on the scene as the properties:
  • _commandWindow
  • _goldWindow
  • _statusWindow
I'm not sure if there's a more canonical or appropriate way to reference the current scene, but I've always just gone with SceneManager._scene. So if you're doing a tutorial and you wanted to open the menu, then select a command, you could have something like:
JavaScript:
SceneManager.goto(Scene_Menu);
SceneManager._scene._commandWindow.select(1); // Where 1 is the index of what command you want to select
@Zevia I get the error ##Uncaught TypeError: Cannot read property 'select' of undefined##

I thought it was because im using moghutner plug in which im sure it overwrites the scene_menu. But I tried it on a a new project and it still gives me that error.

But what you are saying makes a lot of sense.

I copy pasted your code :
Code:
SceneManager.goto(Scene_Menu);
SceneManager._scene._commandWindow.select(1);

Was i supposed to change something, besides the index I want?
Hmm. Code works fine for me in a new project:
gotoscene.PNG

gotoscenesuccess.PNG

select1.PNG


I'm using RPG Maker MV - are you on MZ? Perhaps the API changed a bit from one version to the other.
Lol. Im dumb. I was running both lines at the same time. It works!!

thank you!!!
Ah - if you need to run both lines back to back (that is, you'd like the menu to open and as soon as it does, immediately select a different option), you can modify one of the Scene_Menu methods. Probably create or start or something like that, I'd have to look a bit and tinker. It's a problem with what's known as asynchronous execution since RM runs on an event loop and goto just tells the SceneManager to change scenes at the next available opportunity.

Otherwise, if what you have already works, then great!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-have-the-cursor-on-a-different-option-of-the-menu-by-default.135760/