Menu self closing after script change

I changed line 191 in Scene_Map from SceneManager.call(Scene_Menu) to SceneManager.call(Scene_Item), as I'll only be using the item menu.


Since making the change, when I open the menu it stays open for a second before closing itself.


I'm fiddled around but can't figure out why it's happening,
I've moved this thread to Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
Did you disable line 192 as well?  If you didn't, do that and then see if it makes any difference.
@Andar I apologise!


@Shaz Commenting out line 192 gives this error: 

Script 'Window_MenuCommand' line 104: NameError occurred.
uninitialised class variable @@last_command_symbol in Window_MenuCommand
You're pressing Escape to open the item menu?  I wonder if it's not clearing the key, so it's processing the Escape again once the menu is open.  I had a quick look and can't see where it's doing that, or what you might change to stop it, so that's just an idea to keep in the back of your mind for now, while exploring other ideas.


Have you changed any other scripts?  Made any changes to Scene_Item?  If you start a brand new project and ONLY make that change (the one you made, not the one I asked about in my previous post) and no other changes at all - especially to scripts, does it work?
Yup, using escape to open the menu.


I hadn't made any changes to Scene_Item, but I do have some other menu scripts.


In a brand new test game, only changing line 191.


The same issue happens. Menu just closes its self D:
can you try changing it to open other menus instead of Scene_Item just to see if it happens in all other menu scenes or just at Scene_Item?


wait, if I remember correctly, the processing of the menu call from the map does a check if it's calling the menu to avoid multiple calls to it. It might be that it's not registering the call when the open menu is not the Scene_Menu, which might then be causing some problem..
Strangely enough, Scene_Save works fine, but Scene_Skill has the same issue!


Super duper confused
Then maybe it has something to do with one of the Window_ scripts since afaik, Scene_Item and Scene_Skill have windows that use the same base Window_ (Try to look at the windows they use, Window_SkillList, Window_ItemList and so on)


can't check as I don't have my laptop with me...
The Input module will not update itself between scene changes, and the item menu won't run an update call on startup, so the first frame on that menu will still think that you pressed the cancel button to exit the scene.


Quite honestly, that whole method for calling the main menu is a giant mess with unneeded things in it.


That variable there (named @menu_calling) is completely useless.


Replace that method with this:

Spoiler
Code:
class Scene_Map < Scene_Base

  def update_call_menu
    if !$game_system.menu_disabled && !$game_map.interpreter.running? &&
       !$game_player.moving? && Input.trigger?(:B)
      Input.update # <-- Resets all key presses
      call_menu
    end
  end
  
end



This should take care of your issue.

Original thread: https://forums.rpgmakerweb.com/threads/menu-self-closing-after-script-change.72757/