Game Development Reference
In-Depth Information
The arrayname can be a combination of numbers and characters, but
must not start with a number and you can't use any TScript command
names (key, set, call, etc.).
The indextotal is the maximum integer number of indexed values in the
array, up to a maximum of 255. The index values start at 0, so to declare
an array with 10 indices you would enter an indextotal of 9.
Arrays can be declared anywhere within your script, the most common
place being in the StartMovie script.
Using arrays
The syntax for setting an array is:
Set arrayname ( index ) = value
The index can be an integer or variable integer, and the value must be
numerical data.
To read an array's value you reference it by the arrayname and
An array of eight game scores score(n) is declared then initialized in the
StartMovie script. Then, in the NewFrame script, all the game scores are
accumulated in the variable total when the movie reaches frame 100.
On StartMovie
Array score(7)
Set num = 0
Set score(num) = 0
Set num = num + 1
Loop (num <= 7)
End StartMovie
On NewFrame
If (Get Property (scene, currentframe)) = 100
Set num = 0
Set total = 0
Set total = total + score(num)
Set num = num + 1
Loop (num <= 7)
End NewFrame
Search Nedrilad ::

Custom Search