Jump to content

[SCRIPTING] Best way to put a menu within a menu?


Recommended Posts

http://wiki.tesnexus.com/index.php/Skyrim_Messagebox_Menu_Tutorial

 

So that is an example from the Nexus Wiki. What I would like to do is learn how to add another menu with a yes or no button inside one of the buttons. So if I chose button 1, it would pop up a menu asking me if I am sure and want to go ahead. If I click yes it would do stuff, but if I click no, it would obviously cancel. What is the best way to set this up? My head is currently spinning with all the other stuff I have had to learn. It's going okay though!

Many thanks everyone!

 

Edit: I want my script to extend an ObjectReference.

Edited by Guest
Link to comment
Share on other sites

Well, I just call a second message with yes option. It works for me.

 

Script wise, use states and perhaps a global to dictate which message gets displayed with each choice

Link to comment
Share on other sites

Thank you. Could you perhaps do a quick example please? I'm a very visual person and that is how I learn and keep it in my noggin'. A very quick one-button option would be fine. My problem is knowing how I should lay it out correctly, as I have seen a few different ways to do menus.

 

Sorry for my stupidity! :laugh:

 

Edit:

 

I'll have a menu with various options like so:

 

if Button 0

;Cancel

 

elseif Button 1

Do stuff

 

So I need Button 1 to pop up another menu that says "Are you sure/ Y/N" and then stuff will happen on yes, but no will cancel the whole menu.

Edited by Guest
Link to comment
Share on other sites

Great Frank. I spliced it together, but I'm not sure about something... I basically do this:

 

Function Menu(int Button = 0)
Button = MessageMenu.Show()

 

And then in one of the button options, I link to this:

 

Function Menu2(int Button = 0)
Button = MessageBody.Show()

 

My question is... Would I need to change the int in Menu2 to something different, or can I reuse that like I have been doing? Does it matter?

Link to comment
Share on other sites

You don't need two functions, as you can see in the "Menu with sub-options" within the checks for the buttons pressed of the main menu you show the sub-options adn check the button that was pressed recycling the aibutton variable. Something like this may work, removed "If aiButton != -1" since in the discussion tab they say it's not needed sicne papyrus jusy waits for show to return.

Function Menu(Bool abMenu = True, Int aiButton = 0)
    While abMenu
            aiButton = MainMenuMESG.Show() ; Main Menu
            If aiButton == 0 ; option 1
                aiButton = Confirmation.Show()
                If aiButton == 0 ; yes
                  ;so something
                ElseIf aiButton == 1 ; no
                EndIf
            ElseIf aiButton == 1 ; option 2
                aiButton = Confirmation.Show()
                If aiButton == 0 ; yes
                  ;do something else
                ElseIf aiButton == 1 ; no
                EndIf
            EndIf
    EndWhile
EndFunction

EDIT: actually if you don't want to include a "back" button or something like that the while might be unnecessary, so maybe this works:

Function Menu(Int aiButton = 0)
            aiButton = MainMenuMESG.Show() ; Main Menu
            abMenu = False ; End the function
            If aiButton == 0 ; option 1
                aiButton = Confirmation.Show()
                If aiButton == 0 ; yes
                   ;do something
                ElseIf aiButton == 1 ; no
                     ;
                EndIf
            ElseIf aiButton == 1 ; cancel
              ;do nothing at all?
            EndIf
EndFunction
Edited by FrankFamily
Link to comment
Share on other sites

Here's a small (snigger) example of a script cast via dialogue that spawns several messages

 

 

  Reveal hidden contents

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...