Difference between revisions of "MessageBox Tutorial"

Jump to navigation Jump to search
1,034 bytes removed ,  10:38, 29 August 2007
imported>Haama
imported>Haama
...</pre>
Note that both halves are required for each menu. To help keep things organized, you can set one to a negative number, and the other to a positive number, as in the above script.
 
 
===(Non-working, but insightful) Example Script for the above concepts===
With those in mind, here's a basic menu script. (You may also notice that it doesn't quite work, that'll be explained afterwards.)
<pre>Short Choosing
 
 
 
Begin GameMode
If (Choosing == 0)
Messagebox "What would you like to do?" "First Option"
Set Choosing to 1
Return
Else
If (GetButtonPressed > -1) ;Player has made a decision
If (GetButtonPressed == 0) ;First Option
;whatever you want to do
Set Choosing to 0
Endif
Else ;if (GetButtonPressed <= -1) - no decision
Return ;Try to catch the decision in the next frame
Endif
Endif
End</pre>
The variable "Choosing" is used to separate the display of the menu and the catching of the player's decision. Since it's in a [[GameMode]] block, the script will run every frame. [[GetButtonPressed]] will return '''''-1''''' until the player makes a decision, in which case it will return '''''0''''' or '''''1''''', depending on the player's decision.
 
==Avoiding Common Mistakes for More Complex Menus==
Anonymous user

Navigation menu