Difference between revisions of "Options Menu"

Jump to navigation Jump to search
28 bytes added ,  20:52, 3 July 2012
m
imported>Threedee
imported>Threedee
Line 3: Line 3:


== Examples ==
== Examples ==
*For the first example, we'll have only three options: "Mage", "Thief", and "Warrior". The token should be unplayable in this case. When the item is added to the player, the menu will be prompted and will exit as soon as a button is selected, executing the appropriate code right after the token is silently removed.
*For the first example, we'll have only three options: "Mage", "Thief", and "Warrior". When the token is added to the player, the menu will be prompted and will exit as soon as a button is selected, executing the appropriate code right after the token is silently removed.


<source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference
<source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference


Actor Property PlayerREF Auto
Armor Property MenuARMO Auto ; The token that holds the menu script
Armor Property MenuARMO Auto
Message Property OptionsMESG Auto ; The Message form that configures the menu buttons
Message Property OptionsMESG Auto


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If akNewContainer == PlayerREF ; Only the player
If akNewContainer == Game.GetPlayer(); Only the player
Int iButton = OptionsMESG.Show() ; Shows your menu.
Int iButton = OptionsMESG.Show() ; Shows your menu.
PlayerREF.RemoveItem(MenuARMO, 1, True) ; Silently remove token
akNewContainer.RemoveItem(MenuARMO, 1, True) ; Silently remove token
If iButton == 0  ; Mage
If iButton == 0  ; Mage
Debug.Notification("Mage selected")
Debug.Notification("Mage selected")
Anonymous user

Navigation menu