Putting a Menu Script within a Menu Script?

Hello!

I am currently using mjshi's Non-Combat Menu for a game. It created a simple menu that looks like this:

Items
Save
Shutdown
Cancel

This is just a list, but one can add whatever they wish as the words to select.

In the game I am wanting to do, the menu is like this

Items
Cellphone
Exit Game
Cancel

What I am looking for, is when I select "Cellphone", is for another menu to come up, the same sort of non-combat menu, which would then read

Text
Voicemail
Pictures

So, my question is, is it possible to layer menus? So, when you select a menu option, another menu pops up. I am unsure of how to do it. And I am sure it is possible!

If anyone can give me some advice on this, I would be very grateful! Thank you, community!
Do you want a new window to appear or do you want the "Cellphone" menu to "replace" the non-combat menu when the user selects "Cellphone"?
I would like to replace it, yes!
Is this what you want?
Spoiler: Code
Code:
# An extension to mjshi Non-Combat Menu
# A cellphone menu. Pretty much works the exact same way.

module NonCombatMenu
    CELL_MENU =
    [
        ['Text',   :text],
        ['Voicemail', :voicemail],
        ['Pictures', :pictures],
    ]
   
end

class Scene_EndCellphone < Scene_End
    def start
    super
    create_command_window
    create_invisible_formation_window
        @cell_window = false
    end
   
    def create_command_window
    @command_window = Window_GameEndCellphone.new
    NonCombatMenu::CELL_MENU.each do |i|
      next if i[1].to_s == "cancel"
      @command_window.set_handler(i[1], method(("command_" + i[1].to_s).to_sym))
        end
   
    @command_window.set_handler(:cancel,   method(:return_scene))
  end  
   
    def command_text
        #Text command goes here
    end
   
    def command_voicemail
        #voicemail...
    end
   
    def command_pictures
        #pictures... etc...
    end
   
end

class Window_GameEndCellphone < Window_GameEnd
  def make_command_list
    NonCombatMenu::CELL_MENU.each do |i|
      i[1].to_s == "none" ? add_command(i[0], i[1], enabled = false) : add_command(i[0], i[1])
    end
  end
end
Just put it below the Non-Combat Menu script.
In the Non-Combat Menu script, add ['Cellphone', :cell], below ['Save', :save], or something like that.
Then below:
def command_none
SceneManager.call(Scene_End)
end

Put something like:
def command_cell
SceneManager.call(Scene_EndCellphone)
end

and it should work.
And it should work.

Oh my gosh, yes! It worked perfectly, thank you! It does exactly what I need!

Since you were able to "layer" the same menu, does that mean I could do it again if I used the same script?

For example, selecting 'Text' would do the same, replace the current menu with another that lists the titles of the text messages that the MC has received.
No. It would have to be written differently for it to work like that.
Okay! That's good to know, then! I'll need to take a closer look at it and see what I can do, potentially. Thank you so much for your help.

Original thread: https://forums.rpgmakerweb.com/threads/putting-a-menu-script-within-a-menu-script.80060/