Difference between revisions of "Options Menu"

Jump to navigation Jump to search
925 bytes added ,  06:28, 5 July 2012
Restored the spell example after reversion
imported>JustinOther
m (Put new example/notes back in.)
imported>JustinOther
(Restored the spell example after reversion)
Line 142: Line 142:
EndWhile
EndWhile
EndFunction</source>
EndFunction</source>
== Options menu via a spell ==
*This next example shows how you would open a simple menu using a script attached to a MagicEffect form used by a Spell:


<source  lang="papyrus">ScriptName OptionsMenuScript extends ActiveMagicEffect
{ A template for a MagicEffect script that opens a simple menu.}
Message Property OptionsMESG Auto ; The Message form that configures the menu buttons
Event OnEffectStart(Actor akTarget, Actor akCaster)
If akCaster == Game.GetPlayer() ; Only the player can open the menu
Menu()
EndIf
Dispel()
EndEvent
Function Menu() ; note that the menu will simply exit, no matter what value is returned by iButton.
Int iButton = OptionsMESG.Show() ; Shows your menu.
If iButton == 0  ; Mage
Debug.Notification("Mage selected")
ElseIf iButton == 1 ; Thief
Debug.Notification("Thief selected")
ElseIf iButton == 2 ; Warrior
Debug.Notification("Warrior selected")
EndIf
EndFunction</source>
=== Notes ===
=== Notes ===
*Given the buttons in Skyrim are listed from side to side, it is easy to spill over the edges of the user's monitor, particularly if it's a 4:3, in the event either the options are too verbose or there are too many options presented by a single message form. Currently, there's no way to list them from top to bottom as they were in previous Bethesda games. To mitigate this, keep the button text to a minimum and/or make sure to always set up conditions on mutually exclusive buttons to ensure only applicable options are presented.
*Given the buttons in Skyrim are listed from side to side, it is easy to spill over the edges of the user's monitor, particularly if it's a 4:3, in the event either the options are too verbose or there are too many options presented by a single message form. Currently, there's no way to list them from top to bottom as they were in previous Bethesda games. To mitigate this, keep the button text to a minimum and/or make sure to always set up conditions on mutually exclusive buttons to ensure only applicable options are presented.
Anonymous user

Navigation menu