Declaring/modifying variables
number1 = 0 //variable "number1" now exists and becomes the value of 0
number1 = (+ $number1 2) //variable "number1" is increased by 2
number1 = (- $number1 $number2) //variable "number1" is decreased by variable "number2"
Mapmodel & Entity commands
level_trigger_3 = [] //when approaching mapmodels with trigger tags of 3, carries out the script within the square brackets []
trigger 2 1 //mapmodels with trigger tags of 2 will carry out an animation based on their trigger types (uses numbers ranging from -1 to 1) Trigger Types List
platform 4 1 //platforms with a tag of 4 will move forward (-1 backward, 0 stop, 1 forward)
platform 4 1 //elevators with a tag of 4 will move up (-1 down, 0 stop, 1 up)
part_text_2 = "Enter here to begin." //particles with type "text" and alias 2 will display "Enter here to begin."
Guis
newgui Hello [] //creates a new gui window like the one when hitting Esc, scripting name for the gui is "Hello", displayed name is same as scripting name
newgui Hello [] "Stranger" //same as above except the displayed name is "Stranger"
guitext "Hello and welcome to sandbox script list." //adds text to the gui window showing "Hello and welcome to sandbox script list."
guitext "Hello and welcome to sandbox script list." chat //same as above however the icon to the left of the text is a chat bubble.
guibutton "Continue" "" //adds a button to the gui window displaying "Continue" and carries out the script in the second pair of quotation marks ""
guibutton "Continue" [] //same as above only carries out the script within the square brackets []
guilist [] //creates a vertical bar that allows you to create a list, script within that list is within the square brackets []
guibar //adds a bar to the gui window.
showgui Hello //will trigger newgui Hello
cleargui //removes all gui windows that are open
cleargui 2 //goes back 2 gui windows (e.g. from Hello3 back to Hello1)
Handy side commands
echo "Wow this works!" //displays "Wow this works!" in the top-left corner of the screen/window.
if (> $number1 4) [] //if variable "number1" is more than 4, then the script in the square brackets is carried out []
if (= $number1 $number2) [] [] //if variable "number1" is equal to variable "number2", then the script in the first square brackets is carried out, otherwise the script in the second square brackets is carried out
sleep 1000 [] //waits 1000 milliseconds before carrying out the script within the square brackets []
music "filepath+filename" //plays music from the filepath and name given inside the quotation marks ""
In place of quotation marks for text you can have: (format "You have %1 gold and %2 silver" $countgold countsilver) //after "guitext" for example, say countgold was 3 and countsilver was 5, it would display "You have 3 gold and 5 silver"
Anything you can write in console with a forward slash can be used in the map script without one. Note: for console commands that are editmode only, you have to save and load the map again before it lets you use them in the map script.
code example:
Code: Select all
level_trigger_1 = [
showgui Hello
]
newgui Hello [
guitext "Hello and welcome to the script list." chat
guitext "Would you like some help?" chat
guibar
guibutton "Yes" "showgui Hello_Yes"
guibutton "No" "cleargui"
]