Game Development Reference
In-Depth Information
TABLE 14.3
An Autogenerated Script
Line No.
Script
What It Means in English
0
Notes about how the script was made. Will
not be read because of // at the beginning.
//This script was auto-generated by AnnEnigma's
script autogenerator
1
//available at http://www.3greeneggs.com/autoscript/ Notes about where you can access the
Autoscript generator online.
2
Blank Line.
3
Blank Line.
4
Blank Line.
5
default
“Start here.”
6
{
New block of code, start of new State.
7
Blank Line.
8
Event: do something when touched, and
start of next block of code.
touch_start(integer total_number) {
9
Blank Line.
10
//change color!
Notes about what will happen.
11
llSetColor(<1.0,0,0>,ALL_SIDES);
Function: change the color to an RGB
percentage, on all sides (a CONSTANT ).
12
Blank Line.
13
}
End of block of code.
14
Blank Line.
15
}
Script over, go back to default.
This one is 15 lines long because it uses extra spaces to keep the script clear and easy to read. Let's go
through the lines again and look at the new things that have appeared.
Lines 0 to 1 are where Ann Enigma has made some comments about the script and where it came from.
When a scripter puts a double backslash in front of any line in these scripts, the lines will turn into
orange color-coded “comments,” which will not be read by the compiler as part of the active script.
This gives the scripter a place to add instructions and comment on the various aspects of more
complex scripts.
Lines 2-4 are Blank Lines to keep the script clean and neat.
Line 5 contains our old friend default , the built-in command that sets up the initial state of the script.
The cube is now waiting for an event to react to in the next state.
Line 6 contains the curly in bracket indicating the script block and new state will be starting.
Line 7 is blank for ease of reading the script.
Line 8 starts the now familiar touch _ start event, color coded as usual in blue. The line ends with
another curly brace, shown like this {, and here is where the next script block will be starting.
Line 9 is left blank for clarity.
Line 10 has another comment. It says  //ch a nge color! Here, the scripter is indicating that the next
line contains a function that will change the color of the cube.
 
Search WWH ::




Custom Search