Difference between revisions of "Options Menu"

Jump to navigation Jump to search
75 bytes removed ,  07:44, 13 June 2012
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 == Game.GetPlayer() ; Only the player
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
Game.GetPlayer().RemoveItem(MenuARMO, 1, True) ; Silently remove token
PlayerREF.RemoveItem(MenuARMO, 1, True) ; Silently remove token
If (iButton == 0) ; Mage
If iButton == 0  ; Mage
Debug.Notification("Mage selected")
Debug.Notification("Mage selected")
ElseIf (iButton == 1) ; Thief
ElseIf iButton == 1 ; Thief
Debug.Notification("Thief selected")
Debug.Notification("Thief selected")
ElseIf (iButton == 2) ; Warrior
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 (aiButton != -1) ; Wait for input
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 (aiButton == 0) ; Breakfast
If aiButton == 0 ; Breakfast
aiButton = BreakfastMESG.Show()
aiButton = BreakfastMESG.Show()
If (aiButton == 0) ; Sweet Roll & Coffee
If aiButton == 0 ; Sweet Roll & Coffee
ElseIf (aiButton == 1) ; Pancakes, Bacon & Eggs
ElseIf aiButton == 1 ; Pancakes, Bacon & Eggs
ElseIf (aiButton == 2) ; Chicken Fried Pony Steak
ElseIf aiButton == 2 ; Chicken Fried Pony Steak
EndIf
EndIf
ElseIf (aiButton == 1) ; Lunch
ElseIf aiButton == 1 ; Lunch
aiButton = LunchMESG.Show()
aiButton = LunchMESG.Show()
If (aiButton == 0) ;  Glazed Turkey Sandwich
If aiButton == 0 ;  Glazed Turkey Sandwich
ElseIf (aiButton == 1) ; Grilled Ham Sandwich
ElseIf aiButton == 1 ; Grilled Ham Sandwich
ElseIf (aiButton == 2) ; Shredded Pony Sandwich
ElseIf aiButton == 2 ; Shredded Pony Sandwich
EndIf
EndIf
ElseIf (aiButton == 2) ; Dinner
ElseIf aiButton == 2 ; Dinner
aiButton = DinnerMESG.Show()
aiButton = DinnerMESG.Show()
If (aiButton == 0) ; Filet Mignon
If aiButton == 0 ; Filet Mignon
ElseIf (aiButton == 1) ; Pony Fajitas
ElseIf aiButton == 1 ; Pony Fajitas
ElseIf (aiButton == 2) ; Lobster
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 == Game.GetPlayer()
If akActor == PlayerREF
Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus
Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus
Game.GetPlayer().EquipItem(MenuARMO, True, True) ; Prevent unequip/reequip in favorites until the current menu is resolved
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
Game.GetPlayer().UnequipItem(MenuARMO, False, True) ; Silently unequip item
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 (aiButton == -1)
If aiButton == -1
ElseIf (aiMessage == 0)
ElseIf aiMessage == 0
aiButton = OptionsMenu00MESG.Show()
aiButton = OptionsMenu00MESG.Show()
If (aiButton == 0)
If aiButton == 0
ElseIf (aiButton == 1)
ElseIf aiButton == 1
ElseIf (aiButton == 2)
ElseIf aiButton == 2
ElseIf (aiButton == 3)
ElseIf aiButton == 3
ElseIf (aiButton == 4)
ElseIf aiButton == 4
ElseIf (aiButton == 5)
ElseIf aiButton == 5
ElseIf (aiButton == 6)
ElseIf aiButton == 6
ElseIf (aiButton == 7)
ElseIf aiButton == 7
ElseIf (aiButton == 8) ; More
ElseIf aiButton == 8 ; More
aiMessage = 1
aiMessage = 1
ElseIf (aiButton == 9) ; Done
ElseIf aiButton == 9 ; Done
abMenu = False
abMenu = False
EndIf
EndIf
ElseIf (aiMessage == 1)
ElseIf aiMessage == 1
aiButton = OptionsMenu01MESG.Show()
aiButton = OptionsMenu01MESG.Show()
If (aiButton == 0)
If aiButton == 0
ElseIf (aiButton == 1)
ElseIf aiButton == 1
ElseIf (aiButton == 2)
ElseIf aiButton == 2
ElseIf (aiButton == 3)
ElseIf aiButton == 3
ElseIf (aiButton == 4)
ElseIf aiButton == 4
ElseIf (aiButton == 5)
ElseIf aiButton == 5
ElseIf (aiButton == 6)
ElseIf aiButton == 6
ElseIf (aiButton == 7) ; Back
ElseIf aiButton == 7 ; Back
aiMessage = 0
aiMessage = 0
ElseIf (aiButton == 8) ; More
ElseIf aiButton == 8 ; More
aiMessage = 2
aiMessage = 2
ElseIf (aiButton == 9) ; Done
ElseIf aiButton == 9 ; Done
abMenu = False
abMenu = False
EndIf
EndIf
ElseIf (aiMessage == 2)
ElseIf aiMessage == 2
aiButton = OptionsMenu02MESG.Show()
aiButton = OptionsMenu02MESG.Show()
If (aiButton == 0)
If aiButton == 0
ElseIf (aiButton == 1)
ElseIf aiButton == 1
ElseIf (aiButton == 2)
ElseIf aiButton == 2
ElseIf (aiButton == 3)
ElseIf aiButton == 3
ElseIf (aiButton == 4)
ElseIf aiButton == 4
ElseIf (aiButton == 5)
ElseIf aiButton == 5
ElseIf (aiButton == 6)
ElseIf aiButton == 6
ElseIf (aiButton == 7)
ElseIf aiButton == 7
ElseIf (aiButton == 8) ; Back
ElseIf aiButton == 8 ; Back
aiMessage = 1
aiMessage = 1
ElseIf (aiButton == 9) ; Done
ElseIf aiButton == 9 ; Done
abMenu = False
abMenu = False
EndIf
EndIf
Anonymous user

Navigation menu