Difference between revisions of "MessageBox Tutorial"

Jump to navigation Jump to search
1,042 bytes added ,  10:12, 17 June 2007
no edit summary
imported>Haama
imported>Haama
Line 309: Line 309:
==Extras==
==Extras==
That will take care of most menu systems you'll ever want to create. However, there is still more functioniality you can add to your menus. From here, you can either get it all by using the following script, or pick and choose using the mini-tutorials:
That will take care of most menu systems you'll ever want to create. However, there is still more functioniality you can add to your menus. From here, you can either get it all by using the following script, or pick and choose using the mini-tutorials:
<br>[[MessageBox_Tutorial:_Centralized_Decision_Catching|Centalizing your decision]] catching
<br>[[MessageBox_Tutorial:_Centralized_Decision_Catching|Centalizing your decision catching]]
<br>[[Messagebox_Tutorial:_Centralizing_Your_Menu_Exits|Centralizing your menu exits]]
<br>[[Messagebox_Tutorial:_Centralizing_Your_Menu_Exits|Centralizing your menu exits]]
<br>[[Messagebox_Tutorial:_GameMode_And_MenuMode|Running menus in both GameMode and MenuMode when your script is too large]]
<br>[[Messagebox_Tutorial:_GameMode_And_MenuMode|Running menus in both GameMode and MenuMode when your script is too large]]
Line 315: Line 315:
<br>[[Messagebox_Tutorial:_Set_Variables|Allowing the player to set a variable to any number]]
<br>[[Messagebox_Tutorial:_Set_Variables|Allowing the player to set a variable to any number]]
<br>[[MessageBox_Tutorial:_External_Menu_Selection|Controlling the menu system via external scripts]]
<br>[[MessageBox_Tutorial:_External_Menu_Selection|Controlling the menu system via external scripts]]
==Applying it all==
If you use want all of the above extras, your menu script will look like this:
<pre>scn YourMenuScript
Short Choosing
Short Choice
Begin onActivate
  Set Choosing to -1
  If (GetInSameCell player == 0) ;always keep it near the player
    MoveTo player
  Endif
End
Begin GameMode
  If (Choosing == 0) ;meaning it shouldn't be running
    If (GetInSameCell YourXMarker == 0)
      MoveTo YourXMarker
    Endif
  Elseif (Choosing == -1) ;Display your menu
    Messagebox "What would you like to do?" "First Option" "Second Option"
    Set Choosing to 1
    Set Choice to GetButtonPressed
    Return
  Elseif (Choosing == 1) ;Catch the player's decision
    If (Choice == -1) ;No choice yet
      Set Choice to GetButtonPressed
      Return
    Elseif (Choice == 0) ;First Option
      ;run your code for the first decision
      Set Choosing to 0 ;to finish up
    Elseif (Choice == 1) ;Second Option
      ;run your code for the second descision
      Set Choosing to 0 ;to finish up
    Endif
  Endif
End</pre>
<br>[[User:Haama|Haama]] 02:08, 14 June 2007 (EDT)
<br>[[User:Haama|Haama]] 02:08, 14 June 2007 (EDT)
[[Category: Scripting Tutorials]]
[[Category: Scripting Tutorials]]
Anonymous user

Navigation menu