Difference between revisions of "Options Menu"
Jump to navigation
Jump to search
m
→Single Level Menu: iButton Δ aiButton
imported>JustinOther (Merged single level examples as they're essentially the same. Omitted 'Dispel()' from ActiveMagicEffect example as it's unnecessary and causes an error. Swapped Game.GetPlayer() for PlayerREF for consistency and 'cause it's substantially 'cheaper'.) |
imported>JustinOther m (→Single Level Menu: iButton Δ aiButton) |
||
Line 37: | Line 37: | ||
EndEvent | EndEvent | ||
Function Menu() ; The menu will exit on its own after a selection is made. | Function Menu(Int aiButton = 0) ; The menu will exit on its own after a selection is made. | ||
aiButton = OptionsMESG.Show() ; Shows your menu. | |||
If | If aiButton == 0 ; Mage | ||
Debug.Notification("Mage selected") | Debug.Notification("Mage selected") | ||
ElseIf | ElseIf aiButton == 1 ; Thief | ||
Debug.Notification("Thief selected") | Debug.Notification("Thief selected") | ||
ElseIf | ElseIf aiButton == 2 ; Warrior | ||
Debug.Notification("Warrior selected") | Debug.Notification("Warrior selected") | ||
EndIf | EndIf | ||
EndFunction</source> | EndFunction</source> | ||
== Menu with sub-options == | == Menu with sub-options == | ||
For this example, we'll offer sub-options for each main selection. For a multilevel menu, a function works well. Keep in mind each button can have conditions, so you could hide "Lunch" and "Dinner" if it's time for breakfast or hide "Lobster" if it's not currently available. In this case, to make it repeatable, we'll use a book so the menu will show each time it is read. A book cannot be favorited or hotkeyed, unlike an apparel item. A potion can be hotkeyed, but it will be consumed when used and not remain hotkeyed even if immediately replaced. This example will let the user choose breakfast, lunch, or dinner, then close after one meal is selected. As your options become fleshed out, keep in mind that you can add and use arguments to store information temporarily rather than necessitating declarations of more variables or properties. | For this example, we'll offer sub-options for each main selection. For a multilevel menu, a function works well. Keep in mind each button can have conditions, so you could hide "Lunch" and "Dinner" if it's time for breakfast or hide "Lobster" if it's not currently available. In this case, to make it repeatable, we'll use a book so the menu will show each time it is read. A book cannot be favorited or hotkeyed, unlike an apparel item. A potion can be hotkeyed, but it will be consumed when used and not remain hotkeyed even if immediately replaced. This example will let the user choose breakfast, lunch, or dinner, then close after one meal is selected. As your options become fleshed out, keep in mind that you can add and use arguments to store information temporarily rather than necessitating declarations of more variables or properties. |