Difference between revisions of "Options Menu"
Jump to navigation
Jump to search
→Examples
imported>Threedee |
imported>Threedee |
||
Line 12: | Line 12: | ||
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) | Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) | ||
If akNewContainer == Game.GetPlayer(); Only the player | If akNewContainer == Game.GetPlayer(); Only the player | ||
Int iButton = OptionsMESG.Show() ; Shows your menu. | Int iButton = OptionsMESG.Show() ; Shows your menu. Note that the menu will stay open until a menu button (0-9) is clicked on. | ||
akNewContainer.RemoveItem(self, 1, True) ; Silently remove token from the player | akNewContainer.RemoveItem(self, 1, True) ; Silently remove token from the player | ||
If iButton == 0 ; Mage | If iButton == 0 ; Mage | ||
Line 21: | Line 21: | ||
Debug.Notification("Warrior selected") | Debug.Notification("Warrior selected") | ||
EndIf | EndIf | ||
; note that if iButton (for whatever reason) returns any value other than 0-2, the menu will simply exit cleanly. | |||
EndIf | EndIf | ||
EndEvent</source> | EndEvent</source> | ||
Line 50: | Line 51: | ||
Function Menu() | Function Menu() | ||
int | int iButton = MainMenuMESG.Show() ; Main Menu | ||
If | If iButton == 0 ; Breakfast | ||
BreakfastMenu() | BreakfastMenu() | ||
ElseIf | ElseIf iButton == 1 ; Lunch | ||
LunchMenu() | LunchMenu() | ||
ElseIf | ElseIf iButton == 2 ; Dinner | ||
DinnerMenu() | DinnerMenu() | ||
ElseIf | ElseIf iButton == 3 ; Quit the menu | ||
Return | Return | ||
EndIf | EndIf | ||
; note: the menu will exit here unless we call Menu() again | ; note: the menu will exit here unless we call Menu() again | ||
; note that if iButton (for whatever reason) returns any value other than 0-3, the menu will simply exit cleanly. | |||
EndFunction | EndFunction | ||
Line 66: | Line 69: | ||
Function BreakfastMenu() | Function BreakfastMenu() | ||
int | int iButton = BreakfastMESG.Show() | ||
If | If iButton == 0 | ||
Debug.Notification("Choice = Sweet Roll & Coffee") | Debug.Notification("Choice = Sweet Roll & Coffee") | ||
ElseIf | ElseIf iButton == 1 | ||
Debug.Notification("Choice = Pancakes, Bacon & Eggs") | Debug.Notification("Choice = Pancakes, Bacon & Eggs") | ||
ElseIf | ElseIf iButton == 2 | ||
Debug.Notification("Choice = Chicken Fried Pony Steak") | Debug.Notification("Choice = Chicken Fried Pony Steak") | ||
ElseIf | ElseIf iButton == 3 ; Return to the main menu | ||
Return | Return | ||
EndIf | EndIf | ||
; note: the submenu will exit back to main menu from here unless we call BreakfastMenu() again | ; note: the submenu will exit back to main menu from here unless we call BreakfastMenu() again | ||
; note that if iButton (for whatever reason) returns any value other than 0-2, the submenu will simply exit back to the main menu. | |||
EndFunction | EndFunction | ||
Line 82: | Line 87: | ||
Function LunchMenu() | Function LunchMenu() | ||
int | int iButton = LunchMESG.Show() | ||
If | If iButton == 0 | ||
Debug.Notification("Choice = Glazed Turkey Sandwich") | Debug.Notification("Choice = Glazed Turkey Sandwich") | ||
ElseIf | ElseIf iButton == 1 | ||
Debug.Notification("Choice = Grilled Ham Sandwich") | Debug.Notification("Choice = Grilled Ham Sandwich") | ||
ElseIf | ElseIf iButton == 2 | ||
Debug.Notification("Choice = Shredded Pony Sandwich") | Debug.Notification("Choice = Shredded Pony Sandwich") | ||
ElseIf | ElseIf iButton == 3 ; Return to the main menu | ||
Return | Return | ||
EndIf | EndIf | ||
; note: the submenu will exit back to main menu from here unless we call LunchMenu() again | ; note: the submenu will exit back to main menu from here unless we call LunchMenu() again | ||
; note that if iButton (for whatever reason) returns any value other than 0-2, the submenu will simply exit back to the main menu. | |||
EndFunction | EndFunction | ||
Line 98: | Line 105: | ||
Function DinnerMenu() | Function DinnerMenu() | ||
iButton = DinnerMESG.Show() | |||
If | If iButton == 0 | ||
Debug.Notification("Choice = Filet Mignon") | Debug.Notification("Choice = Filet Mignon") | ||
ElseIf | ElseIf iButton == 1 | ||
Debug.Notification("Choice = Pony Fajitas") | Debug.Notification("Choice = Pony Fajitas") | ||
ElseIf | ElseIf iButton == 2 | ||
Debug.Notification("Choice = Lobster") | Debug.Notification("Choice = Lobster") | ||
ElseIf | ElseIf iButton == 3 ; Return to the main menu | ||
Return | Return | ||
EndIf | EndIf | ||
; note: the submenu will exit back to main menu from here unless we call DinnerMenu() again | ; note: the submenu will exit back to main menu from here unless we call DinnerMenu() again | ||
; note that if iButton (for whatever reason) returns any value other than 0-2, the submenu will simply exit back to the main menu. | |||
EndFunction | EndFunction | ||
Line 147: | Line 156: | ||
While abMenu | While abMenu | ||
int | int iButton = MainMenuMESG.Show() | ||
If | If iButton == 0 | ||
Submenu00() ; goto submenu00 | Submenu00() ; goto submenu00 | ||
ElseIf | ElseIf iButton == 1 | ||
Submenu01() ; goto submenu01 | Submenu01() ; goto submenu01 | ||
ElseIf | ElseIf iButton == 2 | ||
Submenu02() ; goto submenu02 | Submenu02() ; goto submenu02 | ||
ElseIf | ElseIf iButton == 3 ; quit | ||
Return ; exits the menu function and while loop | Return ; exits the menu function and while loop | ||
EndIf | EndIf | ||
Menu() ; loops the main menu | Menu() ; loops the main menu | ||
; note that if iButton (for whatever reason) returns any value other than 0-2, the menu will simply re-display. | |||
EndWhile | EndWhile | ||
Line 168: | Line 179: | ||
Function Submenu00() | Function Submenu00() | ||
int | int iButton = OptionsMenu00MESG.Show() | ||
If | If iButton == 0 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 1 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 2 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 3 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 4 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 5 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 6 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 7 | ||
Submenu01() ; More - goto submenu01 | Submenu01() ; More - goto submenu01 | ||
ElseIf | ElseIf iButton == 8 ; Return to main menu | ||
Menu() | Menu() | ||
ElseIf | ElseIf iButton == 9 ; Done - exit from all menus | ||
abMenu = FALSE ; stop the while loop | abMenu = FALSE ; stop the while loop | ||
Return | Return | ||
Line 194: | Line 205: | ||
Submenu00() ; loops this submenu | Submenu00() ; loops this submenu | ||
; note that if iButton (for whatever reason) returns any value other than 0-9, the submenu will simply re-display. | |||
EndFunction | EndFunction | ||
Line 201: | Line 213: | ||
Function Submenu01() | Function Submenu01() | ||
int | int iButton = OptionsMenu01MESG.Show() | ||
If | If iButton == 0 ; Back - goto submenu00 | ||
Submenu00() | Submenu00() | ||
ElseIf | ElseIf iButton == 1 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 2 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 3 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 4 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 5 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 6 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 7 | ||
Submenu02() ; More - goto submenu02 | Submenu02() ; More - goto submenu02 | ||
ElseIf | ElseIf iButton == 8 ; Return to main menu | ||
Menu() | Menu() | ||
ElseIf | ElseIf iButton == 9 ; Done - exit from all menus | ||
abMenu = FALSE ; stop the while loop | abMenu = FALSE ; stop the while loop | ||
Return | Return | ||
Line 227: | Line 239: | ||
Submenu01() ; loops this submenu | Submenu01() ; loops this submenu | ||
; note that if iButton (for whatever reason) returns any value other than 0-9, the submenu will simply re-display. | |||
EndFunction | EndFunction | ||
Line 234: | Line 247: | ||
Function Submenu02() | Function Submenu02() | ||
int | int iButton = OptionsMenu02MESG.Show() | ||
If | If iButton == 0 ; Back - goto submenu01 | ||
Submenu01() | Submenu01() | ||
ElseIf | ElseIf iButton == 1 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 2 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 3 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 4 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 5 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 6 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 7 | ||
; do stuff here | ; do stuff here | ||
ElseIf | ElseIf iButton == 8 ; Return to main menu | ||
Menu() | Menu() | ||
ElseIf | ElseIf iButton == 9 ; Done - exit from all menus | ||
abMenu = FALSE ; stop the while loop | abMenu = FALSE ; stop the while loop | ||
Return | Return | ||
Line 260: | Line 273: | ||
Submenu02() ; loops this submenu | Submenu02() ; loops this submenu | ||
; note that if iButton (for whatever reason) returns any value other than 0-9, the submenu will simply re-display. | |||
EndFunction | EndFunction | ||
Line 295: | Line 309: | ||
Debug.Notification("Warrior selected") | Debug.Notification("Warrior selected") | ||
EndIf | EndIf | ||
; note that the menu will simply exit, no matter what value is returned by iButton. | |||
EndFunction | EndFunction | ||