Difference between revisions of "Options Menu"

Jump to navigation Jump to search
13 bytes removed ,  07:35, 13 June 2012
m
no edit summary
imported>JustinOther
m
imported>JustinOther
m
Line 11: Line 11:


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If akNewContainer == Game.GetPlayer() ; Only the player
If akNewContainer == Game.GetPlayer() ; Only the player
Int iButton = OptionsMESG.Show() ; Shows your menu. iButton == -1 until input
Int iButton = OptionsMESG.Show() ; Shows your menu. iButton == -1 until input
Line 25: Line 24:
EndIf
EndIf
EndIf
EndIf
EndEvent</source>
EndEvent</source>


Line 39: Line 37:


Event OnRead()
Event OnRead()
Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus
Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus
Game.EnablePlayerControls(abMenu = True) ; Undo DisablePlayerControls
Game.EnablePlayerControls(abMenu = True) ; Undo DisablePlayerControls
Menu()
Menu()
EndEvent  
EndEvent  


Function Menu(Bool abMenu = True, Int aiButton = 0)
Function Menu(Bool abMenu = True, Int aiButton = 0)
While abMenu
While abMenu
If (aiButton != -1) ; Wait for input
If (aiButton != -1) ; Wait for input
Line 73: Line 68:
EndIf
EndIf
EndWhile
EndWhile
EndFunction</source>
EndFunction</source>
*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.
Line 84: Line 78:


Event OnEquipped(Actor akActor)
Event OnEquipped(Actor akActor)
If akActor == Game.GetPlayer()
If akActor == Game.GetPlayer()
Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus
Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus
Line 93: Line 86:
Menu()
Menu()
EndIf
EndIf
EndEvent
EndEvent


Function Menu(Int aiMessage = 0, Int aiButton = 0, Bool abMenu = True)
Function Menu(Int aiMessage = 0, Int aiButton = 0, Bool abMenu = True)
While abMenu
While abMenu
If (aiButton == -1)
If (aiButton == -1)
Line 148: Line 139:
EndIf
EndIf
EndWhile
EndWhile
EndFunction</source>
EndFunction</source>


Anonymous user

Navigation menu