Difference between revisions of "Options Menu"

457 bytes added ,  06:52, 5 July 2012
m
→‎Multilevel, looping menu: Conditional added/toggle bFeatureEnabled example
imported>JustinOther
(Restored the spell example after reversion)
imported>JustinOther
m (→‎Multilevel, looping menu: Conditional added/toggle bFeatureEnabled example)
Line 70: Line 70:
EndFunction</source>
EndFunction</source>
== Multilevel, looping menu ==  
== Multilevel, looping menu ==  
*To make a multilevel, looping menu with thirty buttons that will not close until a "Done" button is pressed, use the above method but with an altered Menu() function. Note that you can jump to a given message by specifying the aiMessage argument when calling the function. Sub-options as described in the previous example can be added to the below in the same manner. Theoretically, any number of options can be added with the below structure.
*To make a multilevel, looping menu with thirty buttons that will not close until a "Done" button is pressed, use the above method but with an altered Menu() function. Note that you can jump to a given message by specifying the aiMessage argument when calling the function. Sub-options as described in the previous example can be added to the below in the same manner. Theoretically, any number of options can be added with the below structure. By making it conditional, we can check its property values with MessageBox buttons using [[GetVMScriptVariable]].
<source lang="papyrus">ScriptName OptionsMenuScript extends ObjectReference
<source lang="papyrus">ScriptName OptionsMenuScript Extends ObjectReference Conditional


Actor Property PlayerREF Auto
Actor Property PlayerREF Auto
Armor Property MenuARMO Auto ; Playable apparel item
Armor Property MenuARMO Auto ; Playable apparel item
Bool Property bFeatureEnabled Auto Conditional ; Toggling of this demonstrated below.
Message Property OptionsMenu00MESG Auto
Message Property OptionsMenu00MESG Auto
Message Property OptionsMenu01MESG Auto
Message Property OptionsMenu01MESG Auto
Line 95: Line 96:
ElseIf aiMessage == 0
ElseIf aiMessage == 0
aiButton = OptionsMenu00MESG.Show()
aiButton = OptionsMenu00MESG.Show()
If aiButton == 0
If aiButton == 0 ; This button has a GetVMScriptVariable condition so it only shows if bFeatureEnabled == True
ElseIf aiButton == 1
bFeatureEnabled = False
ElseIf aiButton == 1 ; This button has a GetVMScriptVariable condition so it only shows if bFeatureEnabled == False
bFeatureEnabled = True
ElseIf aiButton == 2
ElseIf aiButton == 2
ElseIf aiButton == 3
ElseIf aiButton == 3
Line 142: Line 145:
EndWhile
EndWhile
EndFunction</source>
EndFunction</source>
== Options menu via a spell ==
== 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:
*This next example shows how you would open a simple menu using a script attached to a MagicEffect form used by a Spell:
Anonymous user