Difference between revisions of "MessageBox Tutorial"

179 bytes removed ,  14:01, 25 August 2007
→‎Intro: Rewrite
imported>Haama
imported>Haama
(→‎Intro: Rewrite)
Line 3: Line 3:


==Intro==
==Intro==
Most of your menu needs can be taken care of with a simple [[Unplayable Items|token]] script:
Most MessageBox mistakes stem from adapting a script that works in some cases, but not in more complex situations. To prevent this, this tutorial will show you how to make an all-purpose script that can be used and expanded for any situation. We'll start out with some of the basic mechanics of the MessageBox and related functions, followed by common mistakes in complex scripts, and then the all-purpose script and how to set it up. Finally, we'll go through how to use the script to easily move between multi-layered menus, and some extras that you can tack on to it.
<pre>Begin onAdd
  Messagebox "Your message" "Some options"
End
 
Begin GameMode
  if (GetButtonPressed == -1)
    return
  else
    ;do stuff
    RemoveMe
  Endif
End</pre>
Just add the token to the player whenever you want to run the menu, but be aware that this script is severely limited in functionality. There are many ways to do menus, so this guide will lead up from the simplest menu (Done!) to a fully featured menu (well, featured enough for me) that will be able to:
*Use multiple choices
*Run the same choice for multiple frames
*Run multiple menus from one script
*Make it very easy to cut and paste for each new menu
*As well as some extras
 


==Basics==
==Basics==
Anonymous user