Difference between revisions of "MessageBox Tutorial"
Jump to navigation
Jump to search
→Applying it all: Updated
imported>Haama (→Extras: Centralizing Menu Exits no longer needed) |
imported>Haama (→Applying it all: Updated) |
||
|
<pre>scn YourMenuScript
Short Working
Short Choosing
Short Choice
;GameMode and MenuMode variables
;Ensuring Your Menu Is Read variables
Short MessageCounter
Begin onActivate
If (Choosing >= 0) ;Controlling the menu system via external scripts
Set Choosing to -1
Endif
Set
Set MessageCounter to 0 ;Ensuring your menus are seen
If (MenuMode == 0) ;Running menus in both GameMode and MenuMode
Set GMRun to 1
Endif
End
Begin GameMode ;Running menus in both GameMode and MenuMode
If
Set GMRun to 0
Set MessageCounter to 0 ;Ensuring your menu is seen
;Add anything that needs to be re-initialized
Elseif GMRun
Set GMRun to 0
Set ExitButton to 0
Messagebox "Exiting options..."
Elseif (Choice == -1) ;Ensuring your menus are seen
if (MenuMode 1004 == 0) && (MenuMode 1005 == 0) && (MenuMode 1006 == 0) &&
(MenuMode
(MenuMode
(MenuMode
(MenuMode
endif
endif
else ;Choice
else ;Display
message "Trying menu again..."
Elseif (Choice != ExitButton)
Set
Messagebox "Exiting options..."
Elseif (Choice == ExitButton)
Set Choosing to 0
Endif
Set Working to 1
Endif
End
Begin MenuMode
If
If
Set GMRun to 0 ;Running menus in both GameMode and MenuMode
Set
Set MessageCounter to 0 ;Ensuring your menu is seen
;Add anything that needs to be re-initialized
;Ensuring your menu is seen
;Centralizing your menu decisions
Elseif (Choosing
(MenuMode 1010 == 0)
(MenuMode 1015 == 0)
(MenuMode 1018 == 0)
(MenuMode 1021 == 0)
(MenuMode 1039 == 0)
(MenuMode 1046 == 0)
set MessageCounter to (MessageCounter + 1)
else ;MenuMode 1001
set MessageCounter to 0
else ;Display menu again
set MessageCounter to 0
endif
Elseif (Choosing == -1) ;Display your menu
Set ExitButton to
Messagebox "What would you like to do?" "First Option"
Set Choosing to 1
Set Choice to
Elseif (Choosing == 1) ;Catch the player's decision
If (Choice == 0) ;First Option
;run your code for the first decision
Elseif (Choice == 1) ;Exit Menu
;run your code for the second descision
Set Choosing to 0 ;to finish up
Endif
short NumNewIngsDefault
elseif (Choosing == -2)
set ExitButton to -2 ;Running menus in both GameMode and MenuMode
messagebox "Set the default number of essences to be created.
(Currently %g)", NumNewIngsDefault,
"About 10 fewer (-12 to -8)"
"About 5 fewer (-7 to -3)"
"Default to that amount -2"
"Default to that amount -1"
"Default to that amount"
"Default to that amount +1"
"Default to that amount +2"
"About 5 more (+3 to +7)"
"About 10 more (+8 to +12)"
"Return to previous menu"
set Choosing to 2
set Choice to -1
elseif (Choosing == 2)
if (Choice == 0) ;10 fewer
set NumNewIngsDefault to (NumNewIngsDefault - 10)
set Choosing to -2
elseif (Choice == 1) ;5 fewer
set NumNewIngsDefault to (NumNewIngsDefault - 5)
set Choosing to -2
elseif (Choice == 7) ;5 more
set NumNewIngsDefault to (NumNewIngsDefault + 5)
set Choosing to -2
elseif (Choice == 8) ;10 more
set NumNewIngsDefault to (NumNewIngsDefault + 10)
set Choosing to -2
elseif (Choice == 2) ;-2
set NumNewIngsDefault to (NumNewIngsDefault - 2)
set Choosing to -1
elseif (Choice == 3) ;-1
set NumNewIngsDefault to (NumNewIngsDefault - 1)
set Choosing to -1
elseif (Choice == 4) ;Cancel
set Choosing to -1
elseif (Choice == 5) ;+1
set NumNewIngsDefault to (NumNewIngsDefault + 1)
set Choosing to -1
elseif (Choice == 6) ;+2
set NumNewIngsDefault to (NumNewIngsDefault + 2)
set Choosing to -1
elseif (Choice == 9) ;Return to previous menu
set Choosing to -1
endif
Endif
Set Working to 1
Endif
End</pre>
| |||