Difference between revisions of "Options Menu"
Jump to navigation
Jump to search
m
→Examples
imported>Threedee |
imported>Threedee m (→Examples) |
||
Line 3: | Line 3: | ||
== Examples == | == Examples == | ||
*For the first example, we'll have only three options: "Mage", "Thief", and "Warrior" | *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 | ||
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 == | If akNewContainer == Game.GetPlayer(); Only the player | ||
Int iButton = OptionsMESG.Show() ; Shows your menu. | Int iButton = OptionsMESG.Show() ; Shows your menu. | ||
akNewContainer.RemoveItem(MenuARMO, 1, True) ; Silently remove token | |||
If iButton == 0 ; Mage | If iButton == 0 ; Mage | ||
Debug.Notification("Mage selected") | Debug.Notification("Mage selected") |