Difference between revisions of "Options Menu"
Jump to navigation
Jump to search
m
Swapped Game.GetPlayer() for PlayerREF property as it's so much faster
imported>JustinOther m |
imported>JustinOther m (Swapped Game.GetPlayer() for PlayerREF property as it's so much faster) |
||
Line 7: | Line 7: | ||
<source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference | <source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference | ||
Actor Property PlayerREF Auto | |||
Armor Property MenuARMO Auto | Armor Property MenuARMO Auto | ||
Message Property OptionsMESG Auto | Message Property OptionsMESG Auto | ||
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) | Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) | ||
If akNewContainer == | If akNewContainer == PlayerREF ; Only the player | ||
Int iButton = OptionsMESG.Show() ; Shows your menu. iButton == -1 until input | Int iButton = OptionsMESG.Show() ; Shows your menu. iButton == -1 until input | ||
If (iButton != -1) ; Wait for input | If (iButton != -1) ; Wait for input | ||
PlayerREF.RemoveItem(MenuARMO, 1, True) ; Silently remove token | |||
If | If iButton == 0 ; Mage | ||
Debug.Notification("Mage selected") | Debug.Notification("Mage selected") | ||
ElseIf | ElseIf iButton == 1 ; Thief | ||
Debug.Notification("Thief selected") | Debug.Notification("Thief selected") | ||
ElseIf | ElseIf iButton == 2 ; Warrior | ||
Debug.Notification("Warrior selected") | Debug.Notification("Warrior selected") | ||
EndIf | EndIf | ||
Line 44: | Line 45: | ||
Function Menu(Bool abMenu = True, Int aiButton = 0) | Function Menu(Bool abMenu = True, Int aiButton = 0) | ||
While abMenu | While abMenu | ||
If | If aiButton != -1 ; Wait for input | ||
aiButton = MainMenuMESG.Show() ; Main Menu | aiButton = MainMenuMESG.Show() ; Main Menu | ||
abMenu = False ; End the function | abMenu = False ; End the function | ||
If | If aiButton == 0 ; Breakfast | ||
aiButton = BreakfastMESG.Show() | aiButton = BreakfastMESG.Show() | ||
If | If aiButton == 0 ; Sweet Roll & Coffee | ||
ElseIf | ElseIf aiButton == 1 ; Pancakes, Bacon & Eggs | ||
ElseIf | ElseIf aiButton == 2 ; Chicken Fried Pony Steak | ||
EndIf | EndIf | ||
ElseIf | ElseIf aiButton == 1 ; Lunch | ||
aiButton = LunchMESG.Show() | aiButton = LunchMESG.Show() | ||
If | If aiButton == 0 ; Glazed Turkey Sandwich | ||
ElseIf | ElseIf aiButton == 1 ; Grilled Ham Sandwich | ||
ElseIf | ElseIf aiButton == 2 ; Shredded Pony Sandwich | ||
EndIf | EndIf | ||
ElseIf | ElseIf aiButton == 2 ; Dinner | ||
aiButton = DinnerMESG.Show() | aiButton = DinnerMESG.Show() | ||
If | If aiButton == 0 ; Filet Mignon | ||
ElseIf | ElseIf aiButton == 1 ; Pony Fajitas | ||
ElseIf | ElseIf aiButton == 2 ; Lobster | ||
EndIf | EndIf | ||
EndIf | EndIf | ||
Line 72: | Line 73: | ||
<source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference | <source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference | ||
Actor Property PlayerREF Auto | |||
Armor Property MenuARMO Auto ; Playable apparel item | Armor Property MenuARMO Auto ; Playable apparel item | ||
Message Property OptionsMenu00MESG Auto | Message Property OptionsMenu00MESG Auto | ||
Line 78: | Line 80: | ||
Event OnEquipped(Actor akActor) | Event OnEquipped(Actor akActor) | ||
If akActor == | If akActor == PlayerREF | ||
Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus | Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus | ||
PlayerREF.EquipItem(MenuARMO, True, True) ; Prevent unequip/reequip in favorites until the current menu is resolved | |||
Utility.Wait(0.01) ; This ensures equipping the token from the favorites menu works | Utility.Wait(0.01) ; This ensures equipping the token from the favorites menu works | ||
PlayerREF.UnequipItem(MenuARMO, False, True) ; Silently unequip item | |||
Game.EnablePlayerControls(abMenu = True) ; Undo DisablePlayerControls | Game.EnablePlayerControls(abMenu = True) ; Undo DisablePlayerControls | ||
Menu() | Menu() | ||
Line 90: | Line 92: | ||
Function Menu(Int aiMessage = 0, Int aiButton = 0, Bool abMenu = True) | Function Menu(Int aiMessage = 0, Int aiButton = 0, Bool abMenu = True) | ||
While abMenu | While abMenu | ||
If | If aiButton == -1 | ||
ElseIf | ElseIf aiMessage == 0 | ||
aiButton = OptionsMenu00MESG.Show() | aiButton = OptionsMenu00MESG.Show() | ||
If | If aiButton == 0 | ||
ElseIf | ElseIf aiButton == 1 | ||
ElseIf | ElseIf aiButton == 2 | ||
ElseIf | ElseIf aiButton == 3 | ||
ElseIf | ElseIf aiButton == 4 | ||
ElseIf | ElseIf aiButton == 5 | ||
ElseIf | ElseIf aiButton == 6 | ||
ElseIf | ElseIf aiButton == 7 | ||
ElseIf | ElseIf aiButton == 8 ; More | ||
aiMessage = 1 | aiMessage = 1 | ||
ElseIf | ElseIf aiButton == 9 ; Done | ||
abMenu = False | abMenu = False | ||
EndIf | EndIf | ||
ElseIf | ElseIf aiMessage == 1 | ||
aiButton = OptionsMenu01MESG.Show() | aiButton = OptionsMenu01MESG.Show() | ||
If | If aiButton == 0 | ||
ElseIf | ElseIf aiButton == 1 | ||
ElseIf | ElseIf aiButton == 2 | ||
ElseIf | ElseIf aiButton == 3 | ||
ElseIf | ElseIf aiButton == 4 | ||
ElseIf | ElseIf aiButton == 5 | ||
ElseIf | ElseIf aiButton == 6 | ||
ElseIf | ElseIf aiButton == 7 ; Back | ||
aiMessage = 0 | aiMessage = 0 | ||
ElseIf | ElseIf aiButton == 8 ; More | ||
aiMessage = 2 | aiMessage = 2 | ||
ElseIf | ElseIf aiButton == 9 ; Done | ||
abMenu = False | abMenu = False | ||
EndIf | EndIf | ||
ElseIf | ElseIf aiMessage == 2 | ||
aiButton = OptionsMenu02MESG.Show() | aiButton = OptionsMenu02MESG.Show() | ||
If | If aiButton == 0 | ||
ElseIf | ElseIf aiButton == 1 | ||
ElseIf | ElseIf aiButton == 2 | ||
ElseIf | ElseIf aiButton == 3 | ||
ElseIf | ElseIf aiButton == 4 | ||
ElseIf | ElseIf aiButton == 5 | ||
ElseIf | ElseIf aiButton == 6 | ||
ElseIf | ElseIf aiButton == 7 | ||
ElseIf | ElseIf aiButton == 8 ; Back | ||
aiMessage = 1 | aiMessage = 1 | ||
ElseIf | ElseIf aiButton == 9 ; Done | ||
abMenu = False | abMenu = False | ||
EndIf | EndIf |