Game Development Reference
Generating a random number
You can generate a random number using TScripts:
Random ( maxvalue )
The maxvalue is an integer value of the range of numbers the Random
command will generate. The generated number will be an integer
between zero and the maxvalue - 1.
The X position of the Toon Cheese is set to a random value between 0
Set Property (Cheese, x) = Random (100)
You can create individual subroutine scripts in TScripts, making your
scripts reusable and more manageable.
Adding a subroutine
1 Click on the Add Sub button in the TScript dialog box.
A subroutine is created and given an indexed name SubN. To rename the
subroutine simply overwrite its default name.
Script that is written between the On SubName and End tags will be run
every time the subroutine is called. A subroutine can be called as many
times as you like from the StartMovie script, another subroutine and
anywhere in the NewFrame script.
Calling a subroutine
Debugging using the Script Window
You can debug your TScripts by writing information to the script window
from within your scripts: