Difference between revisions of "Options Menu"
→Examples
imported>Threedee |
imported>Threedee |
||
Line 115: | Line 115: | ||
<source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference | <source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference | ||
{Presents a multilevel looped menu when this item is equipped} | |||
;=================================================== | |||
Message Property MainMenuMESG Auto ; main menu messagebox | |||
Message Property OptionsMenu00MESG Auto ; submenu page 1 messagebox | |||
Message Property OptionsMenu00MESG Auto | Message Property OptionsMenu01MESG Auto ; submenu page 2 messagebox | ||
Message Property OptionsMenu01MESG Auto | Message Property OptionsMenu02MESG Auto ; submenu page 3 messagebox | ||
Message Property OptionsMenu02MESG Auto | |||
Armor MenuARMO | |||
bool abMenu | |||
;=================================================== | |||
Event OnEquipped(Actor akActor) | Event OnEquipped(Actor akActor) | ||
If akActor == | If akActor == Game.GetPlayer() | ||
menuARMO = self as Armor ; cast self as Armor | |||
akActor.UnequipItem(menuARMO, False, True) ; Silently unequip this item | |||
abMenu = TRUE | |||
Game.DisablePlayerControls(False, False, False, False, False, True) ; Temporarily disable other menus | |||
Game. | |||
Menu() | Menu() | ||
Game.EnablePlayerControls(False, False, False, False, False, True) ; Re-enable Player controls | |||
EndIf | EndIf | ||
EndEvent | EndEvent | ||
;=================================================== | |||
Function Menu() | |||
While abMenu | While abMenu | ||
int aiButton = MainMenuMESG.Show() | |||
If aiButton == 0 | |||
Submenu00() ; goto submenu00 | |||
ElseIf aiButton == 1 | |||
Submenu01() ; goto submenu01 | |||
ElseIf aiButton == 2 | |||
Submenu02() ; goto submenu02 | |||
ElseIf aiButton == 3 ; quit | |||
Return ; exits the menu function and while loop | |||
EndIf | EndIf | ||
Menu() ; loops the main menu | |||
EndWhile | EndWhile | ||
EndFunction | |||
;=================================================== | |||
Function Submenu00 | |||
int aiButton = OptionsMenu00MESG.Show() | |||
If aiButton == 0 | |||
; do stuff here | |||
ElseIf aiButton == 1 | |||
; do stuff here | |||
ElseIf aiButton == 2 | |||
; do stuff here | |||
ElseIf aiButton == 3 | |||
; do stuff here | |||
ElseIf aiButton == 4 | |||
; do stuff here | |||
ElseIf aiButton == 5 | |||
; do stuff here | |||
ElseIf aiButton == 6 | |||
; do stuff here | |||
ElseIf aiButton == 7 | |||
Submenu01() ; More - goto submenu01 | |||
ElseIf aiButton == 8 ; Return to main menu | |||
Return | |||
ElseIf aiButton == 9 ; Done - exit from all menus | |||
abMenu = FALSE ; stop the while loop | |||
Return | |||
EndIf | |||
Submenu00() ; loops this submenu | |||
EndFunction | |||
;=================================================== | |||
Function Submenu01 | |||
int aiButton = OptionsMenu01MESG.Show() | |||
If aiButton == 0 ; Back - goto submenu00 | |||
Submenu00() | |||
ElseIf aiButton == 1 | |||
; do stuff here | |||
ElseIf aiButton == 2 | |||
; do stuff here | |||
ElseIf aiButton == 3 | |||
; do stuff here | |||
ElseIf aiButton == 4 | |||
; do stuff here | |||
ElseIf aiButton == 5 | |||
; do stuff here | |||
ElseIf aiButton == 6 | |||
; do stuff here | |||
ElseIf aiButton == 7 | |||
Submenu02() ; More - goto submenu02 | |||
ElseIf aiButton == 8 ; Return to main menu | |||
Return | |||
ElseIf aiButton == 9 ; Done - exit from all menus | |||
abMenu = FALSE ; stop the while loop | |||
Return | |||
EndIf | |||
Submenu01() ; loops this submenu | |||
EndFunction | |||
;=================================================== | |||
Function Submenu02 | |||
int aiButton = OptionsMenu02MESG.Show() | |||
If aiButton == 0 ; Back - goto submenu00 | |||
Submenu01() | |||
ElseIf aiButton == 1 | |||
; do stuff here | |||
ElseIf aiButton == 2 | |||
; do stuff here | |||
ElseIf aiButton == 3 | |||
; do stuff here | |||
ElseIf aiButton == 4 | |||
; do stuff here | |||
ElseIf aiButton == 5 | |||
; do stuff here | |||
ElseIf aiButton == 6 | |||
; do stuff here | |||
ElseIf aiButton == 7 | |||
; do stuff here | |||
ElseIf aiButton == 8 ; Return to main menu | |||
Return | |||
ElseIf aiButton == 9 ; Done - exit from all menus | |||
abMenu = FALSE ; stop the while loop | |||
Return | |||
EndIf | |||
Submenu02() ; loops this submenu | |||
EndFunction | |||
;=================================================== | |||
EndFunction</source> | EndFunction</source> | ||