DB Manual 1.13
DB Manual 1.13
PROGRAMMING LANGUAGE
USER Manual
(REVISED FOR VERSION 1.13)
INTRODUCTION ........................................................................................................................................... 2
PROGRAMMING PRINCIPALS ................................................................................................................... 3
Data Types, Variables and Arrays ............................................................................................................... 4
Arithmetic, Relational and Boolean Operators ............................................................................................ 8
Common Statements .................................................................................................................................. 10
Common and User Functions .....................................................................................................................15
Reserved Words, Remarks and Spacing .................................................................................................... 17
Errors and Warnings .................................................................................................................................. 19
FAST TRACK LEARNING ..........................................................................................................................20
TUTORIALS ................................................................................................................................................. 24
DarkBASIC REFERENCE ............................................................................................................................ 34
Basic Command Set ................................................................................................................................... 34
Input Command Set ................................................................................................................................... 42
Math Command Set ................................................................................................................................... 59
Basic 2D Command Set ............................................................................................................................. 62
Text Command Set .....................................................................................................................................64
Screen Command Set ................................................................................................................................. 68
Bitmap Command Set ................................................................................................................................ 70
Sprite Command Set .................................................................................................................................. 73
Sound Command Set ..................................................................................................................................78
Music Command Set ..................................................................................................................................83
Animation Command Set ...........................................................................................................................85
Basic 3D Command Set ............................................................................................................................. 88
Camera 3D Command Set ........................................................................................................................113
3D Lighting .............................................................................................................................................. 117
Matrix 3D Command Set ......................................................................................................................... 122
System Command Set .............................................................................................................................. 127
Memory Blocks ........................................................................................................................................134
Multiplayer ...............................................................................................................................................140
Hidden Commands ...................................................................................................................................146
GLOSSARY .................................................................................................................................................148
Command Index ...........................................................................................................................................156
1
INTRODUCTION
Welcome to the Dark Basic programming language, the most powerful BASIC language on the planet. Dark
Basic requires no knowledge of programming, operating systems, previous creativity tools or utilities. All
that is required from you is a good imagination and the desire to create your own software. The rest you
can learn.
Dark Basic allows you to create anything from a simple text program to a fast full screen 3D game. A single
command can give you access to sound, music, animation, text and graphics with incredible ease. You can
read and control peripheral devices such as force feedback joysticks and head mounted displays. The only
thing between you and the creation of commercial quality software is time and talent.
There are two schools of learning open to you. You may choose an academic route that details the various
aspects of the BASIC language and prepares a foundation on which you can build. Alternatively, you may
opt for the fast track that gives you a taste of programming in less than 15 minutes.
Within this manual you’ll also find reference to commands from the Enhacements Pack. At the time of
writing, Enhancement commands can be bolted on to DarkBASIC buy purchasing the DarkMATTER Product.
For more details visit the DarkMATTER web site at www.darkbasic.com/darkmatter
2
PROGRAMMING PRINCIPALS
The purpose of this section of the help is to teach you how to write your own DARK BASIC programs. BASIC
is an acronym for Beginners All-purpose Symbolic Instruction Code. DARK derives from the term 'Dark
Horse' (go ahead, look it up). The traditional description of a program is a task that you want your computer
to perform. The task is described to the computer using statements DARK BASIC can understand.
Statements in your program must be written using a set of rules known as 'SYNTAX'. You must follow these
rules if you are to write DARK BASIC programs. By proceeding through these sections in sequence, you will
gain a firm understanding about the general rules of BASIC and how to apply them as a programmer.
Common Statements
3
Data Types, Variables and Arrays
DATA TYPES
We have established that statements are used to write a program. A statement can be broken up into a
command and its data. The command is the operation, or task you wish to perform. The data is that which
must be used by the command to complete the operation. The data is also referred to as the parameter(s).
There are three types of data you can use. Integer numbers, real numbers and string. Each type of data
holds a slightly different type of value.
Integer Numbers
An integer number can hold a whole number, but no fraction. For the value to be negative, you must place
a hyphen symbol (-) before the value. You must not use commas as part of the number as this would
generate a
42
10000
-233000
-100
Real Numbers
A real number can hold a whole number or a fractional number that uses a decimal point. For the value to
be negative, you must place a hyphen symbol (-) before the value. Examples of real numbers:
20.0005
99.9
-5000.12
-9999.9991
Strings
String data is non-numerical, and is used to store characters and words. All strings consist of characters
enclosed within double quotation marks. The string data can include numbers and other numerical symbols
but will be treated as text. Examples of strings are:
"A"
"Hello World"
"Telephone"
"I am 99 years old"
"1.2.3.4.5.6.7.8.9"
Each string can consist of up to 255 characters. You can also have a string with no data whatsoever,
represented by an empty pair of double quotation marks.
VARIABLES
The best way to demonstrate what a variable does is by way of an example. Take the calculation:
A = 3 + 4
A variable is used to store a value. It's that simple. You can have a variable that stores any type of data,
and you can have as many as you want. The following program shows you how the contents of the variable
can be output to the screen:
A = 3 + 4
4
PRINT A
Now take the next example to show you how variables can be used as freely as standard number types:
A = 2
B = 8
C = A + B
PRINT C
In the preceding example, 3 is stored in the A variable, 4 is stored in the B variable and C is given the result
of the calculation between A and B. The calculation is based on the values stored within the variables and
so the calculation is actually C = 2 + 8. The result, which in this case is 10, is stored as the new value of C
and this is the value that eventually gets printed to the screen.
So far, we have seen variables used to store and recall integer values. Variables can also store real numbers
and strings. In order to allow a variable to store these other types of data, you must make sure the variable
is recognized as an integer, real or string variable. To name a real number variable, you must add a hash
character (#) as the last character of the variable name. If you want your variable to store a string, you
must add a dollar character ($) as the last character of the variable name. Lets see these new variables
used to store and recall real values:
mydata#=42.5
PRINT mydata#
By adding the (#) symbol, we are instructing the program to treat the variable as a real number variable.
Exactly the same rule applies to a string variable:
myname$="Lee"
PRINT myname$
All variable names can use either upper or lower case characters, which means a variable called NAME$ is
the same variable as name$ or Name$. String variables even support the use of limited maths. The
following example adds two strings together and the result is a concatenation of the two strings:
a$="Hello"
b$="World"
c$=a$+b$
print c$
To run this example, the text "HelloWorld" will be printed to the screen. Would you be able to alter this
example to place a space between "Hello" and "World"?
ARRAYS
Arrays are going to be a very important part of your future programs. They allow you to store large
amounts of data under a single name. You can then access the data by index rather than by name alone.
If you had to write a program that stored each weeks lottery numbers, typing out 52 unique variable names
is a lot of work, hard to maintain and quite unnecessary. Arrays allow you to create a special kind of
variable that can store more than one item of data. You might start your program like this:
lottery1$="43,76,12,34,12,11"
lottery2$="76,12,34,12,11,44"
lottery3$="12,34,12,02,05,07"
etc..
Two hours later, you realize you could have written it like this:
DIM lottery$(52)
lottery$(1)="43,76,12,34,12,11"
lottery$(2)="76,12,34,12,11,44"
lottery$(3)="12,34,12,02,05,07"
5
etc..
We declare a string array using the DIM command followed by a name for our array. Like variables, when
we use a dollar symbol after the name we instruct the program to use the array to store only strings. We
then enclose in brackets how many items of data we wish the array to store. The array can be filled almost
like a variable, but you must also provide the position within the array you wish to store your data.
But you then ask yourself what benefits I would have gained using the second approach. If you where also
required to print out all 52 lottery numbers to the screen with your first approach you would have to add
another 52 statements that printed each variable:
PRINT lottery1$
PRINT lottery2$
PRINT lottery3$
etc..
But if you had used an array, the same example would look like this:
PRINT lottery$(1)
PRINT lottery$(2)
PRINT lottery$(3)
etc..
You will have noticed that by using an array, you no longer have to refer to your data using a unique
variable name. You can now point to the data you want using a position number. Accessing data this way
has a thousand advantages over trying to access data by variable name alone, as you will discover. One
example would be to improve the above like this:
FOR T=1 TO 52
PRINT lottery$(T)
NEXT T
Incredibly the above code replaced 52 PRINT statements with just 3 statements. With the above example, T
is incremented from 1 to 52 within a loop that prints out the contents of the array at that position.
Arrays can also store multiple levels of data. At the moment our lottery entries are stored as strings and the
numbers are hard to get at. Let's say we wanted to store all six numbers for every lottery week, we would
create an array like this:
DIM lottery(52,6)
Without the dollar symbol($), we are declaring the array to store integer numbers instead of strings. You
will also notice we have a second number separated by a comma. This means for every array position from
1 to 52, there is a sub-set numbered 1 to 6 in which multiple data can be stored. You can visualize an array
as a filing cabinet with large draws numbered 1 to 52. Within each of the 52 draws is a tray with 6 boxes
inside. You can store a value in each box. In all you can store 312 (52 x 6) values in this array. You can
have up to five dimensions in your array, which means you can create an array as big as (1,2,3,4,5). Be
careful when declaring dimensions as large arrays consume large amounts of memory and may reduce
overall performance of your program.
lottery(1,1)=43
lottery(1,2)=76
lottery(1,3)=12
lottery(1,4)=34
lottery(1,5)=12
lottery(1,6)=11
lottery(2,1)=43
lottery(2,2)=76
lottery(2,3)=12
lottery(2,4)=34
6
lottery(2,5)=12
lottery(2,6)=11
You are now able to give your program access to much more useful data. Unlike the string approach, you
could make your program count how many times a certain number has appeared.
As you have determined, arrays need to be declared as a particular type. You can have an array of integer
numbers, real numbers or strings. You cannot have multiple types in the same array, but you can declare
new arrays dedicated to holding such data.
7
Arithmetic, Relational and Boolean
Operators
We have already used one type of well-known operator in the preceding examples. Operators are the term
given to a mathematical symbol used in all calculations. The most common operators are arithmetic
operators and are quickly identified. All operators require two operands of data that are placed either side of
the operator.
ARITHMETIC OPERATORS
An arithmetic operator can represent an Addition, Subtraction, Multiplication or Division. These operators
are represented symbolically as (+) (-) (*) (/) respectively.
The Plus(+) sign specifies that the data on the right of the plus sign must be added to the data on the left.
Examples of which you have already seen are:
3 + 4 equals 7
A + B equals the value of B added to the value of A
The minus(-) sign specifies that the data to the right of the minus sign must be subtracted from the data to
the left of the minus sign:
3 - 4 equals -1
A - B equals the value of B subtracted from the value of A
An aster(*) specifies that the data on the right side of the aster is multiplied by the data on the left side if
the aster:
3 * 4 equals 12
A * B equals the value of B multiplied by the value of A
The slash(/) specifies that the data on the right side of the slash is to be divided by the data on the left side
of the slash:
10 / 2 equals 5
A / B equals the value of B divided by the value of A
RELATIONAL OPERATORS
These operators are less common, unless you have programming experience. These operators represent
conditions that are applied to data. The conditions handled are Equal To, Greater Than, Less Than, Greater
or Equal To, Less or Equal To and Not Equal To. The purposes of these conditions are to determine the
result of a comparison between two data values. A condition result can only be of two possible values. If the
condition is false, the resulting value is zero. If the condition is true, the resulting value is one. Take the
following examples:
The same relational operators can be applied to real numbers, integer and real variables and in some case
strings and string variables. You can compare whether two strings are the same or not the same, but you
cannot test whether one string is greater or less than another.
BOOLEAN OPERATORS
8
Simple Boolean operators provide the last type of operator. Although traditionally there are four types of
Boolean operators, DARK BASIC only provides the AND and OR operators. These operators allow your
program to perform logical operations on your data.
The AND operator works with any integer value, but for demonstration purposes the general rule applies
when using this operator:
0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1
What you see is the decision tree of the AND operator. It shows that only if both data operands of the AND
operator are 1 will the result be a 1 also. All other cases a zero is returned. To see how this logic works in
reality, take the following example:
A=5
B=25
(A > 10) AND (B > 20) so what is the resulting value?
We can determine the result of the parts enclosed in brackets first. We can see the relational operators
provide us with the following results:
The logic of the table is that only when both sides of the AND operand are 1 will the result of the calculation
be 1 also. What would happen if you change the value of A to 15?
The OR operator works in a similar fashion, but using the following table. If either the left side or right has a
value of 1, the result will be 1:
0 OR 0 = 0
0 OR 1 = 1
1 OR 0 = 1
1 OR 1 = 1
You will discover how useful these operators become when writing conditions for your programs. Being able
to write conditions with multiple parts will become increasingly important as you begin to write more
complex programs.
9
Common Statements
ASSIGNMENT STATEMENTS
You have already used an assignment statement, and is probably the most commonly used part of any
programming language. The Equal Symbol (=) is used to assign a value to a variable or array. Take the
following examples:
a=42
a#=99.9
a$="HELLO"
lottery(1,1)=49
DATA 9,"NINE",9.9
READ a,a$,a#
The DATA command accepts a list of data items separated by a comma. The data items do not have to be
of the same type, but they do need to be read in the right type order. As you can see our first item of data
is an integer number of 9, then a string with the text "NINE" and a real number with a value of 9.9.
The READ command also accepts a list, but the list must contain variables that are of the correct type to
read the data. When an item of data is read, a pointer moves to the next item of data stored in the list. The
first item of data is an integer, which means the value of 9 is stored in the integer variable of A successfully.
The data pointer then moves to the next item that is the string that stored "NINE" text. This is read and
stored in the string variable A$. The same applies to the real number data of 9.9.
If you where to visualize the data list in memory it would look like this:
9
"NINE"
9.9
If you tried to read the integer value of 9 into a string variable, an empty string will be stored as the types
are incompatible. If you tried to read a string into an integer or real variable, a zero will be stored. It is your
responsibility to make sure the type order used to store you data is the same when you come to read it
back.
RESTORE STATEMENTS
You are able to reset the data pointer at any time using the RESTORE command. If for example you have
read the data and printed it to the screen, you will need to read the same data again if the user wants to
clear the screen and redraw the data. By resetting the data pointer the READ command will start at the top
of the data list and you can read it again.
You can also create more than one data list. If for example you required not only a data list of lottery
numbers, you also required a list of lottery numbers on your lottery ticket then you will require two separate
data lists. You create the data as follows:
lotterydata:
DATA 12,23,34,45,56,67
DATA 23,34,45,56,67,11
10
DATA 34,45,56,67,33,22
ticketdata:
DATA 01,02,03,04,05,06
DATA 21,32,43,24,13,22
To print the first set of data to the screen, you would first point the data pointer to the first set of data. You
do this by using the RESTORE command and specifying the label that precedes the data statements. A label
statement is declared by adding a colon (:) as the last character of the label. You can point the data as
follows:
RESTORE lotterydata
READ a,b,c,d,e,f
PRINT "LOTTERY ",a,b,c,d,e,f
Then when you wish to print out the first ticket number from the second data list, you simply use the
second label that points to the ticket data:
RESTORE ticketdata
READ a,b,c,d,e,f
PRINT "TICKET ",a,b,c,d,e,f
There are better ways to structure the reading of data from a data list, but these simple examples
demonstrate how to access multiple lists of data.
BRANCH STATEMENTS
Normally, a program executes statements in sequence starting at the top. A branch statement allows you to
jump to another part of the program to continue execution. A GOSUB command will jump to a label and
continue from its new location. When the program encounters a RETURN command, the program will jump
back to the GOSUB from where it originally came. Take the following example:
PRINT "Hello"
GOSUB MySubroutine
END
MySubroutine:
PRINT "World"
RETURN
The program will print the "Hello" text to the screen, then jump to the MySubroutine line of the program
and continue execution. The next command it finds will print "World" to the screen. The RETURN command
then returns the program to the point it left, where it then proceeds onto the next command after the
GOSUB command which in this case is the END command.
A GOTO command, however does not remember from where it jumped and will continue running from its
new location permanently. It is not recommended you use GOTO commands often, as there are better ways
to control the flow of your programs. Here is an example, however, of a simple GOTO command:
MyLabel:
PRINT "Hello World ";
GOTO MyLabel
Or alternatively:
DO
PRINT "Hello World ";
LOOP
You will agree the last example is a much better, cleaner and friendly way of doing the above and
demonstrates how the use of GOTO can be eliminated. GOTO is retained in the DARK BASIC language for
compatibility with older BASIC languages.
11
FOR NEXT Statements
You may recall the user of the FOR NEXT statement in earlier examples. The FOR NEXT commands are used
to create a finite loop in which a variable is incremented or decremented from a value to a value. A simple
example would be:
FOR T=1 TO 5
PRINT T;" ";
NEXT T
PRINT "Done"
1 2 3 4 5
The program would set T to a value of 1 and then go to the next line to PRINT. After the print, the NEXT
command would return the program to the FOR command and increment the value of T to make it 2. When
the PRINT command is used again, the value of T has changed and a new value is printed. This continues
until T has gone from 1 through to 5, then the loop ends and the program is permitted to continue. The
next command after the NEXT statement prints "Done" to the screen slowing the program has left the loop.
You can also next loops to create a loop within a loop, as the following example shows:
FOR A=1 TO 5
PRINT "MAIN A=";A
FOR B=1 TO 10
PRINT "LITTLE B=";B
NEXT B
NEXT A
The FOR NEXT statement loops the main A variable from 1 to 5, but for every loop of A the FOR NEXT
statement inside the first loop must also loop its variable B from 1 to 10. This is known as a nested loop as
the loop in the middle is nested inside an outer loop.
Such loops are especially useful for working on array data by using the variables that increment as position
indexes for the arrays. As an example, we could list all our lottery numbers using the following example:
Notice the new STEP command added to the end of the FOR NEXT statement. The STEP command is used
to change the default increment value from 1 to another value. In this case, the program will only print the
lottery numbers for every forth week.
IF THEN Statements
The IF statement allows your program to make decisions that controls the flow of your program. The IF
statement requires an expression to evaluate that results in either true or false. If the expression is true, the
commands following the THEN command will be executed. If the expression is false, the program will move
onto the next statement and ignore the rest of the IF THEN statement. Take the following example:
12
When the user enters a value greater or equal to 16, the program will display its message. This program
demonstrates a simple IF THEN Statement. To understand how this works we must look at the IF command
in a little more detail. First, we must take the expression and evaluate it:
age>=16
We can determine from our earlier coverage of operators, that this relational operator will result in either a
zero or a one depending on whether age is greater or equal to 16. The IF command considers a value of
zero to be false and all other values as true. So we can determine that if age is indeed greater or equal to
16 then the result will be 1, and the expression according to the IF command will be true.
The expression can be any combination of values, variables, arrays and operators providing the expression
makes sense. These expressions will make sense:
On occasions where one line is not enough after the THEN command, you can use the IF ENDIF statement.
Using the same IF logic as above, instead of a THEN Command, simply provide your commands to executed
on the lines following the IF command. You must then mark the end of the commands to be executed with
an ENDIF command, as the following example shows:
IF A = B
PRINT "Hello A and B!"
ENDIF
But the main advantage is that the first piece of code can be adapted to do this:
IF A = B
PRINT "Hello A!"
PRINT "Hello B!"
PRINT "Hello A and B!"
PRINT "Hello B and A!"
PRINT "Hello Everything!"
ENDIF
You can also respond to an IF command if the expression turns out to be false. In cases where you wish to
execute a different piece of code if the condition is false, the ELSE command should be used as follows:
IF A = B
PRINT "The values are the same!
ELSE
PRINT "The values are different!"
ENDIF
13
It is important to make sure that you always use an ENDIF when THEN is not in use. You will note ENDIF is
used whether or not the ELSE command is utilized.
PRINT Statements
The PRINT command is capable of printing out more than a single value. The command allows you to
specify a list of comma separated data. The data items can be of any type. Although the use of PRINT has
been frequent in the above examples, there are some unique features you may not be aware of. When the
PRINT command is used to print data to the screen, the print cursor that is used to paste the individual
letters to the screen reset to the left of the screen and one line down when the print is complete. A string of
PRINT commands will print to the screen one line at a time. You can change this by leaving the cursor at
the end of the printed line after a PRINT command. You achieve this by adding a semi-colon (;) at the end
of the print data, for example:
In the same way, you can use this symbol to separate data in the same PRINT command, for example:
In addition to preventing the text cursor from resetting, you can also position the text cursor anywhere on
the screen using the SET CURSOR command. This example will randomly print text anywhere on the screen:
DO
SET CURSOR RND(640),RND(480)
PRINT "TEXT"
LOOP
There are much more sophisticated text commands in DARK BASIC that handle fonts, colors, sizes and
styles but you may discover these as you explore the rest of the help system.
INPUT Statements
Though seldom used, the INPUT command is a very simple way of obtaining numeric and string input from
the user. You can obtain a particular type of value simply by using a variable of that type, for example:
INPUT a$
Will accept a string input from the user. If they enter a number, it will be stored as a string in the variable
A$. Your program can provide a prompt to make sense of the requested input, as follows:
This example prompts the user by printing the message to the screen and the user can enter the password.
They will see their entry as they type it into the keyboard, and this entry will be stored in the string variable
when they hit the return key. The same applies to integer and real variables.
14
Common and User Functions
COMMON FUNCTIONS
Functions can be described as commands that return a value. DARK BASIC uses arithmetic functions, string
functions, command specific functions and user-defined functions. They all share commonalties that will
help you recognize what they look like and how they are used.
A simple arithmetic function is the ABS command, which takes a negative value and converts it to positive:
A = B + ABS(-100)
A = ABS( B )
Just as you have become accustomed to using variables in place of standard numbers and strings, you can
use functions in the same way. As shown, functions can take data but they don't have to. Some functions
merely return a value, such as:
DO
PRINT TIMER()
LOOP
You will notice that even though no parameter data is required, you still need to add the brackets. The
brackets instruct DARK BASIC it is a function and is a handy way of quickly determining whether it's a
variable or function. Unlike variable and array names, functions only require a dollar symbol ($) if a string is
to be returned. You do not need to specify a hash symbol (#) if the function is to return a real number, as
the individual commands help will reveal.
Functions are blocks of commands that usually perform a recursive or isolated task that is frequently used
by your program. Variables and arrays used within the function are isolated from the rest of the program. If
you use a variable name of FRED in your function, it will not affect another variable called FRED in your
main program, nor any other function that happens to use a similar variable name. This may seem to be a
restriction, but forces you to think about cutting up your program into exclusive tasks which is a very
important lesson.
You can pass up to 255 parameters into your function, and have the option of returning a value when the
function returns. Functions that do not return a value can also be used as normal commands in your main
program.
15
Declaring a function couldn't be simpler. Using the FUNCTION command, simply provide it with a name and
a list of parameters in brackets and your declaration is half-complete. Enter the commands you want on the
following lines and then end the function declaration with the command ENDFUNCTION. The following
example declares a function that returns half of a value passed in:
FUNCTION halfvalue(value)
value=value/2
ENDFUNCTION value
This declaration creates a function that can be used as a better print command:
16
Reserved Words, Remarks and Spacing
RESERVED WORDS
Words that are deemed to be reserved are the commands of the language. You will not be able to name
your variables, arrays or user functions if they exist as part of the language as commands. As you become
more familiar with the language, you will be able to naturally avoid using reserved words for your variable
and array names.
REMARKS
You are able to write statements in your program that will be completely ignored when run. This may seem
strange at first, but actually provides one of the most important features of your programming armoury.
Remarks, also known as code commentary or documentation, are the plain English descriptions of what
your program does at any point in the code.
Although BASIC is quite concise as a readable language, it's never entirely clear what a piece of code is
supposed to do if you read it for the first time. Do not be fooled into thinking the code you write yourself is
for your eyes only. Returning to a piece of code you write 3 months previous will dispel any concerns you
may have over the importance of remarks.
The trick is to write only a summary of what a piece of code does. Leave out details, data and snippets that
may change or be removed. Avoid typing a half-page description, as the likelihood is that you'll never find
the time to read it. Remarks become a highly powerful part of your program if used correctly.
There are other ways to make remarks in a program, such as the open quote symbol:
` Print a greeting for the user
PRINT "Hello World"
If you wish to 'comment out' a number of lines in your program, you can avoid adding a REM command at
the start of each line by using the following:
REMSTART
PRINT "Hello World"
PRINT "Hello World"
PRINT "Hello World"
REMEND
Anything between the REMSTART command and the REMEND command will be ignored when the program
is run. These commands are especially useful for temporarily removing parts of the program for testing
purposes.
USE OF SPACING
Unlike other BASIC languages, spaces are very important in your programs. It is important to separate
commands and parameters; otherwise your program will not be understood. Take for example the line:
FOR T=1 TO 10
17
FORT=1TO10
Nor would this be easy to read either. Providing you use spaces to separate commands and parameters, you
will encounter no problems with spacing.
18
Errors and Warnings
There are many types of errors you will encounter while programming and running your creations, but they
fall into four main categories:
’SYNTAX ERROR' means you have tried to compile your program but a command statement was not
recognized or understood.
'PARAMETER MISMATCH' means you have tried to compile your program but a known command has been
given the wrong parameter data. You must provide the correct types of parameters for the command, and
in the right order.
'RUNTIME WARNING' means the program has compiled and run successfully, but the command failed due
to the reasons given with the warning. A warning will not be given in a standalone executable version of the
program!
'RUNTIME ERROR' means the program has compiled and run successfully, but the command failed due to
the reasons given with the error. An error will terminate a standalone executable version of the program
and provide reasons for the error!
19
FAST TRACK LEARNING
You want to create something now and learn the academics later on. The fast track will skip large chunks of
ground work to get you using Dark Basic as quickly as possible.
You will be instructed what to do at every stage. You will be required to leave the help system from time to
time, but you can always return using the F11 key. If you have misunderstood a lesson and need to return
to an earlier stage, the BACK button at the top of the screen will step back through the pages.
In order to execute a command on its own, you can make use of the Command Line Interface, or CLI for
short. You can use the CLI to try out commands without having to write a program first.
You will shortly be entering the CLI. When you are there, type the following:
When you have typed out this line, hit the RETURN key. The RETURN key is used to execute the command
line. The command itself prints 'Hello World' to the screen. You can enter the CLI by clicking the CLI button
located at the top of the screen. You can then return to the help page by clicking the EXIT button located
on the CLI bar.
DO
PRINT "Hello Again"
LOOP
You will shortly be running your program, but you must then be able to exit your program and return to the
editor. At any time during the running of your program, you can press the F12 key to break from your
program and return to the editor.
From the editor, press the F5 key to compile and run your program. After a few second, press F12 to return
to the editor. Alternatively, you can press F11 to return here.
20
It has taken you just a few minutes to write your first program. You are now a real programmer. You may
be a programmer who only knows three commands, but a programmer nonetheless. Now you want to do
something a little bit more impressive!
We are going to create something that will impress your friends. Instead of spending the next 30 minutes
writing out a lengthy program, we have provided CAVERUN.DBA available from the integrated help system.
rem ----------------
rem Cave Runner Demo
rem ----------------
rem Author: DBS-LB99
hide mouse
rem Load bitmaps
load bitmap "tiles.bmp",1
get image 1,0,0,256,256
delete bitmap 1
rem Load sound
load sound "hum.wav",1
load sound "explode.wav",2
set sound speed 1,6000
loop sound 1
rem Load music track
load music "caverun.mid",1
loop music 1
rem Activate manual sync
sync on
rem Make landscape and ceiling matrix
make matrix 1,2000,5000,10,25
prepare matrix texture 1,1,2,2
make matrix 2,2000,5000,10,25
prepare matrix texture 2,1,2,2
fill matrix 2,0,2
randomize matrix 2,350.0
for t=0 to 25
set matrix height 2,0,t,-100
set matrix height 2,10,t,-100
next t
update matrix 2
rem Bagin game loop
do
rem Set seed for same random numbers
randomize 1
rem Clear cave floor
fill matrix 1,0,1
rem Set lighting, fog and setupset ambient light 20
fog distance 3000
color backdrop 0
fog color 0
fog on
rem Reset speed
x=0
z=0
speed#=0.0
rem Begin main loop
repeat
rem Record old variables
oldx=x
oldgy#=gy#
rem Control key movements
if upkey()=1 then speed#=speed#+1.0 else speed#=speed#-1.0
if leftkey()=1 then rz#=rz#+1.0
if rightkey()=1 then rz#=rz#-1.0
rem Control variables
if speed#>40.0 then speed#=40.0
rz#=rz#/1.1
x=x-(2*rz#)
rem Scroll landscape
z=z+speed#
if z>200
z=z-200
21
if rnd(3)=0
mp=mp-1
mp=mp+rnd(3)
if mp>4 then mp=4
endif
for t=0 to 0 : set matrix height 1,t,24,450 : set matrix tile 1,t,24,2 : next t
for t=1 to mp : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,2 :
next t
for t=mp+1 to mp+1 : set matrix height 1,t,24,rnd(200) : set matrix tile
1,t,24,3 : next t
for t=mp+2 to mp+3 : set matrix height 1,t,24,rnd(20) : set matrix tile 1,t,24,1
: next t
for t=mp+4 to mp+4 : set matrix height 1,t,24,rnd(200) : set matrix tile
1,t,24,4 : next t
for t=mp+5 to 9 : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,2 :
next t
for t=10 to 10 : set matrix height 1,t,24,450 : next t
update matrix 1
shift matrix up 1
shift matrix up 2
endif
rem Position matrix
position matrix 1,0,0,2500-z
position matrix 2,0,100,2500-z
rem Position camera
gy#=curvevalue(50+get ground height(1,500+x,z),gy#,3)
position camera 500+x,gy#,2500
zrotate camera wrapvalue(rz#)
rem Control sound frequency
set sound speed 1,6000+(speed#*100)
rem Update screen
sync
rem End main loop when collision with ceiling
until get ground height(2,500+x,z)=gy#-75.0
rem Return camera to point before collision
position camera 500+oldx,oldgy#,2500
rem Game Over
play sound 2
for c=0 to 255 step 20
cls rgb(c,0,0)
fog distance (c*5)
fog color (c*256*256)
sync
next c
rem End game loop
loop
Media files are very important, especially in games. Media files are your bitmaps, sounds, music, animations,
3d objects and data files that are used to make up the sounds and visuals of your program.
There are two types of standalone executable. The first type does not save media files with your executable
and the second type does. As our second program uses media files, we shall use the second type.
If you go to the editor, your second program should still be listed. Press F7 to select the Build Final dialogue
and click in the filename box to enter a name for your executable file. Click the BUILD button to build your
executable file and then return to the help.
22
For the most part, this means leaving the Dark Basic environment. If you are dealing with the world outside
Dark Basic, it is important to know how to find and manage your executable files. How else will you be able
to show off your programs?
You will shortly be asked to exit Dark Basic to locate and find the executable you have built. The search
should not be too difficult if you have remembered the name of your executable. All executable files are
recognized by their .EXE extension. Dark Basic automatically appends this extension if not part of your
filename.
If you remember where you installed Dark Basic, you should find your executable file located in the DARK
BASIC SOFTWARE\DARK BASIC\HELP\FAST\CAVERUN directory. Alternatively, you can go to START FIND
FILES OR FOLDERS and enter the name of your executable. When you have located your executable, you
can run it as normal. Either double click the file or use the right mouse button on the file and select Open.
You can exit the program using the ESCAPE key. This completes your 15 minute lesson.
To exit Dark Basic, simply click the EXIT button in the top right corner of the screen.
23
TUTORIALS
TUTORIAL ONE: HELLO WORLD
For our very first program, we want to get something happening as soon as possible. We will write a
program that prints "hello world" to the screen over and over.
When you have typed this line into the editor, press F5 to compile and run the program. To go to the editor,
click the EDIT button in the top left corner of the screen. When you have finished, you can return to this
help page by pressing the F11 Key.
DO
PRINT "Hello World"
LOOP
The DO command and LOOP command mark the start and end of the loop for your program. When you run
the program, it will continue to run inside this loop forever. You can quit the program at any time by hitting
the ESCAPE key.
a$="Hello World"
PRINT a$
You will notice the contents of the variable is printed. The principle would be the same for numbers too.
24
The PRINT command always outputs at the current cursor position, and starts in the top left corner. You
can set the position of the cursor using the SET CURSOR command. The command requires two parameters
that indicate where you would like the new cursor position to be. The first value indicates the X coordinate
that moves from left to right and the second value indicates the Y coordinate that moves from top to
bottom:
When you place this line at the top of your program and run, you will see the text printed slightly offset
from the top left corner of the screen. This is because you have specified 10 pixels across and 10 pixels
down the screen for the cursor. It is worth noting that the cursor will advance to the next line and reset to
the left side of the screen after a standard print command.
The contents of variables do not have to be decided as you write your program. You can use the INPUT
command to accept values and strings into variables. The input command also uses the cursor to determine
where on the screen it should show what the user is typing. Replace the line: a$="Hello World" with the
following:
When you run the program, your user now has the ability to enter a string of their own. When return is
pressed, the program continues onto the print command where their entry is printed to the screen. Notice
where the cursor went after the input command was used.
PRINT RND(640)
When run, this will print a random value between 0 and 640 to the screen. We will be able to use the same
command to generate random X and Y coordinate values.
Almost all large programs have a main loop. It can be pictured as an engine, with all it's cogs and gears
revolving continually. It is often the first thing you will think about when writing your programs.
Bring the above steps together and lessons learned from our first tutorial, write the following program:
25
Step 1 : Detect all display modes available
To make a list of available display modes, you must perform a check using the system checklist. Checklists
are very easy to use and require a single command to fill the checklist with the data you require. For display
modes, type the following command:
The checklist will internally fill up with every display mode you can use on the current graphics card.
Step 2 : Printing out the display mode data from the checklist
The number of items stored in the checklist can be returned using the command CHECKLIST QUANTITY(). A
description of the display mode can be returned using the command CHECKLIST STRING$(index), where
index is the position in the list you are interested in. We can set up a FOR NEXT loop that scans the entire
list, and prints out the description. Notice how the value of T can be included in the line to be printed:
CLS
FOR T=1 TO CHECKLIST QUANTITY()
PRINT T;" ";CHECKLIST STRING$(T)
NEXT T
If you were to run the program now, you will see a list of display modes printed alongside it's position in the
list. We will want our program allow the user to select a display mode from this list. For convenience, we
will only allow display modes 1-9 from being selected.
DO
IF ASC(INKEY$())>48
position=ASC(INKEY$())-48
width=CHECKLIST VALUE A(position)
height=CHECKLIST VALUE B(position)
depth=CHECKLIST VALUE C(position)
SET DISPLAY MODE width, height, depth
ENDIF
LOOP
When you run the program, you should be able to select from a list of display modes and switch to that
resolution. You will notice the screen is cleared. This is a very important fact. When the screen resolution is
changed, all video memory is wiped which includes screens and textures.
26
Step 1 : Drawing basic shapes
Drawing simple shapes to the screen is very straight forward. Providing you know that an X coordinate
measures the horizontal distance of the screen from left to right and that the Y coordinate measures the
vertical distance of the screen from the top to the bottom, you should be able to understand what each of
these do:
CLS
DOT 635,475
BOX 10,10,630,20
CIRCLE 320,240,100
ELLIPSE 320,240,100,200
LINE 120,240,520,240
INK RGB(255,100,0),RGB(0,0,255)
v=0
DO
LINE 0,v,v,480
v=v+1
LOOP
It may not seem profound now, but you will repeat this basic logic thousands of times. Learning its
importance now will advance your learning considerably. Run the program to see what happens.
v=0
cx=160
cy=120
DO
ox=cos(v)*100
oy=sin(v)*100
v=v+1
DOT cx+ox,cy+oy
LOOP
27
TUTORIAL FIVE: STOCK MARKET ARRAYS
The purpose of this program is to demonstrate the use of arrays to read and write data in an organized
manner. When programs reach a certain size, the storage and organized retrieval of data is very important.
When you lose control of your data, you lose control of your program.
DIM companies(5,2)
companies(1,1)=90 : companies(1,2)=200
companies(2,1)=70 : companies(2,2)=1000
companies(3,1)=60 : companies(3,2)=2000
companies(4,1)=20 : companies(4,2)=1500
companies(5,1)=15 : companies(5,2)=300
CLS
FOR c=1 TO 5
PRINT "#";c;" Price ";companies(c,1);" Quantity ";companies(c,2)
NEXT c
This demonstrates the practicality of using arrays. You are able to store data values that belong together,
and by changing the index variable, you can jump to new records with the same pattern of data. This
understanding will allow you to organize your data to make your programs easier to read and manipulate.
You can view the results of this change by making your program loop back to the top and printing out the
companies list again. Can you figure out how to use the DO and LOOP commands to accomplish this?
28
TUTORIAL SIX: PHOTOCOPIER
The purpose of this program is to demonstrate how to load a bitmap onto the screen and manipulate the
image. The program loads the picture then grabs four equal segments from it, storing the images in
memory. The images are then pasted back onto the screen clockwise. By repeating this action, the
segments will appear to be rotating around the screen in a clockwise direction.
The LOAD BITMAP command takes the filename of a media file in the BMP file format. The media file has to
be in the same directory as the program. When the GET IMAGE command is used, it copies the specified
area from the screen and stores it in memory. This image can then be pasted to any location. The SLEEP
command works in units of 1000 per second, and is used to momentarily pause the program.
This tutorial program can be loaded directly into the editor by clicking SAMPLE07.DBA.
29
The LOAD MUSIC command takes a file in the MIDI format, and loads it into music number 1. Many music
files can be loaded, but only one score of music can be played at any one time. The LOAD SOUND
commands load the same WAV format sound file into sound numbers 1, 2 and 3. The reason for this is to
provide multi-channel sound in the program, which allows the sounds to overlap each other for best effect.
The LOOP MUSIC command plays the music and instructs it to repeat continuously. The SCANCODE()
command returns the value of the key currently being pressed. The SOUND PLAYING() command returns a
1 when the sound is playing, and zero at all other times.
The first part of the program loads the bitmap animation sequence into bitmap 1. Bitmap numbers 1
through 32 are off screen bitmaps and are not visible. A bitmap animation sequence is a normal bitmap file
with a grid of single images side by side that provide the effect of animation when displayed in sequence. A
FOR NEXT loop is used to extract images from the bitmap. The bitmap is then deleted as the images are
now safely stored in memory.
The second part of the program sets values to our variables and prepares to enter the main loop. The SYNC
ON command informs the system that the program will take responsibility for refreshing the screen. We do
this to ensure the screen refresh rate is smooth and controlled. Leaving this out would cause the program to
run so fast you would hardly see the sprite at all!
The main loop begins with the increment of two variables. Both are given maximum values, beyond which
the variable will wrap around. The sprite command displays sprite 1 at the latest coordinate and image
value. The XPOS variable makes sure the sprite is continually moving across the screen. The IMAGE variable
keeps changing the image value to make the sprite animate from frame to frame.
30
The last part of the loop synchronizes the refresh of the screen and forces a small delay to prevent the
sprite from moving too fast.
The first part of the program loads a bitmap off screen and grabs the contents as an image. This image will
later be used to texture the landscape. To create the landscape, a matrix is used. A matrix is a collection of
grid squares that can be raised, lowered and textured at your command. The program creates a matrix ten
thousands square units in size, subdivided into 625 separate squares(25x25). The matrix is then textured
and randomized to create the effect of stone hills.
If your graphics card supports such a feature, fogging is activated and the distance is set to the clipping
range of the system. Dark blue is applied as the fog color and is later used to clear the screen.
A special real number is used for the camera angle value, indicated by the hash(#) appended to the
variable. The left and right arrow keys alter the value of the angle variable and later code ensures the angle
variable wraps around when either the maximum or minimum value is exceeded.
The last part of the main loop updates the angle of the camera using the ROTATE CAMERA command. In
order to maintain a steady speed, the program uses SYNC to refresh the screen.
31
3. Change the program to Randomize the matrix when a key is pressed
You will have noticed how useful the REM statements have become since tutorial six. Documenting a
program not only explains what your code does, but allows you to break up your program into meaningful
tasks. In addition to the information provided by the commentary, Dark Basic offers you the ability to
request information on the command itself. Simply go to the editor that lists your program, click on a
command you would like to know more about and then hit F1. This feature is called context sensitive help
and you will be taken directly to a help page that fully describes the command and explains how to use it.
Additionally, each help page has its own example program and references to the glossary or other related
commands.
32
If you have completed all ten tutorials, by successfully making the changes listed in the Final Step segment
at the end of each tutorial, you have done extremely well. Don't worry if you haven't understood all the
tutorial samples. It takes time to completely grasp the fundamentals, especially in the early stages of
learning. If this is the case, it is advised that you return to the last tutorial you were comfortable with and
adapt it by making your own changes. When you are practiced at making changes to that tutorial, you
should be able to proceed to the next one with some confidence.
33
DarkBASIC REFERENCE
Basic Command Set
All BASIC languages are formed from a core set of commands that make learning a new language a gradual
and rewarding process. Not only are these commands essential for the beginner, but are a vital building
block for all programs. All standard structures, conditional operators and mathematical forms are
recognized.
IF THEN
This command will allow your program to perform a sequences of commands based on the result of a
condition. If the condition is true, the commands after the THEN keyword are performed. Ensure that your
commands after the THEN keyword are separated by a colon(:). If the condition is false, the rest of the line
is skipped.
SYNTAX:
IF Condition THEN Command Go Here for condition True
IF ENDIF
This command will allow your program to perform a sequences of commands based on the result of a
condition. If the condition is true, the commands immediately following the IF command are performed. If
the condition is false, all commands before the ENDIF command are skipped.
SYNTAX:
IF Condition
Command Go Here for condition True
ENDIF
IF ELSE ENDIF
This command will allow your program to perform two different sequences of commands based on the
result of a condition. If the condition is true, the commands immediately following the IF command are
performed. If the condition is false, the commands immediately following the ELSE command are
performed. You must always use an ENDIF to mark the end of the ELSE command sequence.
SYNTAX:
IF Condition
Command Go Here for condition True
ELSE
Command Go Here for condition False
ENDIF
FOR NEXT
This command will define a program loop that will loop a finite number of times. The FOR command
requires a variable and two values to begin the loop. The variables stores the first value, and is incremented
by 1 each loop until it reaches the second value. The NEXT command is placed to mark the end of the loop.
As the variable increments during the loop, you can use its value in many ways. You can increase the size of
this increment by using the STEP command.
SYNTAX:
FOR Variable = value1 TO value2
Commands Go Here
NEXT Variable
STEP
34
This command will define a program loop that will loop a finite number of times. The FOR command
requires a variable and two values to begin the loop. The variables stores the first value, and is incremented
each loop until it reaches the second value. The size of the increment is determined by the STEP value. The
NEXT command is placed to mark the end of the loop. As the variable increments during the loop, you can
use its value in many ways. Optionally, you can count in descending order by specifying a high first number,
a low second number and a negative step value.
SYNTAX:
FOR Variable = value1 TO value2 STEP increment-value
Commands Go Here
NEXT Variable
DO LOOP
These commands will define a loop that will repeat indefinitely. You are able to break from the loop at any
time by using the EXIT command.
SYNTAX:
DO
Commands Go Here
LOOP
REPEAT UNTIL
These commands will define a loop that will repeat until the Condition becomes true. Unlike the WHILE
command, the repeat loop allows the command sequence within your loop to run at least once before the
Condition is checked. You are able to break from the loop at any time by using the EXIT command.
SYNTAX:
REPEAT
Commands Go Here
UNTIL Condition
WHILE ENDWHILE
These commands will define a loop that will repeat while the Condition is true. Unlike the REPEAT
command, the while command ensures the Condition is true before entering the loop. You are able to break
from the loop at any time by using the EXIT command.
SYNTAX:
WHILE Condition
Commands Go Here
ENDWHILE
EXIT
This command allows you to break from a program loop at any time. Only control loops that have an
uncertain exit condition can use this command such as DO LOOP, WHILE and REPEAT loops. EXIT will have
no effect on FOR NEXT and GOTO loops during the running of your program.
SYNTAX:
EXIT
FUNCTION
These commands will declare a user defined function within your program. User functions work in the same
way normal commands work. They can accept multiple parameters and return values in the same manner,
allowing you to create customized commands within your program.
You will need to specify a name for your function, which must not be a reserved word and must not contain
spaces or invalid characters. The parameter list for the function must then be specified within brackets. Do
not leave a space between the function name and the brackets.. Your parameter list can be left empty, or
you can specify up to 255 parameter names inside the brackets. A parameter is declared by simply entering
a name. If you require more than one parameter, make sure you use commas to separate them. You may
35
enter commands for your function starting on the line following the declaration. You must declare the end of
a function using the ENDFUNCTION command. If you wish your function to return a value, simply add the
variable or value after the ENDFUNCTION command. You must leave a space between the endfunction
command and the variable or value you wish to return.
Any variables declared in the function are what are known as local variables. Local variables can only be
recognized and used from within the function. Global variables on the other hand are variables declared
outside of any function. Your function cannot recognize or use global variables. Your program cannot
recognize or use local variables if you are running outside of the function in question. This allows you to re-
use variable names within a function without fear of overwriting some other global variable elsewhere in
your program, amongst other advantages. The same rules apply to arrays and parameters passed into the
function. Parameters declared by the function can be used in the same way you would use any local
variable, in order to bring information from the outside world.
SYNTAX:
FUNCTION Name(Parameter List)
Commands Go Here
ENDFUNCTION Return Value
ENDFUNCTION
See Above.
EXITFUNCTION
This command will immediately exit the current function, optionally returning a value. The remaining code
between the EXITFUNCTION and the ENDFUNCTION commands will be ignored.
SYNTAX:
EXITFUNCTION
EXITFUNCTION Return Value
GOSUB
This command will jump to the specified label in the program. Unlike the GOTO command, you can use the
RETURN command to return to the program location of the last jump performed. In order to use the GOSUB
command you must create a subroutine in your program that terminates with the RETURN command. To
create a subroutine you must write a label in your program followed by a sequence of commands. The label
can be made up from any combination of alphabetic characters, but you must end the declaration of the
label using a colon(:). You only need to use a colon when you are declaring the label, and should not be
used when calling the label from a GOSUB command.
SYNTAX:
GOSUB Label
Label:
Commands Go Here
RETURN
GOTO
This command will jump to the specified label in the program. Unlike the GOSUB command, you cannot
return from a call when using the GOTO command. The label can be made up from any combination of
alphabetic characters, but you must end the declaration of the label using a colon(:). You only need to use a
colon when you are declaring the label, and should not be used when calling the label from a GOTO
command.
SYNTAX:
GOTO Label
Label:
Commands Go Here
END
36
This command will stop the program running. If your program was run from the editor, you will be taken to
the CLI.. If your program was executed as a standalone executable, you will exit your program and return
to Windows.
SYNTAX:
END
SELECT
Use this command in combination with CASE, ENDCASE and ENDSELECT to create a select statement. A
select statement allows you to branch to different actions based on the value of the provided variable. The
variable can be an integer, real or string value.
SYNTAX:
SELECT Variable
CASE
Use this command in combination with SELECT, ENDCASE and ENDSELECT to create a select statement. A
case statement specifies the value that if matching the contents of the variable, will run the code below it.
SYNTAX:
CASE Value
CASE DEFAULT
Use this command in combination with SELECT, ENDCASE and ENDSELECT to create a select statement. A
case default statement holds code below it in the event that no case statement catches the value of the
variable. The case default statement must go at the end of a sequence of case statement, but above the
ENDSELECT statement.
SYNTAX:
CASE DEFAULT
ENDCASE
Use this command in combination with SELECT, CASE and ENDSELECT to create a select statement. A
caseend statement specifies the end of a piece of code you are specifying for a case statement.
SYNTAX:
ENDCASE
ENDSELECT
Use this command in combination with SELECT, CASE and ENDCASE to create a select statement. An
endselect statement specifies the end of a select statement.
SYNTAX:
ENDSELECT
37
select Variable$
case "JOHN" : center text 320,0,"HI JOHN" : endcase
case "LEE": center text 320,0,"HI LEE" : endcase
case "CHRIS" : center text 320,0,"HI CHRIS" : endcase
case "MALCOLM" : center text 320,0,"HI MALCOLM" : endcase
case "JAMES" : center text 320,0,"HI JAMES" : endcase
case default : center text 320,0,"BIG HEAD BOB" : endcase
endselect
RESTORE
This command will reset the DATA statement pointer to the very first piece of data in your program.
Optionally, if you specify a label, it will reset to the DATA statement immediately following that label. To
create a DATA statement label you must write a label in your program followed by a sequence of DATA
commands. The label can be made up from any combination of alphabetic characters, but you must end the
declaration of the label using a colon(:). You only need to use a colon when you are declaring the label, and
a colon should not be used when calling the RESTORE command.
SYNTAX:
RESTORE
RESTORE label
DATA
This command allows you to create a sequence of data values as part of your program. The values can be
integer, real or string values. You may place the data values in any order you wish providing you separate
each one with a comma or place new data values in a separate DATA statement. Data values can be read
from the DATA statement using the READ command, and the point at which the data is read can be reset
using the RESTORE command. You can separate batches of DATA statements using labels in order to
segment your data for alternative uses.
SYNTAX:
DATA Datalist
READ
This command will read next available item from the DATA statement in your program and place the
resulting data in a specified variable. You can create DATA statements using the DATA command, and you
can reset the pointer to the data using the RESTORE command. You can read the data as integer numbers,
real numbers or strings but you must ensure the DATA statements data types are in the same order as your
program reads them. If you read data into a variable of the wrong type, a zero value or empty string is
written into the variable.
SYNTAX:
READ Variable
READ Variable#
READ Variable$
SYNTAX:
SUSPEND FOR KEY
SYNTAX:
SUSPEND FOR MOUSE
38
WAIT KEY
This command will pause the program from running until a key is pressed. To detect for a specific key,
please refer to the INKEY$ or SCANCODE commands found in the Input Command Set.
SYNTAX:
WAIT KEY
SLEEP
This command will pause the program for the specified Duration. The Duration is specified in milliseconds,
where 1000 units represent 1 second.
SYNTAX:
SLEEP Duration
WAIT
This command will pause the program for the specified Duration. The Duration is specified in milliseconds,
where 1000 units represent 1 second.
SYNTAX:
WAIT Duration
SYNC
This command is used to improve the performance of demanding programs that require a consistent frame
rate. This is especially true of games. By default, sync is set to off which allows the system to automatically
handle screen refreshing. When SYNC ON is used, your program is responsible for handling screen
refreshing. You can refresh the screen using the SYNC command. When you want the system to
automatically handle screen refreshing again, you can use the SYNC OFF command. By placing the SYNC
command at the end of your main program loop, all drawing and refresh tasks can occur in a single call.
This dramatically increases the speed and smoothness of graphical operations, allowing your programs to
run at their best.
SYNTAX:
SYNC
SYNC ON
SYNC OFF
SYNC RATE
This command is used to change the default refresh rate SYNC ON uses to control the speed of the SYNC
update speed. The default rate sustains the 'Frames Per Second' at no more than 40fps. You can specify
an integer value from 1 to 1000 to set a new maximum rate. A rate of zero will allow the program to
refresh as fast as the system will allow.
SYNTAX:
SYNC RATE Refresh Rate
DIM
This command will create an array in which you can store your program data. You are able to create arrays
with up to five dimensions. Arrays are best visualized as a line of boxes. Within each of these boxes are
even smaller boxes. Contained within each of these smaller boxes are single items of data. To locate the
data contained in one of these boxes, you must indicate exactly which box you wish to read from or write
to. Each box has what is called an index number. Starting with the largest boxes, you provide an index
number that takes you inside a box. You can then provide another index number that chooses one of the
smaller boxes within the larger box. Every time you enter a new box, you are in fact indexing a new
dimension in the array. Using this method of indexing the array elements, you can read and write to any
value within the array. You can store only one type of data per array. Data types include integer numbers,
real numbers and strings.
39
To declare an array as local, you must place the DIM command within the function that intends to use it. To
declare an array as global, you must place the DIM command at the top of your program. Global arrays can
be accessed anywhere within your program, including functions.
SYNTAX:
DIM Array Name(number of elements)
DIM Array Name(number of elements, number of elements in each element)
LOAD ARRAY
This command will load the contents of the file into the specified array. It is highly recommended that the
array used to save the data should be identical to the one used when reloading. When specifying the array
name, the array index numbers are ignored, but you must still provide them to ensure the array is
recognized.
SYNTAX:
LOAD ARRAY Filename, Array Name(index numbers)
SAVE ARRAY
This command will save the contents of the array to the specified file. It is highly recommended that the
array used to save the data should be identical to the one used when reloading. When specifying the array
name, the array index numbers are ignored, but you must still provide them to ensure the array is
recognized.
SYNTAX:
SAVE ARRAY Filename, Array Name(index numbers)
UNDIM
This command will delete the specified array from memory. You must have previously created the array
using the DIM command in order for UNDIM to succeed. Deleting unused arrays increases system
performance.
SYNTAX:
UNDIM Array Name(number of elements)
REM
This command allows you to document your program. The REM command indicates the start of a 'remark' in
your program, and all remarks are skipped by the compiler. You can use remarks to provide a better
description of what your program is doing. You will find it good practice to make remarks often, as you will
gradually forget what each part of your program does as time goes by.
SYNTAX:
REM Remarks Go Here
REMSTART
This command allows you to document large areas of your program. The REMSTART and REMEND
commands define an area of your program that will be ignored by the compiler. You can use remarks to
provide a better description of what your program is doing. You will find it good practice to make remarks
often, as you will gradually forget what each part of your program does as time goes by. Another use of
REMSTART and REMEND is to temporarily remove command sequences from your program without having
to delete them. By placing these commands around the offending commands, the compiler will ignore them
and will be skipped when the program is run.
SYNTAX:
REMSTART
Remarks Go Here
REMEND
REMEND
40
See above.
#INCLUDE
You can use this command to include the function declarations of other Dark Basic programs. You can use
this command to simplify your main program by writing sub-programs that hold re-usable independent
functions. The #include will associate all the functions within the sub-program with the main program
during compilation. The Filename String must specify a Dark Basic program in the current project directory.
You can #include upto 255 sub-programs in total. Sub-programs can also use the #include command to
further nest sub-programs, but all sub-programs compile into the main program so duplicated function
names are not allowed.
SYNTAX:
#INCLUDE Filename String
CL$()
This command will return the string passed in as a command line when the program is run as a standalone
executable. When this program is created as an EXE file using BUILD EXE or BUILD FINAL, any additional
parameters entered after the executable name are treated as a single command line string. You can use this
string to control how your executable behaves based on the contents of the string.
For example, you may wish to control whether your program runs in 16, 24 or 32 bit display mode. You
could design your program to understand the command line, "GAME.EXE -depth32".
SYNTAX:
Return String=CL$()
TIMER()
This command will get the internal system time, which continually increments at a thousand times a second.
The system time is returned in milliseconds, where 1000 units represent 1 second.
SYNTAX:
Return Value=TIMER()
GET DATE$()
This command will return the current clock date as a formatted string. The string contains the date in the
format MM/DD/YY. MM indicating the current month number 01-12, DD indicating the current date number
01-31 and YY indicating the current year number 00-99.
SYNTAX:
Return String=GET DATE$()
GET TIME$()
This command will return the current clock time as a formatted string. The string contains the time in the
format HH:MM:SS. HH indicating the current hour number 00-23, MM indicating the current minute number
00-59 and SS indicating the current second number 00-59.
SYNTAX:
Return String=GET TIME$()
41
Input Command Set
There are many forms of input data your game can receive in addition to keyboard input. Force-feedback
joysticks, mice, joypads, head trackers and 3D gloves all supply input data that you may wish to support,
not to mention file system support to scan for files.
KEYBOARD COMMANDS
INPUT
This command will accept input data from the keyboard and store the entry in the specified variable. The
string that heads the input command is optional, and allows the user to provide an on-screen prompt for the
data. The data is output to the screen as it is entered.
SYNTAX:
INPUT Variable
INPUT String, Variable
INKEY$()
This command will get the character string of the key currently being pressed.
SYNTAX:
Return String=INKEY$()
UPKEY()
This command will return an integer value of one if the up arrow key is being pressed, otherwise zero is
returned.
SYNTAX:
Return Value=UPKEY()
DOWNKEY()
This command will return an integer value of one if the down arrow key is being pressed, otherwise zero is
returned.
SYNTAX:
Return Value=DOWNKEY()
LEFTKEY()
This command will return an integer value of one if the left arrow key is being pressed, otherwise zero is
returned.
SYNTAX:
Return Value=LEFTKEY()
RIGHTKEY()
This command will return an integer value of one if the right arrow key is being pressed, otherwise zero is
returned.
SYNTAX:
Return Value=RIGHTKEY()
CONTROLKEY()
This command will return an integer value of one if the control key is being pressed, otherwise zero is
returned.
42
SYNTAX:
Return Value=CONTROLKEY()
SHIFTKEY()
This command will return an integer value of one if the shift key is being pressed, otherwise zero is
returned.
SYNTAX:
Return Value=SHIFTKEY()
SPACEKEY()
This command will return an integer value of one if the space key is being pressed, otherwise zero is
returned.
SYNTAX:
Return Value=SPACEKEY()
RETURNKEY()
This command will return an integer value of one if the return key is being pressed, otherwise zero is
returned.
SYNTAX:
Return Value=RETURNKEY()
ESCAPEKEY()
This command will return an integer value of one if the escape key is being pressed, otherwise zero is
returned.
SYNTAX:
Return Value=ESCAPEKEY()
KEYSTATE()
This command will return an integer value of one if the key specified by the scancode is pressed, otherwise
zero will be return. The scancode value is the raw value assigned to the key of the keyboard device and
very often is ordered sequentially from the top left of the keyboard to the bottom right.
SYNTAX:
Return Value=KEYSTATE(Scancode)
SCANCODE()
This command will get the scancode of the key currently being pressed.
SYNTAX:
Return Value=SCANCODE()
MOUSE COMMANDS
HIDE MOUSE
This command will hide the mouse pointer image.
SYNTAX:
HIDE MOUSE
SHOW MOUSE
This command will let you see the mouse pointer image on screen.
43
SYNTAX:
SHOW MOUSE
POSITION MOUSE
This command will change the position of the mouse pointer. By specifying a 2D screen coordinate using
integer values, you can relocate the location of the mouse pointer at any time.
SYNTAX:
POSITION MOUSE X Coordinate, Y Coordinate
MOUSEX()
This command will get the current integer X position of the mouse pointer.
SYNTAX:
Return Value=MOUSEX()
MOUSEY()
This command will get the current integer Y position of the mouse pointer.
SYNTAX:
Return Value=MOUSEY()
MOUSEZ()
This command will get the current integer Z position of the mouse pointer. The Z position usually belongs
to the wheel you can sometimes find in the center of your mouse. The mouse Z position range is 0 to 100.
SYNTAX:
Return Value=MOUSEZ()
MOUSEMOVEX()
This command will get the current integer X movement value of the mouse pointer. Instead of the actual
mouse position, this command returns the difference between the current mouse X position and the last
mouse X position.
SYNTAX:
Return Value=MOUSEMOVEX()
MOUSEMOVEY()
This command will get the current integer Y movement value of the mouse pointer. Instead of the actual
mouse position, this command returns the difference between the current mouse Y position and the last
mouse Y position.
SYNTAX:
Return Value=MOUSEMOVEY()
MOUSEMOVEZ()
This command will get the current integer Z movement value of the mouse pointer. Instead of the actual
mouse position, this command returns the difference between the current mouse Z position and the last
mouse Z position.
SYNTAX:
Return Value=MOUSEMOVEZ()
MOUSECLICK()
This command will return an integer value if a mouse button is pressed. The integer return value will
depend on which mouse button has been pressed. A mouse can have up to four buttons, and each one can
44
be detected using this command. Each button is assigned a value. The left button is assigned a value of 1.
The right button is assigned a value of 2. Buttons three and four are assigned values of 4 and 8
respectively. When more than one button is pressed, the value of the buttons are added to produce a
combined value you can check for. For example both left and right mouse buttons pressed together would
return a value of 3 ( 1 + 2 ).
SYNTAX:
Return Value=MOUSECLICK()
SYNTAX:
PERFORM CHECKLIST FOR CONTROL DEVICES
SYNTAX:
SET CONTROL DEVICE Device Name$
FORCE UP
This command will use the current control device if it has force feedback capability. The command will force
the device upward with a power of magnitude specified between 0 and 100. The magnitude should be an
integer value.
SYNTAX:
FORCE UP Magnitude Value
FORCE DOWN
This command will use the current control device if it has force feedback capability. The command will force
the device downward with a power of magnitude specified between 0 and 100. The magnitude should be an
integer value.
SYNTAX:
FORCE DOWN Magnitude Value
FORCE LEFT
This command will use the current control device if it has force feedback capability. The command will force
the device left with a power of magnitude specified between 0 and 100. The magnitude should be an
integer value.
SYNTAX:
FORCE LEFT Magnitude Value
FORCE RIGHT
This command will use the current control device if it has force feedback capability. The command will force
the device right with a power of magnitude specified between 0 and 100. The magnitude should be an
integer value.
45
SYNTAX:
FORCE RIGHT Magnitude Value
FORCE ANGLE
This command will use the current control device if it has force feedback capability. The command will force
the device in the direction specified by the angle value and at a power of magnitude specified between 0
and 100. The delay value specifies how many milliseconds to sustain the effect of force. The magnitude and
delay should be integer values. A delay value of zero indicates an infinite effect of force. The angle value
should be a real number.
SYNTAX:
FORCE ANGLE Magnitude Value, Angle Value, Delay Value
FORCE CHAINSAW
This command will use the current control device if it has force feedback capability. The command will force
the device to rattle like a chainsaw at a power of magnitude specified between 0 and 100. The delay value
specifies how many milliseconds to sustain the effect of force. A delay value of zero indicates an infinite
effect of force. The magnitude and delay should be integer values.
SYNTAX:
FORCE CHAINSAW Magnitude Value, Delay Value
FORCE SHOOT
This command will use the current control device if it has force feedback capability. The command will force
the device to recoil like a discharging pistol at a power of magnitude specified between 0 and 100. The
delay value specifies how many milliseconds to sustain the effect of force. A delay value of zero indicates an
infinite effect of force. The magnitude and delay should be integer values.
SYNTAX:
FORCE SHOOT Magnitude Value, Delay Value
FORCE IMPACT
This command will use the current control device if it has force feedback capability. The command will force
the device to shudder at a power of magnitude specified between 0 and 100. The delay value specifies how
many milliseconds to sustain the effect of force. A delay value of zero indicates an infinite effect of force.
The magnitude and delay should be integer values.
SYNTAX:
FORCE IMPACT Magnitude Value, Delay Value
FORCE NO EFFECT
This command will use the current control device if it has force feedback capability. The command will force
the device to halt the effect of any forces.
SYNTAX:
FORCE NO EFFECT
SYNTAX:
FORCE WATER EFFECT Magnitude Value, Delay Value
46
FORCE AUTO CENTER ON
This command will use the current control device if it has force feedback capability. The command will force
the device to pull to a central position as though connected by springs.
SYNTAX:
FORCE AUTO CENTER ON
SYNTAX:
FORCE AUTO CENTER OFF
JOYSTICK COMMANDS
JOYSTICK X()
This command will return the X axis value of the default analogue joystick.
SYNTAX:
Return Value=JOYSTICK X()
JOYSTICK Y()
This command will return the Y axis value of the default analogue joystick.
SYNTAX:
Return Value=JOYSTICK Y()
JOYSTICK Z()
This command will return the Z axis value of the default analogue joystick.
SYNTAX:
Return Value=JOYSTICK Z()
SYNTAX:
Return Value=JOYSTICK FIRE A()
SYNTAX:
Return Value=JOYSTICK FIRE B()
SYNTAX:
Return Value=JOYSTICK FIRE C()
47
JOYSTICK FIRE D()
This command will return an integer value of one if the default joystick fire button D is pressed, otherwise
zero will be returned.
SYNTAX:
Return Value=JOYSTICK FIRE D()
JOYSTICK UP()
This command will return an integer value of one if the default joystick is pushed up, otherwise zero is
return.
SYNTAX:
Return Value=JOYSTICK UP()
JOYSTICK DOWN()
This command will return an integer value of one, if the default joystick is pushed down, otherwise zero is
return.
SYNTAX:
Return Value=JOYSTICK DOWN()
JOYSTICK LEFT()
This command will return an integer value of one if the default joystick is pushed left, otherwise zero is
return.
SYNTAX:
Return Value=JOYSTICK LEFT()
JOYSTICK RIGHT()
This command will return an integer value of one if the default joystick is pushed right, otherwise zero is
return.
SYNTAX:
Return Value=JOYSTICK RIGHT()
SYNTAX:
Return Value=JOYSTICK SLIDER A()
SYNTAX:
Return Value=JOYSTICK SLIDER B()
SYNTAX:
Return Value = JOYSTICK SLIDER C()
SYNTAX:
Return Value = JOYSTICK SLIDER D()
48
JOYSTICK TWIST X()
This command will give support for reading joystick X twist.
SYNTAX:
Return Value = JOYSTICK TWIST X()
SYNTAX:
Return Value = JOYSTICK TWIST Y()
SYNTAX:
Return Value = JOYSTICK TWIST Z()
SYNTAX:
Return Value = JOYSTICK HAT ANGLE(Hat Number)
SYNTAX:
Return Value=CONTROL DEVICE NAME$()
SYNTAX:
Return Value=CONTROL DEVICE X()
SYNTAX:
Return Value=CONTROL DEVICE Y()
SYNTAX:
Return Value=CONTROL DEVICE Z()
FTP COMMANDS
FTP CONNECT
This command will allow you to connect to an FTP site.
SYNTAX:
49
FTP CONNECT Url$, User$, Password$
SYNTAX:
FTP SET DIR Directory$
SYNTAX:
FTP FIND FIRST
SYNTAX:
FTP FIND NEXT
SYNTAX:
FTP PUT FILE Local Filename$
SYNTAX:
FTP DELETE FILE Ftp Filename$
SYNTAX:
FTP GET FILE Ftp Filename$, Local filename$
SYNTAX:
FTP GET FILE Ftp Filename$, Local filename$, GrabInBits Flag
FTP DISCONNECT
This command will allow you to disconnect from an ftp site previously connected to using the FTP CONNECT
command. You can optionally specify an integer parameter to disconnect the dial-up connection if dial-up
access was used.
SYNTAX:
FTP DISCONNECT
FTP DISCONNECT DialUp Disconnect Flag
FTP PROCEED
Grab another chunk of the downloading file started by FTP GET FILE. This command will only work if you
have specified the GetInBits flag of the FTP GET FILE command.
50
SYNTAX:
FTP PROCEED
FTP TERMINATE
This command will allow you to terminate a current download started by FTP GET FILE.
SYNTAX:
FTP TERMINATE
SYNTAX:
Return Value = GET FTP STATUS()
SYNTAX:
Return Value = GET FTP DIR$()
SYNTAX:
Return String = GET FTP FILE NAME$()
SYNTAX:
Return Value = GET FTP FILE TYPE()
SYNTAX:
Return Value = GET FTP FILE SIZE()
SYNTAX:
Return Value = GET FTP PROGRESS()
SYNTAX:
Return Value = GET FTP FAILURE()
51
This command will return a string containing the description of a failure from a previously called ftp
command. You can determine whether an ftp command has failed by calling the GET FTP FAILURE()
command.
SYNTAX:
Return String = GET FTP ERROR$()
SYNTAX:
DIR
DRIVELIST
This command will output the available drives to the screen. The command serves little use for effective
drive scanning, but provides a simple way to view available drives.
SYNTAX:
DRIVELIST
SYNTAX:
PERFORM CHECKLIST FOR FILES
SYNTAX:
PERFORM CHECKLIST FOR DRIVES
SET DIR
This command will set the current working directory to the specified path. The path can be absolute or
relative. Absolute paths contain the entire path including the drive letter. A relative path assumes the
program has a valid current working directory and continues the path from the current location.
SYNTAX:
SET DIR Path$
CD
This command will set the current working directory to the specified path. The path can be absolute or
relative. Absolute paths contain the entire path including the drive letter. A relative path assumes the
program has a valid current working directory and continues the path from the current location.
SYNTAX:
CD Path$
FIND FIRST
52
This command will begin a file search by locating the first file in the current working directory. If this
command succeeds, a file will be stored internally and its data can be extracted using the GET FILE
NAME$(), GET FILE DATE$() and GET FILE TYPE() commands.
SYNTAX:
FIND FIRST
FIND NEXT
This command will continue a file search by locating the next file in the current working directory. If this
command succeeds, a file will be stored internally and its data can be extracted using the GET FILE
NAME$(), GET FILE DATE$() and GET FILE TYPE() commands. A file search can be started with the FIND
FIRST command.
SYNTAX:
FIND NEXT
MAKE FILE
This command will create an empty file. The filename must not exist or the command will fail.
SYNTAX:
MAKE FILE Filename
DELETE FILE
This command will delete an existing file. The file must exist or the command will fail.
SYNTAX:
DELETE FILE Filename
COPY FILE
This command will copy an existing file to a new file. The destination filename must not exist or the
command will fail.
SYNTAX:
COPY FILE Source Filename, Destination Filename
MOVE FILE
This command will move an existing file to a new location. The destination filename must not exist or the
command will fail.
SYNTAX:
MOVE FILE Source Filename, Destination Filename
RENAME FILE
This command will rename an existing file to a new name. The new filename must not exist or the
command will fail.
SYNTAX:
RENAME FILE Source Filename, New Filename
EXECUTE FILE
This command will shell execute a file. The command line is used to pass additional data into the file being
executed. The directory is used to optionally specify a directory other than the current directory. The file
must exist or the command will fail. Passing a document, rather than an executable as the filename will
cause the document to be opened.
SYNTAX:
EXECUTE FILE Filename, Commandline, Directory
EXECUTE FILE Filename$, String$, Path$, WaitForTermination Flag
53
MAKE DIRECTORY
This command will create an empty directory. The directory name must not exist or the command will fail.
SYNTAX:
MAKE DIRECTORY Directory Name
DELETE DIRECTORY
This command will delete an existing directory. The directory must exist or the command will fail.
SYNTAX:
DELETE DIRECTORY Directory Name
OPEN TO READ
This command will open a file, ready for reading. The file must exist or the command will fail. You can open
upto 32 files at the same time, using a file number range of 1 through to 32.
SYNTAX:
OPEN TO READ File Number, Filename
OPEN TO WRITE
This command will open a file, ready for writing. The file must not exist or the command will fail. You can
open upto 32 files at the same time, using a file number range of 1 through to 32.
SYNTAX:
OPEN TO WRITE Number, Filename
CLOSE FILE
This command will close a file that has been previously opened using OPEN TO READ or OPEN TO WRITE.
The file must be open or the command will fail.
SYNTAX:
CLOSE FILE File Number
READ FILE
This command will read a long word of data from the file and store it as an integer value in the variable
specified. The file specified by the file number must be open or the command will fail.
SYNTAX:
READ FILE File Number, Variable
READ BYTE
This command will read a byte of data from the file and store it as an integer value in the variable specified.
The file specified by the file number must be open or the command will fail.
SYNTAX:
READ BYTE File Number, Variable
READ WORD
This command will read a word of data from the file and store it as an integer value in the variable
specified. A word represents two bytes. The file specified by the file number must be open or the command
will fail.
SYNTAX:
READ WORD File Number, Variable
READ LONG
54
This command will read a long word of data from the file and store it as an integer value in the variable
specified. A long word represents four bytes. The file specified by the file number must be open or the
command will fail.
SYNTAX:
READ LONG File Number, Variable
READ FLOAT
This command will read a float from the file and store it as an real value in the real variable specified. The
file specified by the file number must be open or the command will fail.
SYNTAX:
READ FLOAT File Number, Variable
READ STRING
This command will read a string from the file and store it as a string in the variable specified. The file
specified by the file number must be open or the command will fail.
SYNTAX:
READ STRING File Number, Variable String
WRITE FILE
This command will write a long word of data to the file from an integer value. The file specified by the file
number must be open or the command will fail.
SYNTAX:
WRITE FILE File Number, Value
WRITE BYTE
This command will write a byte of data to the file from an integer value. The file specified by the file
number must be open or the command will fail.
SYNTAX:
WRITE BYTE File Number, Value
WRITE WORD
This command will write a word of data to the file from an integer value. A word represents two bytes. The
file specified by the file number must be open or the command will fail.
SYNTAX:
WRITE WORD File Number, Value
WRITE LONG
This command will write a long word of data to the file from an integer value. A long word represents four
bytes. The file specified by the file number must be open or the command will fail.
SYNTAX:
WRITE LONG File Number, Value
WRITE FLOAT
This command will write a float to the file from a real value. The file specified by the file number must be
open or the command will fail.
SYNTAX:
WRITE FLOAT File Number, Value
WRITE STRING
55
This command will write the specified string to the file. The string will be terminated in the file with the
standard carriage return ASCII characters (13)+(10). The file specified by the file number must be open or
the command will fail.
SYNTAX:
WRITE STRING File Number, String
READ FILEBLOCK
This command will extract an entire file from a pack file. A pack file is like a normal file you create yourself
using the OPEN and CLOSE commands, but has the additional feature of storing entire files and directories.
SYNTAX:
READ FILEBLOCK File Number, Filename to Create
READ DIRBLOCK
This command will extract an entire directory from a pack file. A pack file is like a normal file you create
yourself using the OPEN and CLOSE commands, but has the additional feature of storing entire files and
directories.
SYNTAX:
READ DIRBLOCK File Number, Folder to Create
WRITE FILEBLOCK
This command will write a file to a pack file. A pack file is like a normal file you create yourself using the
OPEN and CLOSE commands, but has the additional feature of storing entire files and directories.
SYNTAX:
WRITE FILEBLOCK File Number, Filename to Read
WRITE DIRBLOCK
This command will write an entire directory to a pack file. A pack file is like a normal file you create yourself
using the OPEN and CLOSE commands, but has the additional feature of storing entire files and directories.
SYNTAX:
WRITE DIRBLOCK File Number, Folder to Read
SYNTAX:
MAKE MEMBLOCK FROM FILE File Number, Memblock Number
READ MEMBLOCK
Create a memblock from the currently open file. The file must contain a memblock created with the WRITE
MEMBLOCK command, at the exact position within the file. You must specify the file and memblock
numbers using integer values.
SYNTAX:
READ MEMBLOCK File Number, Memblock Number
WRITE MEMBLOCK
Write the specified memblock to a file open for writing. You can store multiple memblocks within a currently
open file, and is useful for creating your own file formats. To retrieve the memblock you must use the READ
MEMBLOCK command. You must specify the file and memblock numbers using integer values.
SYNTAX:
56
WRITE MEMBLOCK File Number, Memblock Number
WRITE TO CLIPBOARD
This command will write a string to the system clipboard. The system clipboard remains in tact even after
the program has been terminated and can be used to transfer values from program to program, or
otherwise retain string data beyond the scope of the program.
SYNTAX:
WRITE TO CLIPBOARD String
GET DIR$()
This command will get the absolute path of the current working directory. Absolute paths contain the entire
path including the drive letter.
SYNTAX:
Return String=GET DIR$()
SYNTAX:
Return String=GET FILE NAME$()
SYNTAX:
Return String=GET FILE DATE$()
SYNTAX:
Return Value=GET FILE TYPE()
FILE EXIST()
This command will return an integer value of one if the specified file exists, otherwise zero is returned.
SYNTAX:
Return Value = FILE EXIST(Filename String)
PATH EXIST()
This command will return an integer value of one if the specified path exists, otherwise zero is returned.
You can use this command to check whether a directory exists.
SYNTAX:
Return Value = PATH EXIST(Pathname String)
FILE SIZE()
This command will return the size of the specified file in bytes, otherwise zero is returned. The file must
exist or the command will fail.
SYNTAX:
Return Value = FILE SIZE(Filename String)
57
FILE OPEN()
This command will return an integer value of one if the file specified by the file number is open, otherwise
zero is returned.
SYNTAX:
Return Value = FILE OPEN(File Number)
FILE END()
This command will return an integer value of one if the file specified by the file number has no more data to
read, otherwise zero is returned.
SYNTAX:
Return Value = FILE END(File Number)
GET CLIPBOARD$()
This command will read a string stored in the system clipboard. The system clipboard remains in tact even
after the program has been terminated and can be used to transfer values from program to program, or
otherwise retain string data beyond the scope of the program.
SYNTAX:
Return String=GET CLIPBOARD$()
GET REGISTRY
Get a value from the specified registry location. The folder name points to the general area within the
registry. The key name points to the label that describes the data stored within the registry folder.
SYNTAX:
Return Value = GET REGISTRY(Folder Name, Key Name)
WRITE TO REGISTRY
Write a value to the specified registry location. The folder name points to the general area within the
registry. The key name points to the label that describes the data stored within the registry folder. The
value is the integer value you wish to store.
SYNTAX:
WRITE TO REGISTRY Folder Name, Key Name, Value
SYNTAX:
CLEAR ENTRY BUFFER
ENTRY$
Returns a string containing all text entered and captured by the keyboard buffer. The entry buffer stores
every ASCII key press allowing you to collect text typed on the keyboard perfectly and will not be affected
by the refresh rate of your application.
SYNTAX:
Return String = ENTRY$()
58
Math Command Set
In addition to all the standard mathematical forms and conditional operators you are able to use a number
of useful expressions. Everything from calculating the arc of a circle to generating a random number can
increase the sophistication of your programs.
INC
The INC command will increment a variable by a specified Value or by a default of 1. Both integer and real
variables can be incremented by either an integer or real value.
SYNTAX:
INC Variable
INC Variable, Value
DEC
The DEC command will decrement a variable by a specified Value or by a default of 1. Both integer and real
variables can be decremented by either an integer or real value.
SYNTAX:
DEC Variable
DEC Variable, Value
RANDOMIZE
The RANDOMIZE command reseeds the random number generator. If the random number generator is not
reseeded the RND() command can return the same sequence of random numbers. To change the sequence
of random number every time the program is run, place a randomize statement with an integer number at
the beginning of the program and change the value with each run.
SYNTAX:
RANDOMIZE Integer Value
SQRT()
This command will return the square root of a value. The value can be an integer or real number. The
return value will be a real number.
SYNTAX:
Return Value=SQRT(Value)
ABS()
This command will return the positive equivalent of a value. The value can be a real or integer number. The
return value can be a real or integer number.
SYNTAX:
Return Value=ABS(Value)
INT()
This command will return the largest integer before the decimal point of a real number. The return value
should be an integer number.
SYNTAX:
Return Value=INT(Value)
RND()
This command will return a random number between 0 and the range provided. The integer range will be
the highest number you want returned. The return value should be an integer number.
59
SYNTAX:
Return Value=RND(Range Value)
EXP()
This command will return a result raised to the power of value. The value should be an integer number. The
return value should be an integer number.
SYNTAX:
Return Value=EXP(Value)
COS()
This command will return the cosine of value were the value is in degrees between 0 and 360. The value
can be a real or integer number. The return value should be a real number.
SYNTAX:
Return Value=COS(Value)
SIN()
This command will return the sine of value where value is in degrees between 0 and 360. The value can be
a real or integer number. The return value should be a real number.
SYNTAX:
Return Value=SIN(Value)
TAN()
This command will returns the tangent of the value. The value can be a real or integer number. The return
value should be a real number.
SYNTAX:
Return Value=TAN(Value)
ACOS()
This command will return the arccosine of a value. The value can be a real or integer number. The return
value should be a real number.
SYNTAX:
Return Value=ACOS(Value)
ASIN()
This command will return the arcsine of value. The value can be a real or integer number. The return value
should be a real number.
SYNTAX:
Return Value=ASIN(Value)
ATAN()
This command will return the tangent in degrees between 0 and 360. The value can be a real or integer
number. The return value should be a real number.
SYNTAX:
Return Value=ATAN(Value)
ATANFULL()
This command will return the angle of two points in degrees between 0 and 360. The distance values are
calculated by finding the distance between two points for both the X and Y axis. The distance values can be
a real or integer number. The return value should be a real number.
60
SYNTAX:
Return Value=ATANFULL(Distance X, Distance Y)
HCOS()
This command will return the hyperbolic cosine of the value. The value can be a real or integer number. The
return value should be a real number.
SYNTAX:
Return Value=HCOS(Value)
HSIN()
This command will return the hyperbolic sine of the value. The value can be a real or integer number. The
return value should be a real number.
SYNTAX:
Return Value=HSIN(Value)
HTAN()
This command will return the hyperbolic tangent of value. The value can be a real or integer number. The
return value should be a real number.
SYNTAX:
Return Value=HTAN(Value)
61
Basic 2D Command Set
You can create graphics of your own using standard draw commands. You are able to draw dots, lines,
boxes, circles and ellipses in any color. You have the tools available to create your own painting package.
Standard 2D commands allow you to generate your graphics during the program, reducing the need to store
bitmaps and other visual media.
CLS
This command will clear the screen using current ink color or the specified color value. Color values range
from 0 to over 16 million, that represent every combination of red, green and blue to make up the final
Color. You can use the RGB command to make the generation of the Color value straight forward. The
parameter should be specified using integer values. You can also clear a bitmap, by using the SET CURRENT
BITMAP command.
SYNTAX:
CLS
CLS Color Value
INK
This command will set the current ink color using the specified color value. color values range from 0 to
over 16 million, that represent every combination of red, green and blue to make up the final color. You can
use the RGB command to make the generation of the color value straight forward. The parameter should be
specified using integer values.
SYNTAX:
INK Foreground color Value, Background color Value
DOT
This command will put a pixel on the screen in the current ink color. The command requires the Co-
ordinates to place the pixel on the screen. The parameters should be specified using integer values. You can
also draw to a bitmap, by using the SET CURRENT BITMAP command.
SYNTAX:
DOT X, Y
BOX
This command will draw a filled box on screen in the current ink color. The command requires the top left
and bottom right coordinates of the box. The parameters should be specified using integer values. You can
also draw to a bitmap, by using the SET CURRENT BITMAP command.
SYNTAX:
BOX Left, Top, Right, Bottom
LINE
This command will put a line on the screen in the current ink color. The command requires two sets of
Coordinates to draw a line from one to the other on the screen. The parameters should be specified using
integer values. You can also draw to a bitmap, by using the SET CURRENT BITMAP command.
SYNTAX:
LINE Xa, Ya, Xb, Yb
CIRCLE
This command will draw a circle on screen using the current ink color. The command requires the radius
and the Coordinates that will represent the center of the circle to be drawn. The parameters should be
specified using integer values. You can also draw to a bitmap, by using the SET CURRENT BITMAP
command.
62
SYNTAX:
CIRCLE X, Y, Radius
ELLIPSE
This command will draw an ellipse on screen using the current ink color. The command requires the X-
Radius, Y-Radius and the Coordinates that will represent the center of the ellipse to be drawn. The
parameters should be specified using integer values. You can also draw to a bitmap, by using the SET
CURRENT BITMAP command.
SYNTAX:
ELLIPSE X, Y, X-Radius, Y-Radius
POINT()
This command will return the pixel color value from the screen at the specified Coordinates. The parameters
should be specified using integer values. You can also read from bitmaps by using the SET CURRENT
BITMAP command.
SYNTAX:
Return Value=POINT(X,Y)
RGB()
This command will return the final color value of a combination of red, green and blue intensities. For each
of the Red, Green and Blue components you must enter a value between 0 and 255. All zero will return a
color value that represents black. All 255 will return a color value that represents white. The parameters
should be specified using integer values. You can also determine the individual color components from the
combined color value by using the commands RGBR, RGBG and RGBB specifying the known color value.
SYNTAX:
Color Value=RGB(Red Value, Green Value, Blue Value)
Red Value=RGBR(Color Value)
Green Value=RGBG(Color Value)
Blue Value=RGBB(Color Value)
63
Text Command Set
Instructions such as SET CURSOR and PRINT are provided for beginners. For more advanced users specific
fonts, sizes, positions, styles and colors are provided to enhance the presentation of text. Text strings can
be manipulated in many ways including the conversion of text to numbers and the extraction of individual
characters.
SET CURSOR
This command will set the cursor position used by the PRINT command. You can use this command to place
basic text anywhere on the screen. The coordinates should be integer values.
SYNTAX:
SET CURSOR X, Y
PRINT
This command will print text, numbers, variables and strings to the screen. You can position where the text
will print using the SET CURSOR command. You can separate items you wish to print on the same line by
using either a semi-colon or a comma. If you add a semi-colon at the end of your print list, the next PRINT
command will add to the end of the last print line.
SYNTAX:
PRINT print list
TEXT
This command will output the provided string using the current text settings at the specified coordinates on
the screen. The coordinates should be integer values.
SYNTAX:
TEXT X, Y, String$
CENTER TEXT
This command will output the provided string using the current text settings at the specified coordinates.
The text will be centered on the X coordinate given. The coordinates should be integer values.
SYNTAX:
CENTER TEXT X, Y, String$
SYNTAX:
PERFORM CHECKLIST FOR FONTS
SYNTAX:
SET TEXT FONT Typeface$
SYNTAX:
SET TEXT SIZE Point Size
64
SET TEXT TO NORMAL
This command will set text style to non-bold and non-italic.
SYNTAX:
SET TEXT TO NORMAL
SYNTAX:
SET TEXT TO ITALIC
SYNTAX:
SET TEXT TO BOLD
SYNTAX:
SET TEXT TO BOLD ITALIC
SYNTAX:
SET TEXT OPAQUE
SYNTAX:
SET TEXT TRANSPARENT
ASC()
This command will return an integer value that represents the ASCII code for the first character of the
provided string.
SYNTAX:
Return Value=ASC(String)
VAL()
This command will return an integer number of the string provided by converting the string to a numerical
form.
SYNTAX:
Return Value=VAL(String)
BIN$()
This command will return a 32 character string equivalent to the binary representation of the specified value
provided. The value provided should be an integer value.
SYNTAX:
Return String=BIN$(Value)
65
CHR$()
This command will return a character string equivalent to the ASCII character number provided. ASCII is a
standard way of coding the characters used to construct strings. The value provided should be an integer
value.
SYNTAX:
Return String=CHR$(Value)
HEX$()
This command will return an eight character string equivalent to the hexadecimal representation of the
number provided. The value provided should be an integer value.
SYNTAX:
Return String=HEX$(Value)
LEFT$()
This command will return a string containing the leftmost characters of the string that was provided. If the
value is greater than the number of characters in string then the entire string is return. If the value is zero
then an empty string is returned. The value provided should be an integer value.
SYNTAX:
Return String=LEFT$(String, Value)
LEN()
This command will return the number of characters in the string provided. Non-printable control characters
and blanks are counted.
SYNTAX:
Return Value=LEN(String)
MID$()
This command will extract a character from the string provided. The return string will contain a single
character extracted from the string specified. The value provided should be an integer value.
SYNTAX:
Return String=MID$(String, Value)
RIGHT$()
This command will return the rightmost set of characters. The value specifies the number of characters to
extract from the string provided. The value provided should be an integer value.
SYNTAX:
Return String=RIGHT$(String, Value)
STR$()
This command will return a string representation of the value provided. The value provided should be an
integer value.
SYNTAX:
Return String=STR$(Value)
LOWER$()
This command will return a string converting the specified string to lowercase.
SYNTAX:
Return String=LOWER$(String)
66
UPPER$()
This command will return a string converting the specified string to uppercase.
SYNTAX:
Return String=UPPER$(String)
TEXT FONT$()
This command will return a string containing the typeface description of the current text settings.
SYNTAX:
Return String=TEXT FONT$()
TEXT SIZE()
This command will return the point size of the current font described by the current text settings.
SYNTAX:
Return Value=TEXT SIZE()
TEXT STYLE()
This command will return a code based on the style of the current text settings. The return value will be an
integer number of zero for normal, 1 for italic, 2 for bold and 3 for bold italic.
SYNTAX:
Return Value=TEXT STYLE()
SYNTAX:
Return Value=TEXT BACKGROUND TYPE()
TEXT WIDTH()
This command will return the width of the provided string using the current text settings.
SYNTAX:
Return Value=TEXT WIDTH(String$)
TEXT HEIGHT()
This command will return the height of the provided string using the current text settings.
SYNTAX:
Return Value=TEXT HEIGHT(String$)
67
Screen Command Set
The screen can be set to any mode your graphics card supports excluding 8bit display modes (256 colours).
The default display mode is 640 x 480 x 16bit and is the most common resolution to use. You are only
limited by the speed, capacity and capability of your graphics card when setting your display mode. Avoid
setting a display mode that consumes most of your available video memory as this will impair 3D
performance. Avoid setting a display mode that exceeds your available video memory as this will
dramatically slow down your screen refresh rate.
SYNTAX:
PERFORM CHECKLIST FOR DISPLAY MODES
SYNTAX:
SET DISPLAY MODE Width, Height, Depth
SET GAMMA
This command will set the screens red, green and blue gamma levels. You can change the gamma to fade
in and out the contents of the screen or alter the ratio of colours displayed. The red, green and blue
component values can range from 0 to 511, with 255 being the default values. Reducing these values fades
each colour component out of the screen, and above the default value enhances the ratio of the component
colour. Some graphics cards do not support gamma alteration.
SYNTAX:
Return Value=CHECK DISPLAY MODE(Width, Height, Depth)
SCREEN TYPE()
This command will return an integer value of the current screen type. A returned value of 0 indicates the
screen is not hardware accelerated. A returned value of 1 indicates the screen is hardware accelerated.
SYNTAX:
Return Value=SCREEN TYPE()
SCREEN WIDTH()
This command will return an integer value of the current screen width.
SYNTAX:
Return Value=SCREEN WIDTH()
SCREEN HEIGHT()
68
This command will return an integer value of the current screen height.
SYNTAX:
Return Value=SCREEN HEIGHT()
SCREEN DEPTH()
This command will return an integer value of the current screen depth. The depth value indicates the
number of bits used to make up a color for the screen and therefore reveal how many colors in total can be
used by the screen. A value of 16 indicates it is a 16-bit screen and uses 32000 colors, whereas a 32-bit
screen uses 16 million colors.
SYNTAX:
Return Value=SCREEN DEPTH()
SCREEN FPS()
This command will get the current frames per second to measure how many times the screen is refreshed
each second. The integer value returned is measured in units of 1/1000th of a second.
SYNTAX:
Return Value=SCREEN FPS()
69
Bitmap Command Set
Bitmap files that are stored in the BMP format can be loaded using the bitmap command set. You can load
or create up to 32 bitmaps for use in your programs. Bitmaps are mainly used to hide graphics off-screen
for storage and manipulation. You are also able to copy, mirror, flip, blur, fade and save your bitmaps to
give you full control over graphics handling.
LOAD BITMAP
This command loads a BMP bitmap file to the screen. You can optionally provide a Bitmap Number between
1 and 32. Once you have loaded the bitmap file successfully, you can use the specified bitmap number to
modify and manage the bitmap. The bitmap number should be specified using an integer value.
SYNTAX:
LOAD BITMAP Filename
LOAD BITMAP Filename, Bitmap Number
CREATE BITMAP
This command will create a blank bitmap of a specified size. The size of the bitmap is only limited by the
amount of system memory available. When you create a bitmap, it becomes the current bitmap. All drawing
operations will be re-directed to the current bitmap and away from the screen. You can use the SET
CURRENT BITMAP command to restore drawing operations to the screen. The parameters should be
specified using integer values.
SYNTAX:
CREATE BITMAP Bitmap Number, Width, Height
SYNTAX:
SET CURRENT BITMAP Bitmap Number
COPY BITMAP
This command will copy the contents of one bitmap into another bitmap providing the destination bitmap is
not smaller than the first. The command requires at least a source and destination bitmap. You can
optionally specify a source area to be copied from and a destination area to be copied to within each
bitmap. If the size of the two areas differ, the source data will be rescaled.
SYNTAX:
COPY BITMAP From-Bitmap, To-Bitmap
COPY BITMAP From-Bitmap, Left, Top, Right, Bottom, To-Bitmap, Left, Top, Right, Bottom
MIRROR BITMAP
This command will mirror the contents of the specified bitmap horizontally. The parameter should be
specified using an integer value.
SYNTAX:
MIRROR BITMAP Bitmap Number
FLIP BITMAP
This command will flip the contents of the specified bitmap vertically. The parameter should be specified
using an integer value.
SYNTAX:
70
FLIP BITMAP Bitmap Number
FADE BITMAP
This command will fade the contents of a specified Bitmap. You must specify a fade value that sets the level
of fading from zero which fades the bitmap completely to black, up to 100 which does not fade the bitmap
at all. Fade operations are slow and the completion time depends on the size of the bitmap. The parameters
should be specified using integer values.
SYNTAX:
FADE BITMAP Bitmap Number, Fade Value
BLUR BITMAP
This command will blur the contents of a specified Bitmap. You must specify a blur value from 1 to 6 to
provide the intensity of the blurring. A blur value of 1 will perform mild blurring, up to a value of 6 that
causes severe blurring. The greater the intensity of blurring, the longer it takes to perform. The time it takes
to blur a bitmap is also dependent on the size of the bitmap. The parameters should be specified using
integer values.
SYNTAX:
BLUR BITMAP Bitmap Number, Blur Value
SAVE BITMAP
This command will save the contents of the screen to a bitmap file. You can optionally provide a bitmap
number to save the contents of a bitmap. Files are saved out in the BMP format. The bitmap number should
be specified using an integer value.
SYNTAX:
SAVE BITMAP Filename
SAVE BITMAP Filename, Bitmap Number
DELETE BITMAP
This command will delete a specified Bitmap. Deleting bitmaps that are no longer used greatly improves
system performance. The parameter should be specified using an integer value.
SYNTAX:
DELETE BITMAP Bitmap Number
BITMAP EXISTS()
This command will return a one if the specified bitmap exists, otherwise zero is returned. The parameter
should be specified using an integer value.
SYNTAX:
Return Value=BITMAP EXIST(Bitmap Number)
CURRENT BITMAP()
This command will return an integer value of the current bitmap number being used. If this value is zero,
the screen is the current bitmap and drawing operations are performed on the visible screen. The parameter
should be specified using an integer value.
SYNTAX:
Return Value=CURRENT BITMAP()
BITMAP WIDTH()
This command will return an integer value of the width of the current bitmap. You can optionally provide a
bitmap number to return the width of a specified bitmap. The parameter should be specified using an
integer value.
71
SYNTAX:
Return Value=BITMAP WIDTH()
Return Value=BITMAP WIDTH(Bitmap Number)
BITMAP HEIGHT()
This command will return an integer value of the height of the current bitmap. You can optionally provide a
bitmap number to return the height of a specified bitmap. The parameter should be specified using an
integer value.
SYNTAX:
Return Value=BITMAP HEIGHT()
Return Value=BITMAP HEIGHT(Bitmap Number)
BITMAP DEPTH()
This command will return an integer value of the color bit-depth of the current bitmap. You can optionally
provide a bitmap number to return the color bit-depth of a specified bitmap. color bit-depths represent the
maximum amount of colors the bitmap can hold. The parameter should be specified using an integer value.
SYNTAX:
Return Value=BITMAP DEPTH()
Return Value=BITMAP DEPTH(Bitmap Number)
BITMAP MIRRORED()
This command will return a one of the current bitmap has been mirrored, otherwise zero is returned. You
can optionally provide a bitmap number to check whether a specified bitmap has been mirrored. The
parameter should be specified using an integer value.
SYNTAX:
Return Value=BITMAP MIRRORED()
Return Value=BITMAP MIRRORED(Bitmap Number)
BITMAP FLIPPED()
This command will return a one of the current bitmap has been flipped, otherwise zero is returned. You can
optionally provide a bitmap number to check whether a specified bitmap has been flipped. The parameter
should be specified using an integer value.
SYNTAX:
Return Value=BITMAP FLIPPED()
Return Value=BITMAP FLIPPED(Bitmap Number)
72
Sprite Command Set
You are able to store over sixty thousand sprite objects at any one time. Sprites allow you to place images
on the screen. The images can be animated and moved around the screen without disturbing the
background bitmap, making them ideal for game sprites in traditional 2D games. You are also able to flip,
mirror, scale and stretch your sprites for enhanced visual effect in your programs.
SPRITE
This command will set the position and image number of the specified sprite. Providing you are using a valid
image number from a previous call to the GET IMAGE command, and the position of the sprite is in the
screen area, you will see your sprite displayed. You can move your sprite by calling the sprite command
with new position coordinates. You can animate your sprite by calling this command with different image
numbers to create the effect of animation. You are able to have over sixty thousand sprites on the screen at
any one time, but it is advisable to restrict yourself to a few hundred sprites for speed critical programs. The
parameters should be specified using integer values.
SYNTAX:
SPRITE Sprite Number, X, Y, Image Number
SET SPRITE
This command will set whether the specified sprite restores its background and whether background
transparency is ignored. If the backsave state is set to zero, the sprite will not restore its background and
leave a trail as it moves. If the transparency state is set to zero, the sprite will not treat black as a
transparent color. A transparent color in the sprite image does not write to the screen. If this feature is
disabled, the sprite would appear as though drawn inside a black rectangle where transparency had
previously been used. Both states are set to one as these are the most common setting. If you to set the
backsave state to zero, it is your responsibility to clear or paste the background each time the sprite is
moved or animated. The sprite number should be specified using an integer value. The backsave and
transparency states should be specified as either zero or one.
SYNTAX:
SET SPRITE Sprite Number, BackSave State, Transparency State
SIZE SPRITE
This command will expand or shrinks the specified sprite according to the size values provided. You must
specify both a horizontal and vertical scale when resizing sprites. The size values must be greater than zero
of the command will fail. The parameters should be specified using integer values.
SYNTAX:
SIZE SPRITE Sprite Number, X-Size Value, Y-Size Value
SCALE SPRITE
This command will expand or shrinks the specified sprite according to the scale value provided. If the scale
value is zero, the sprite will disappear. If the scale value is 100, the sprite will be set to its original size. If
the scale value is set to 200, the size of the sprite will double. The parameters should be specified using
integer values.
SYNTAX:
SCALE SPRITE Sprite Number, Scale Value
STRETCH SPRITE
This command will expand or shrinks the specified sprite according to the scale values provided. You must
specify both a horizontal and vertical scale when stretching sprites. If the scale value is zero, the sprite will
disappear. If the scale value is 100, the sprite will be set to its original size. If the scale value is set to 200,
the size of the sprite will double. The parameters should be specified using integer values.
73
SYNTAX:
STRETCH SPRITE Sprite Number, X-Scale Value, Y-Scale Value
PASTE SPRITE
This command will paste the sprite image to the screen, at the specified coordinates. The sprite image
pasted to the screen is identical to the current state of the sprite, taking into account scaling, flipping and
mirroring. The parameters should be specified using integer values.
SYNTAX:
PASTE SPRITE Sprite Number, X, Y
MIRROR SPRITE
This command will mirror the image of the sprite horizontally. The image itself is untouched, but the
specified sprite will be drawn in reverse. The parameter should be specified using an integer value.
SYNTAX:
MIRROR SPRITE Sprite Number
FLIP SPRITE
This command will vertically flip the visible image of the specified sprite. The image itself is untouched, but
the specified sprite will be drawn upside down. The parameter should be specified using an integer value.
SYNTAX:
FLIP SPRITE Sprite Number
OFFSET SPRITE
This command will shift the position of the drawn image without affecting the coordinate of the specified
sprite. You can use this command to change the visible sprite in relation to the coordinates you use to
position it. The parameters should be specified using integer values.
SYNTAX:
OFFSET SPRITE Sprite Number, X-Offset, Y-Offset
HIDE SPRITE
This command will hide the specified sprite. The parameter should be specified using an integer value.
SYNTAX:
HIDE SPRITE Sprite Number
SHOW SPRITE
This command will show the specified sprite. The parameter should be specified using an integer value.
SYNTAX:
SHOW SPRITE Sprite Number
SYNTAX:
HIDE ALL SPRITES
SYNTAX:
SHOW ALL SPRITES
74
DELETE SPRITE
This command will delete the specified sprite from memory. Deleting unused sprites increases system
performance. The parameter should be specified using an integer value.
SYNTAX:
DELETE SPRITE Sprite Number
LOAD IMAGE
This command will load a bitmap file as an image. You must specify an image number between 1 and
65535. The optional Texture Mode value is used to control the texture capabilities of the image. If you set
the Texture Mode value to 1 you will load the image directly into Video memory, rather than having the
system automatically do it later on. If you set the Texture Mode to 2 you will ask that the image be
compressed when used as a texture. Compressed textures take up less Video memory when used but
requires special hardware on the card called Hardware Texture Compression.
It is recommended you don't use compressed textures when using the black transparency option on 3D
objects that use the texture, as the performance hit is considerable.
SYNTAX
LOAD IMAGE Filename String, Image Number
LOAD IMAGE Filename String, Image Number, Texture Mode
SAVE IMAGE
This command will save an image as a bitmap file. You must specify an existing image number between 1
and 65535. The file must not already exist, otherwise the command will fail.
SYNTAX:
SAVE IMAGE Filename String, Image Number
GET IMAGE
This command will copy a selected area of the current bitmap. You must specify an image number between
1 and 65535. Amongst other things, you can use this command to store sequences of image data and
provide animations for sprites. When images are grabbed, they are stored in memory and do not require the
bitmap from which the image was taken. The parameters should be specified using integer values.
The optional Texture Mode value is used to control the texture capabilities of the image. If you set the
Texture Mode value to 1 you will copy the image directly into Video memory, rather than having the system
automatically do it later on. If you set the Texture Mode to 2 you will ask that the image be compressed
when used as a texture. Compressed textures take up less Video memory when used but requires special
hardware on the card called Hardware Texture Compression.
It is recommended you don't use compressed textures when using the black transparency option on 3D
objects that use the texture, as the performance hit is considerable.
SYNTAX:
GET IMAGE Image Number, Left, Top, Right, Bottom
GET IMAGE Image Number, Left, Top, Right, Bottom, Texture Mode
PASTE IMAGE
This command will paste the specified image to the screen. Optionally, you can paste images to bitmaps
using the SET CURRENT BITMAP command. If the optional transparent flag is set to one, all coloured pixels
of RGB(0,0,0) are not drawn. The parameters should be specified using integer values.
SYNTAX
PASTE IMAGE Image Number, X, Y
PASTE IMAGE Image Number, X, Y, Transparent
75
DELETE IMAGE
This command will delete the specified image from memory. You must not delete images that are being
used by sprites, otherwise those sprites would disappear. Deleting unused images increases system
performance. The parameter should be specified using an integer value.
SYNTAX:
DELETE IMAGE Image Number
IMAGE EXIST()
This command will return a one if the image exists.
SYNTAX:
Return Value=IMAGE EXIST(Image Number)
SPRITE EXIST()
This command will return a one if the specified sprite exists, otherwise zero is returned. The parameter
should be specified using an integer value.
SYNTAX:
Return Value=SPRITE EXIST(Sprite Number)
SPRITE X()
This command will return an integer value of the current X position of the specified sprite. The parameter
should be specified using an integer value.
SYNTAX:
Return Value=SPRITE X(Sprite Number)
SPRITE Y()
This command will return an integer value of the current Y position of the specified sprite. The parameter
should be specified using an integer value.
SYNTAX:
Return Value=SPRITE Y(Sprite Number)
SPRITE IMAGE()
This command will return an integer value of the image number used by the specified sprite. The parameter
should be specified using an integer value.
SYNTAX:
Return Value=SPRITE IMAGE(Sprite Number)
SPRITE WIDTH()
This command will return an integer value of the width of the specified sprite determined by the width of
the current image being used. The parameter should be specified using an integer value.
SYNTAX:
Return Value=SPRITE WIDTH(Sprite Number)
SPRITE HEIGHT()
This command will return an integer value of the height of the specified sprite determined by the height of
the current image being used. The parameter should be specified using an integer value.
SYNTAX:
Return Value=SPRITE HEIGHT(Sprite Number)
76
This command will return an integer value of the specified sprites horizontal scale. The parameter should be
specified using an integer value.
SYNTAX:
Return Value=SPRITE SCALE X(Sprite Number)
SYNTAX:
Return Value=SPRITE SCALE Y(Sprite Number)
SPRITE MIRRORED()
This command will return a one if the specified sprite has been mirrored horizontally, otherwise zero will be
returned. The parameter should be specified using an integer value.
SYNTAX:
Return Value=SPRITE MIRRORED(Sprite Number)
SPRITE FLIPPED()
This command will return a one if the specified sprite has been flipped vertically, otherwise zero will be
returned. The parameter should be specified using an integer value.
SYNTAX:
Return Value=SPRITE FLIPPED(Sprite Number)
SYNTAX:
Return Value=SPRITE OFFSET X(Sprite Number)
SYNTAX:
Return Value=SPRITE OFFSET Y(Sprite Number)
SPRITE HIT()
This command will return a one if the specified sprite has impacted against the target sprite specified. If a
target sprite has not been specified and a value of zero have been used, this command will return the sprite
number of any sprite impacting against it. The parameters should be specified using integer values.
SYNTAX:
Return Value=SPRITE HIT(Sprite Number, Target Sprite Number)
SPRITE COLLISION()
This command will return a one if the specified sprite is overlapping the target sprite specified. If a target
sprite has not been specified and a value of zero have been used, this command will return the sprite
number of any sprite overlapping it. The parameters should be specified using integer values.
SYNTAX:
Return Value=SPRITE COLLISION(Sprite Number, Target Sprite Number)
77
Sound Command Set
Sound files that are stored in the WAV format can be loaded using the sound command set. You can store
over a thousand sounds at any one time, and the number you can play simultaneously is limited to the
power of your sound card. Most sounds cards today allow you to mix an unlimited number of sounds
allowing every sound to be played simultaneously! Sounds can be loaded as 3D sounds or normal sounds.
3D sounds allow the sound to be placed in 3D, perfect for 3D games. All sounds can be played, looped,
paused and adjusted in speed and volume.
LOAD SOUND
This command will load a WAV sound file into the specified Sound Number. The Sound Number must be an
integer value.
SYNTAX:
LOAD SOUND Filename, Sound Number
LOAD SOUND Filename, Sound Number, Priority Flag
LOAD 3DSOUND
This command will load a WAV sound file into the specified Sound Number as a special 3D sound. 3D
sounds can be placed in 3D space and heared through the virtual ears of a listener. The listener can also be
placed anywhere in 3D space creating true surround sound capabilities. The Sound Number must be an
integer value.
SYNTAX:
LOAD 3DSOUND Filename, Sound Number
CLONE SOUND
This command will clone a sound into the specified Destination Sound Number. Cloning a sound will create a
new sound that can be played like any other loaded sound, but uses the same WAV data of the original
sound. The advantage of sound cloning is that one hundred sounds could be used with only a single
instance of the sound data stored in memory. The Sound Number must be an integer value.
SYNTAX:
CLONE SOUND Destination Sound Number, Source Sound Number
PLAY SOUND
This command will play the specified Sound Number. An optional parameter allows you to specify a start
position in bytes that skips the initial part of the sample to be played.
SYNTAX:
PLAY SOUND Sound Number
PLAY SOUND Sound Number, Start Position
LOOP SOUND
This command will play and loop the specified Sound Number continuously. Optional parameters allow you
to specify a start position, end position and initial position in bytes that a looping sound will use as it plays.
SYNTAX:
LOOP SOUND Sound Number
LOOP SOUND Sound Number, Start Position
LOOP SOUND Sound Number, Start Position, End Position
LOOP SOUND Sound Number, Start Position, End Position, Initial Position
STOP SOUND
This command will stop the specified Sound Number if it is playing.
78
SYNTAX:
STOP SOUND Sound Number
RESUME SOUND
This command will resume the specified Sound Number after it has been paused.
SYNTAX:
RESUME SOUND Sound Number
PAUSE SOUND
This command will pause the specified Sound Number whilst it is playing.
SYNTAX:
PAUSE SOUND Sound Number
SYNTAX:
SET SOUND PAN Sound Number, Pan Value
SYNTAX:
SET SOUND SPEED Sound Number, Frequency Value
SYNTAX:
SET SOUND VOLUME Sound Number, Volume Value
DELETE SOUND
This command will delete the specified sound previously loaded into Sound Number.
SYNTAX:
DELETE SOUND Sound Number
RECORD SOUND
This command will start recording a sound from the microphone. You can optionally specify an additional
integer parameter to record a sound for any amount of seconds. The default if this parameter is not
specified is five seconds of recording. You must specify an empty sound number using an integer value.
SYNTAX:
RECORD SOUND Sound Number, Length in Seconds
SYNTAX:
STOP RECORDING SOUND
79
SAVE SOUND
This command will save a sound previously stored in the Sound Number to a file. The sound file will be
stored in the WAV format and the specified file should ideally end with “.WAV”.
SYNTAX:
SAVE SOUND Filename, Sound Number
SET EAX
This command will set the environmental audio effect that all sounds will use. The Effect Value must be a
value between 0 and 26. A value of zero deactivates EAX, where one of the following values activates one of
the preset effects.
1=GENERIC 14=STONECORRIDOR
2=PADDEDCELL 15=ALLEY
3=ROOM 16=FOREST
4=BATHROOM 17=CITY
5=LIVINGROOM 18=MOUNTAINS
6=STONEROOM 19=QUARRY
7=AUDITORIUM 20=PLAIN
8=CONCERTHALL 21=PARKINGLOT
9=CAVE 22=SEWERPIPE
10=ARENA 23=UNDERWATER
11=HANGAR 24=DRUGGED
12=CARPETEDHALLWAY 25=DIZZY
13=HALLWAY 26=PSYCHOTIC
SYNTAX:
SET EAX Effect Value
POSITION SOUND
This command will position the specified 3D sound in 3D space. The 3D sounds you hear are calculated
based on the position of the sound and the listener.
SYNTAX:
POSITION SOUND Sound Number, X, Y, Z
POSITION LISTENER
This command will position the listener in 3D space. The 3D sounds you hear are calculated based on the
position of the sound and the listener.
SYNTAX:
POSITION LISTENER X, Y, Z
ROTATE LISTENER
This command will set the direction of the listener. The 3D sounds being played would sound different
based on which direction the listener was facing.
SYNTAX:
ROTATE LISTENER X, Y, Z
SOUND EXIST()
This command will return an integer value of one if the specified Sound Number exists, otherwise zero will
be returned.
SYNTAX:
80
Return Value=SOUND EXIST(Sound Number)
SOUND TYPE()
This command will return an integer value of one if the specified Sound Number is a special 3D sound,
otherwise zero will be returned.
SYNTAX:
Return Value=SOUND TYPE(Sound Number)
SOUND PLAYING()
This command will return an integer value of one if the specified Sound Number is playing, otherwise zero
will be returned.
SYNTAX:
Return Value=SOUND PLAYING(Sound Number)
SOUND LOOPING()
This command will return an integer value of one if the specified Sound Number is looping, otherwise zero
will be returned.
SYNTAX:
Return Value=SOUND LOOPING(Sound Number)
SOUND PAUSED()
This command will return an integer value of one if the specified Sound Number is paused, otherwise zero
will be returned.
SYNTAX:
Return Value=SOUND PAUSED(Sound Number)
SYNTAX:
Return Value=GET SOUND PAN(Sound Number)
SYNTAX:
Return Value=GET SOUND SPEED(Sound Number)
SYNTAX:
Return Value=GET SOUND VOLUME(Sound Number)
SYNTAX:
Return Value=SOUND POSITION X(Sound Number)
81
SYNTAX:
Return Value=SOUND POSITION Y(Sound Number)
SYNTAX:
Return Value=SOUND POSITION Z(Sound Number)
SYNTAX:
Return Value=LISTENER POSITION X(Sound Number)
SYNTAX:
Return Value=LISTENER POSITION Y(Sound Number)
SYNTAX:
Return Value=LISTENER POSITION Z(Sound Number)
SYNTAX:
Return Value=LISTENER ANGLE X(Sound Number)
SYNTAX:
Return Value=LISTENER ANGLE Y(Sound Number)
SYNTAX:
Return Value=LISTENER ANGLE Z(Sound Number)
82
Music Command Set
Music files that are stored in the MIDI format can be loaded using the music command set. You can store
up to 32 music scores, but only one music score can be played at any one time. Music can be played or
looped indefinitely and paused at any time.
LOAD MUSIC
This command will load a MIDI music file into the specified music number. The music number should be an
integer value.
SYNTAX:
LOAD MUSIC Filename, Music Number
LOAD CDMUSIC
This command will play CD Audio music stored on your CD. The CD Audio track must be specified and
loaded before it can be played. Only one CD Audio track can be loaded and played at any one time. To play
a new track, you must delete a previously loaded track before loading the new one. The parameters must
be specified using integer values.
SYNTAX
LOAD CDMUSIC Track Number, Music Number
PLAY MUSIC
This command will play the specified music number.
SYNTAX:
PLAY MUSIC Music Number
LOOP MUSIC
This command will play and loop the specified music continuously.
SYNTAX:
LOOP MUSIC Music Number
STOP MUSIC
This command will stop the specified music number if it is playing.
SYNTAX:
STOP MUSIC Music Number
PAUSE MUSIC
This command will pause the specified music number if it is playing.
SYNTAX:
PAUSE MUSIC Music Number
RESUME MUSIC
This command will resume the specified music number if it currently paused.
SYNTAX:
RESUME MUSIC Music Number
DELETE MUSIC
This command will delete the specified music previously loaded into a music number.
83
SYNTAX:
DELETE MUSIC Music Number
MUSIC EXIST()
This command will return an integer value of one if the specified music exists, otherwise zero is returned.
SYNTAX:
Return Value=MUSIC EXIST(Music Number)
MUSIC PLAYING()
This command will return an integer value of one if the specified music is playing, otherwise zero is
returned.
SYNTAX:
Return Value=MUSIC PLAYING(Music Number)
MUSIC LOOPING()
This command will return an integer value of one if the specified music is looping, otherwise zero is
returned.
SYNTAX:
Return Value=MUSIC LOOPING(Music Number)
MUSIC PAUSED()
This command will return an integer value of one if the specified music is paused, otherwise a zero is
returned.
SYNTAX:
Return Value=MUSIC PAUSED(Music Number)
84
Animation Command Set
Animation files that are stored in the AVI format can be loaded and played using the animation command
set. Animations can be used to provide video playback and cut sequences in your programs. Animations can
also contain sound. You are able to load and play up to 32 animations simultaneously. Each animation can
be placed and resized anywhere on the screen.
LOAD ANIMATION
This command loads an AVI animation file into the specified animation number. You must specify an
Animation Number between 1 and 32. Once you have loaded the animation file successfully, you can use
the specified animation number to place, play and stop the animation.
SYNTAX:
LOAD ANIMATION Filename, Animation Number
PLAY ANIMATION
This command will play an animation on the screen or to the current Bitmap. By default, animations are
played to the screen. You must provide an Animation Number of a previously loaded animation file. You can
optionally provide either one or two sets of X and Y Coordinates to place and resize the animation anywhere
on the screen.
SYNTAX:
PLAY ANIMATION Animation Number
PLAY ANIMATION Animation Number, X, Y
PLAY ANIMATION Animation Number, X, Y, X, Y
PLAY ANIMATION Animation Number, Bitmap Number, X, Y, X, Y
LOOP ANIMATION
This command plays the specified animation on the screen or to the current Bitmap, and repeats the
animation continuously. You must provide an Animation Number of a previously loaded animation file.
SYNTAX:
LOOP ANIMATION Animation Number
LOOP ANIMATION Animation Number, Bitmap Number, X, Y, X, Y
PLACE ANIMATION
This command redefines the drawing area of a previously loaded animation. Using this command,
animations can be stretched, shrunk or moved across the screen even while the animation is playing.
SYNTAX:
PLACE ANIMATION Animation Number, X, Y, X, Y
PAUSE ANIMATION
This command will pause the specified animation if it is playing.
SYNTAX:
PAUSE ANIMATION Animation Number
RESUME ANIMATION
This command resumes the specified animation if it is currently paused.
SYNTAX:
RESUME ANIMATION Animation Number
STOP ANIMATION
This command stops the specified animation if it is playing.
85
SYNTAX:
STOP ANIMATION Animation Number
DELETE ANIMATION
This command deletes an animation previously loaded into the specified Animation Number. Deleting
animations when you have finished with them improves system performance. If the animation is not
stopped before the animation is deleted, the current frame of the animation remains on the screen or
bitmap.
SYNTAX:
DELETE ANIMATION Animation number
ANIMATION EXIST()
This command will return a one if the specified animation exists, otherwise zero is returned.
SYNTAX:
Return Value=ANIMATION EXIST(Animation Number)
ANIMATION PLAYING()
This command will return a one if the specified animation is playing, otherwise zero is returned.
SYNTAX:
Return Value=ANIMATION PLAYING(Animation Number)
ANIMATION LOOPED()
This command will return a one if the specified animation is looping, otherwise zero will be returned.
SYNTAX:
Return Value=ANIMATION LOOPED(Animation Number)
ANIMATION PAUSED()
This command will return a one if the specified animation is paused, otherwise zero is returned. .
SYNTAX:
Return Value=ANIMATION PAUSED(Animation Number)
SYNTAX:
Return Value=ANIMATION POSITION X(Animation Number)
SYNTAX:
Return Value=ANIMATION POSITION Y(Animation Number)
ANIMATION WIDTH()
This command will return the current width of the specified animation. If you have resized the animation
when playing or placing then the width of the modified animation will be returned.
SYNTAX:
Return Value=ANIMATION WIDTH(Animation Number)
ANIMATION HEIGHT()
86
This command will return the current height of the specified animation. If you have resized the animation
when playing or placing then the height of the modified animation will be returned.
SYNTAX:
Return Value=ANIMATION HEIGHT(Animation Number)
87
Basic 3D Command Set
3D Object files that are stored in the X format can be loaded using this command set. You are able to store
over sixty thousand 3D objects at any one time.. Each object can have an infinite number of sub-objects
known as limbs and an infinite number of textures. Limbs are used to define different parts of your object.
If the object contains texture references, the textures will be loaded automatically. Not only can objects be
positioned, rotated and scaled anywhere in your scene, but they can also perform animation if the object
contains animation data. When using 3D objects, you are only limited by the speed and capacity of your
machine.
LOAD OBJECT
This command loads a 3D model stored in the X file format into the specified 3D object number. You must
specify an 3D Object Number between 1 and 65535. Once you have loaded the 3D object file successfully,
you can use the specified 3D object number to position, rotate, scale, animate and manipulate your 3D
object. The object number should be specified using an integer value.
When you import a model from an external source, you should be aware of the dimensional size of your
object. Models that are less than 50 units in size are too small and will appear tiny when loaded. Models
that exceed several thousand units are too large and may disappear into the back clipping plane. Clipping
planes define the finite visibility of your 3D world, and range from 1 (nearest to the camera) to 5000
(furthest point from the camera). You can change this using the SET CAMERA RANGE command.
If your model file contains texture information, you need to make sure the texture bitmaps are located
somewhere within the same directory as your model file. You should also be aware that the X file format
only supports bitmap texture filenames in the 8.3 format. This means your texture filenames should be
truncated to its first eight characters and end with a '.bmp' extension.
SYNTAX:
LOAD OBJECT Filename, Object Number
DELETE OBJECT
This command will delete the specified 3D object previously loaded. The parameter should be specified
using an integer value.
SYNTAX:
DELETE OBJECT Object Number
SET OBJECT
This command sets the internal properties of a specified 3D object number. You must specify a 3D Object
Number between 1 and 65535.
When the wireframe flag is set to 0, the object only shows it's wireframe form.
When the transparency flag is set to 0, all parts of the object colored black are not drawn to the screen.
When the cull flag is set to 0, the object will draw polygons normally hidden due to the direction the
polygon faces. The Filter Flag activates and deactivates texture filtering, which controls the smoothing effect
of the texture as it is mapped to the object. The Light Flag activates and deactivates the objects sensitivity
to any lights in the scene. The Fog Flag activates and deactivates the objects sensitivity to fog in the scene.
The Ambient Flag activates and deactivates the objects sensitivity to ambient light in the scene. The object
number and flag values should be specified using integer values.
SYNTAX
SET OBJECT Object Number, Wireframe, Transparency, Cull
SET OBJECT Object Number, Wireframe, Transparency, Cull, Filter
SET OBJECT Object Number, Wireframe, Transparency, Cull, Filter, Light
SET OBJECT Object Number, Wireframe, Transparency, Cull, Filter, Light, Fog
SET OBJECT Object Number, Wireframe, Transparency, Cull, Filter, Light, Fog, Ambient
88
MAKE OBJECT
This command will construct a 3D object from a single mesh and image. The mesh is used as the root limb
for the 3D object and the image is used as a texture for the object. You do not have to specify an image
value, but such models will appear white when displayed. The parameters should be specified using integer
values.
SYNTAX:
MAKE OBJECT Object Number, Mesh Number, Image Number
SYNTAX:
MAKE OBJECT SPHERE Object Number, Radius Value
SYNTAX:
MAKE OBJECT CUBE Object Number, Size Value
SYNTAX:
MAKE OBJECT BOX Object Number, Width, Height, Depth
SYNTAX:
MAKE OBJECT CYLINDER Object Number, Size Value
SYNTAX
MAKE OBJECT CONE Object Number, Size Value
SYNTAX:
MAKE OBJECT PLAIN Object Number, Width Value, Height Value
89
MAKE OBJECT TRIANGLE
This command will construct a 3D object from values that describe a single triangle mesh. The mesh is used
as the root limb for the 3D object. The 3D object will be constructed untextured and such models will
appear white when displayed. The object number should be specified using an integer value and the 3D
coordinates specified using real values.
SYNTAX:
MAKE OBJECT TRIANGLE Object Number, X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3
APPEND OBJECT
This command will append all animation data from the 3D object file into the specified object. The new
animation data will begin from the start frame specified up to the length of the files animation data. Ensure
that the 3D object being appended uses the same limb names as the original object, otherwise the load will
fail. The parameters should be specified using integer values.
SYNTAX:
APPEND OBJECT Filename, Object Number, Start Frame
PLAY OBJECT
These commands will play the animation data contained within the specified 3D object. You can optionally
play the animation by providing a specified start and end frame. The parameters should be specified using
integer values.
SYNTAX:
PLAY OBJECT Object Number
PLAY OBJECT Object Number, From Frame
PLAY OBJECT Object Number, From Frame, End Frame
LOOP OBJECT
This command will play and loop the animation data contained within the specified 3D object from the
beginning. You can optionally play and loop the animation by providing a specified start and end frame. The
parameters should be specified using integer values.
SYNTAX:
LOOP OBJECT Object Number
LOOP OBJECT Object Number, From Frame
LOOP OBJECT Object Number, From Frame, End Frame
STOP OBJECT
This command will stop the animation in a specified 3D object. The parameter should be specified using an
integer value.
SYNTAX:
STOP OBJECT Object Number
HIDE OBJECT
This command will hide the specified 3D object from view. You can substantially increase the performance
of your 3D program if you hide objects when ever possible. The contents of a room behind a closed door
can be hidden for as long as the door remains closed, allowing your program to run much faster and
improve overall performance. The parameter should be specified using an integer value.
SYNTAX:
HIDE OBJECT Object Number
SHOW OBJECT
This command will reveal a specified 3D object that was previously hidden. The parameter should be
specified using an integer value.
90
SYNTAX:
SHOW OBJECT Object Number
TEXTURE OBJECT
This command will texture an object using the specified image. The image must not exceed the maximum
texture size of 256x256. The object and image number must be integer values.
SYNTAX:
TEXTURE OBJECT Object Number, Image Number
SCALE OBJECT
This command will scale the specified 3D object to stretch or shrink in all three dimensions, using
percentage scale values. The parameters should be specified using integer values.
SYNTAX:
SCALE OBJECT Object Number, X, Y, Z
COLOR OBJECT
This command will color the specified 3D object using an RGB colour value. The colour value can be
specified using the RGB() command. The parameters should be specified using integer values.
SYNTAX:
COLOR OBJECT Object Number, Colour Value
SYNTAX:
SCROLL OBJECT TEXTURE Object Number, U Value, V Value
SYNTAX:
SCALE OBJECT TEXTURE Object Number, U Value, V Value
SYNTAX:
SET OBJECT FRAME Object Number, Frame Number
SYNTAX:
91
SET OBJECT SPEED Object Number, Speed Value
SYNTAX:
SET OBJECT INTERPOLATION Object Number, Duration Value
SYNTAX:
SET OBJECT ROTATION XYZ Object Number
SYNTAX:
SET OBJECT ROTATION ZYX Object Number
GHOST OBJECT ON
This command will make the specified 3D object semi-transparent if supported by the current display card.
This technique is known as alpha-blending and causes the object to appear as a ghost image. The
parameter should be specified using an integer value.
SYNTAX:
GHOST OBJECT ON Object Number
GHOST OBJECT ON Object Number, Dark Ghosting Flag
SYNTAX:
GHOST OBJECT OFF Object Number
FADE OBJECT
This command will make the specified 3D object fade to the current ambient light level. With ambient light
set to zero and the object faded using a value of zero, the object will be completely unlit. With a fade value
of 200 its illumination will be doubled.. With a fade value of 50, the illumination is halved. This technique
can also be used with a ghosted object to slowly fade an object until completely invisible. The effect of
fading an object is permanent, so fading an object completely to zero destroys its lighting data forever. The
parameter should be specified using an integer value. Setting a fade value of zero will permanently remove
the objects light data. Objects with no light data use the current ambient light level, and will not appear
black unless the ambient light level is also zero.
SYNTAX:
FADE OBJECT Object Number, Fade Value
92
GLUE OBJECT TO LIMB
This command will attach the specified 3D object to a limb of another 3D object. By attaching an object to
the limb of another, the objects position, rotation and scale are entirely controlled by the limb. This
technique can be used to allow a robot arm to easily grab and lift an item, or allow your hero character to
hold and wear a variety of items. The parameters should be specified using integer values.
SYNTAX:
GLUE OBJECT TO LIMB Object Number, Target Object Number, Target Object Limb
SYNTAX:
UNGLUE OBJECT FROM LIMB Object Number
LOCK OBJECT ON
This command will lock the specified 3D object to the screen. Locking objects to the screen commands the
object to completely ignore the cameras influence. A locked object will be positioned as though the camera
had never been altered from its default orientation. To make locked objects visible, simply set the Z position
to a significant positive value. The Object Number should be specified using an integer value.
SYNTAX:
LOCK OBJECT ON Object Number
SYNTAX:
LOCK OBJECT OFF Object Number
SYNTAX:
SET OBJECT TEXTURE Object Number, Texture Wrap Mode, Mipmap Generation Flag
SYNTAX:
DISABLE OBJECT ZDEPTH Object Number
93
ENABLE OBJECT ZDEPTH
This command will return object zdepth info to normal, allowing the object to behave like any other object
in the Z buffer. Use this command to restore your object after calling DISABLE OBJECT ZDEPTH.
SYNTAX:
ENABLE OBJECT ZDEPTH Object Number
OBJECT EXIST()
This command will return a one if the specified 3D object exists, otherwise zero will be returned. The
parameter should be specified using an integer value.
SYNTAX:
Return Value=OBJECT EXIST(Object Number)
SYNTAX:
Return Value=TOTAL OBJECT FRAMES(Object Number)
OBJECT SIZE()
This command will return a real number representing of the full unit size of the specified 3D object. The unit
size can be used to determine whether or not to scale the object for better visibility. Extremely small and
extremely large objects will both suffer visual clipping when viewed by the camera. As a rule, your objects
should have a unit size of between 50 and 3000. The finite visibility of the camera has a range of 5000
units, and objects of a distance greater than this will be clipped. Objects that are so close to the camera
that they pass behind the camera will also be clipped. The parameter should be specified using an integer
value.
SYNTAX:
Return Value=OBJECT SIZE(Object Number)
SYNTAX:
Return Value=OBJECT POSITION X(Object Number)
SYNTAX:
Return Value=OBJECT POSITION Y(Object Number)
SYNTAX:
Return Value=OBJECT POSITION Z(Object Number)
94
This command will return a real value X angle of the specified 3D object. The parameter should be specified
using an integer value.
SYNTAX:
Return Value=OBJECT ANGLE X(Object Number)
SYNTAX:
Return Value=OBJECT ANGLE Y(Object Number)
SYNTAX:
Return Value=OBJECT ANGLE Z(Object Number)
SYNTAX:
Return Value=OBJECT SIZE X(Object Number)
SYNTAX:
Return Value=OBJECT SIZE Y(Object Number)
SYNTAX:
Return Value=OBJECT SIZE Z(Object Number)
OBJECT VISIBLE()
This command will return a one if the specified 3D object is visible, otherwise zero will be returned. The
parameter should be specified using an integer value.
SYNTAX:
Return Value=OBJECT VISIBLE(Object Number)
ANIMATION COMMANDS
SAVE OBJECT ANIMATION
This command will save all animation data of an object to a file.
SYNTAX:
SAVE OBJECT ANIMATION Filename String, Object Number
95
saved containing animation data. The object number is the object you wish to append animation to and the
start frame specifies where you would like to add the animation data in the objects current animation data.
Remember you can only append animation to the end of an objects own animation.
SYNTAX:
APPEND OBJECT ANIMATION Model Filename String, Animation File String, Object Number,
Start Frame Value
SYNTAX:
CLEAR ALL OBJECT KEYFRAMES Object Number
SYNTAX:
CLEAR OBJECT KEYFRAME Object Number, Keyframe Value
SYNTAX:
SET OBJECT KEYFRAME Object Number, Keyframe Value
OBJECT PLAYING()
This command will return a one if the specified 3D object is playing its animation, otherwise zero will be
returned. The parameter should be specified using an integer value.
SYNTAX:
Return Value=OBJECT PLAYING(Object Number)
OBJECT LOOPING()
This command will return a one if the specified 3D object is looping its animation, otherwise zero will be
returned. The parameter should be specified using an integer value.
SYNTAX:
Return Value=OBJECT LOOPING(Object Number)
OBJECT FRAME()
This command will return an integer of the current animation frame of the specified 3D object. The
parameter should be specified using an integer value.
SYNTAX:
Return Value=OBJECT FRAME(Object Number)
OBJECT SPEED()
This command will return an integer value of the current animation speed of the specified 3D object. The
parameter should be specified using an integer value.
SYNTAX:
Return Value=OBJECT SPEED(Object Number)
OBJECT INTERPOLATION()
96
This command will return an integer of the current animation interpolation percentage of the specified 3D
object. The parameter should be specified using an integer value.
SYNTAX:
Return Value=OBJECT INTERPOLATION(Object Number)
SYNTAX:
MAKE STATIC OBJECT Object Number
MAKE STATIC OBJECT Object Number, Occlusion Mode
SYNTAX:
DELETE STATIC OBJECTS
SYNTAX:
MAKE STATIC COLLISION BOX x1,y1,z1,x2,y2,z2
SYNTAX:
SET STATIC OBJECTS TEXTURE Texture Wrap Mode
SYNTAX:
DISABLE STATIC OCCLUSION
97
This command will activate the use of static occlusion.
SYNTAX:
ENABLE STATIC OCCLUSION
SYNTAX:
SAVE STATIC OBJECTS Filename
SYNTAX:
LOAD STATIC OBJECTS Filename
SYNTAX:
ATTACH OBJECT TO STATIC Object Number
SYNTAX:
DETACH OBJECT FROM STATIC Object Number
SYNTAX:
Return Value=GET STATIC COLLISION
HIT( oldx1,oldy1,oldz1,oldx2,oldy2,oldz2,nx1,ny1,nz1,nx2,ny2,nz2)
SY NTAX:
Return Value=GET STATIC COLLISION X(Object Number)
SYNTAX:
Return Value=GET STATIC COLLISION Y(Object Number)
98
GET STATIC COLLISION Z()
This command will return sliding data for Z. Sliding data is produced when using the GET STATIC
COLLISION HIT command.
SYNTAX:
Return Value=GET STATIC COLLISION Z(Object Number)
SYNTAX:
POSITION OBJECT Object Number, X, Y, Z
SYNTAX:
FIX OBJECT PIVOT Object Number
ROTATE OBJECT
This command will rotate the specified 3D object around all three dimensions. The object number should be
specified using an integer value. The rotation angles should be specified using real numbers.
SYNTAX:
ROTATE OBJECT Object Number, X, Y, Z
XROTATE OBJECT
This command will rotate the specified 3D object around the X axis dimension. The object number should be
specified using an integer value. The rotation angle should be specified using a real number.
SYNTAX:
XROTATE OBJECT Object Number, X
YROTATE OBJECT
This command will rotate the specified 3D object around the Y axis dimension. The object number should
be specified using an integer value. The rotation angle should be specified using a real number.
SYNTAX:
YROTATE OBJECT Object Number, Y
ZROTATE OBJECT
This command will rotate the specified 3D object around the Z axis dimension. The object number should
be specified using an integer value. The rotation angle should be specified using a real number.
SYNTAX:
ZROTATE OBJECT Object Number, Z
POINT OBJECT
99
This command will point the specified 3D object towards a point in 3D space. The command sets the current
direction of the object to face towards this point in space. The object number should be specified using an
integer value. The 3D Coordinates should be specified using real numbers.
SYNTAX:
POINT OBJECT Object Number, X, Y, Z
MOVE OBJECT
This command will move the specified 3D object in 3D space. The command uses the current direction of
the object and moves it using the specified step value. In order to see your 3D object, you must ensure the
camera is pointing in the right direction and that both camera and 3D object are within 5000 units from
each other. The object number should be specified using an integer value. The step value should be
specified using a real number.
SYNTAX:
MOVE OBJECT Object Number, Step Value
SYNTAX:
TURN OBJECT LEFT Object Number, Angle
SYNTAX:
TURN OBJECT RIGHT Object Number, Angle
PITCH OBJECT UP
This command will rotate an existing 3D object to pitch upwards. The rotation is independent of any axis
orientation and allows free motion. The value of the angle can be positive or negative. The object number
must be specified using an integer value. The angle must be specified using a real value.
SYNTAX:
PITCH OBJECT UP Object Number, Angle
SYNTAX:
PITCH OBJECT DOWN Object Number, Angle
100
The angle must be specified using a real value.
SYNTAX
ROLL OBJECT LEFT Object Number, Angle
SYNTAX:
ROLL OBJECT RIGHT Object Number, Angle
SYNTAX:
SET OBJECT TO OBJECT ORIENTATION Destination Object Number, Source Object Number
SYNTAX:
SET OBJECT TO CAMERA ORIENTATION Object Number
COLLISION DETECTION
SET OBJECT COLLISION ON
This command will set the specified 3D object to detect for and be detected for any collisions that occur.
The parameter should be specified using an integer value.
SYNTAX:
SET OBJECT COLLISION ON Object Number
SYNTAX:
SET OBJECT COLLISION OFF Object Number
SYNTAX:
MAKE OBJECT COLLISION BOX Object Number,x1,y1,z1,x2,y2,z2,flag
101
SYNTAX:
DELETE OBJECT COLLISION BOX Object Number
SYNTAX:
SET OBJECT COLLISION TO SPHERES Object Number
SYNTAX:
SET OBJECT COLLISION TO BOXES Object Number
SYNTAX:
SET OBJECT COLLISION TO POLYGONS Object Number
SYNTAX:
SET GLOBAL COLLISION ON
SYNTAX:
SET GLOBAL COLLISION OFF
OBJECT COLLISION()
This command will return a one if the two specified 3D objects are overlapping. If the second object number
is set to zero, the number of the object overlapping with the first object will be returned as an integer value.
The parameters should be specified using integer values.
SYNTAX:
Return Value=OBJECT COLLISION(Object Number A, Object Number B)
OBJECT HIT()
This command will return a one if the two specified 3D objects hit each other. If the second object number
is set to zero, the number of the object hit by the first object will be returned as an integer value. The
parameters should be specified using integer values.
SYNTAX:
Return Value=OBJECT HIT(Object Number A, Object Number B)
102
OBJECT SCREEN X()
This command will return the current X screen coordinate of the specified 3D object, even if the object is
not actually within the borders of the screen. You can use this for providing such things as text labels for
your 3D objects or adding lens flare to a nearby street lamp. The parameter should be specified using an
integer value.
SYNTAX:
Return Value=OBJECT SCREEN X(Object Number)
SYNTAX:
Return Value=OBJECT SCREEN Y(Object Number)
OBJECT IN SCREEN()
This command will return a value of one if the specified 3D object is wholey or partly visible within the
screen borders, otherwise zero is returned. Even if the object is behind the camera, it's overall size may
partially clip the screen area.
The parameter should be specified using an integer value.
SYNTAX:
Return Value=OBJECT IN SCREEN(Object Number)
SYNTAX:
Return Value=GET OBJECT COLLISION X(Object Number)
SYNTAX:
Return Value=GET STATIC COLLISION Y(Object Number)
SYNTAX:
Return Value=GET STATIC COLLISION Z(Object Number)
103
often indicates which part of the overall 3D object it belongs to. You can access the limb description using
the string item of the checklist when you have performed the check.
SYNTAX:
PERFORM CHECKLIST FOR OBJECT LIMBS
HIDE LIMB
This command will hide the specified limb within the 3D object.
SYNTAX:
HIDE LIMB Object Number, Limb Number
SHOW LIMB
This command will show the specified limb within the 3D object previously hidden. The parameters should
be specified using integer values.
SYNTAX:
SHOW LIMB Object Number, Limb Number
OFFSET LIMB
This command will change the relative position of the specified limb within the 3D object. The position of
the limb is always offset from the main coordinates of the 3D object and from any parent limbs. Specifying a
limb number of zero provides access to the objects own root data, and should not normally be used in this
way. The object and limb parameters should be specified using integer values. The offset parameters should
be specified using real numbers.
SYNTAX:
OFFSET LIMB Object Number, Limb Number, X, Y, Z
ROTATE LIMB
This command will change the rotation of the specified limb within the 3D object. Specifying a limb number
of zero provides access to the objects own root data, and should not normally be used in this way. The
object and limb parameters should be specified using integer values. The offset parameters should be
specified using real numbers.
SYNTAX:
ROTATE LIMB Object Number, Limb Number, X, Y, Z
SCALE LIMB
This command will change the scale of the specified limb within the 3D object by affecting the percentage
scale value of all three dimensions. Specifying a limb number of zero provides access to the objects own
root data, and should not normally be used in this way. The parameters should be specified using integer
values.
SYNTAX:
SCALE LIMB Object Number, Limb Number, X, Y, Z
ADD LIMB
This command will create a new limb from a specified mesh and add it to an existing 3D object. Limbs can
only be added sequentially, so you must ensure you specify a new limb number that immediately follows an
existing limb. The parameters should be specified using integer values. When a limb is added to a 3D
object, it will not have a place in the object hierarchy. You can position the limb in the object hierarchy
using the LINK LIMB command. Do not confuse LINK LIMB with OFFSET LIMB which sets the actual 3D
position of the limb within the object.
SYNTAX:
ADD LIMB Object Number, Limb Number, Mesh Number
104
LINK LIMB
This command will link a newly created limb to a limb within an existing 3D object. When a limb is
connected to another, it becomes a child limb that will be affected by the position, rotation and scale of it's
parent limbs. The parameters should be specified using integer values.
SYNTAX:
LINK LIMB Object Number, Limb Child, Limb Parent
TEXTURE LIMB
This command will apply an existing image to the limb of a 3D object as a texture. You must create an
image first using the GET IMAGE command before attempting to texture part of the 3D object. The
parameters should be specified using integer values.
Textures need to be of a particular size. The maximum image size you can use as a texture is 256x256. All
images are ideally square and are divisible by 2. So texture sizes of 2x2, 4x4, 8x8, 16x16, 32x32, 64x64 and
128x128 are the standard dimensions to use.
SYNTAX:
TEXTURE LIMB Object Number, Limb Number, Image Number
COLOR LIMB
This command will color the specified limb of a 3D object using an RGB colour value. The parameters must
be integer values. The RGB color value can be generated by using the RGB command.
SYNTAX:
COLOR LIMB Object Number, Limb Number, Color Value
SYNTAX:
SCROLL LIMB TEXTURE Object Number, Limb Number, U Value, V Value
SYNTAX
SCALE LIMB TEXTURE Object Number, Limb Number, U Value, V Value
LIMB EXIST()
This command will return a one if the specified 3D object exists, otherwise zero will be returned.
SYNTAX:
Return Value=LIMB EXIST(Object Number, Limb Number)
105
SYNTAX:
Return Value=LIMB OFFSET X(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB OFFSET Y(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB OFFSET Z(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB ANGLE X(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB ANGLE Y(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB ANGLE Z(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB POSITION X(Object Number, Limb Number)
106
SYNTAX:
Return Value=LIMB POSITION Y(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB POSITION Z(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB DIRECTION X(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB DIRECTION Y(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB DIRECTION Z(Object Number, Limb Number)
LIMB TEXTURE()
This command will return the integer image number used to texture the specified limb of the 3D object.
Limbs that have been loaded pre-textured contain internal image data and return an image number of zero.
The parameters should be specified using integer values.
SYNTAX
Return Value=LIMB TEXTURE(Object Number, Limb Number)
LIMB VISIBLE()
This command will return a one if the specified 3D object exists, otherwise zero will be returned. The
parameters should be specified using integer values.
SYNTAX:
Return Value=LIMB VISIBLE(Object Number, Limb Number)
SYNTAX:
Return Value=LIMB TEXTURE NAME(Object Number, Limb Number)
107
BASIC 3D MESH COMMANDS
LOAD MESH
This command will load a single mesh file into the specified mesh number. A mesh is a wireframe
description of a 3D shape.. You must use a filename that points to a file that stores 3D mesh data in the X
file format. The mesh number should be specified using an integer value.
SYNTAX:
LOAD MESH Filename, Mesh Number
DELETE MESH
This command will delete the specified mesh previously loaded. Deleting unused meshes improves system
performance. After you have used a mesh to create an object or limb, you are free to delete it. The
parameter should be specified using an integer value.
SYNTAX:
DELETE MESH Mesh Number
CHANGE MESH
This command will change the mesh of an object limb. You can use this command to animate an object
that requires a sequence of fixed static meshes. The parameters must be integer values.
SYNTAX:
CHANGE MESH Object Number, Limb Number, Mesh Number
SYNTAX:
MAKE MESH FROM OBJECT Mesh Number, Object Number
MESH EXIST()
This command will return a one if the specified mesh exists, otherwise zero will be returned. The parameter
should be specified using an integer value.
SYNTAX:
Return Value=MESH EXIST(Mesh Number)
LINE OF SIGHT
STATIC LINE OF SIGHT()
This command will project a line from Sx,Sy,Sz to Dx,Dy,Dz in order to determine whether it is being
blocked by static collision areas. The Width determines the thickness of the projected line and the Accuracy
determines how fine the steps are during the check. The fewer steps means the faster the command,
whereas greater steps means greater accuracy. If the line is obstructed, this command will return a value
of one, zero otherwise.
SYNTAX:
Return Value = STATIC LINE OF SIGHT(Sx,Sy,Sz,Dx,Dy,Dz,Width,Accuracy)
108
SYNTAX:
Return Value = STATIC LINE OF SIGHT X()
SYNTAX:
Return Value = STATIC LINE OF SIGHT Y()
SYNTAX:
Return Value = STATIC LINE OF SIGHT Z()
MISCELLANEOUS 3D COMMANDS
BACKDROP ON
This command will activate a 3D backdrop that fills the visible screen. The backdrop is automatically
activated the first time any 3D object is created or loaded in order to clear the background screen. The
backdrop can also be colored, textured and scrolled to create the effects of sky or other background effects.
If you wish to set-up the backdrop before creating your objects, use this command to activate it.
SYNTAX:
BACKDROP ON
BACKDROP OFF
This command will deactivate the 3D backdrop preventing it from being drawn to the screen. The backdrop
is automatically activated the first time any 3D object is created or loaded in order to clear the background
screen. If you do not wish the backdrop to automatically activate, use this command at the start of your
program.
SYNTAX:
BACKDROP OFF
COLOR BACKDROP
This command will COLOR the 3D backdrop in the specified COLOR. You can specify the COLOR of your
choice by using the RGB command to generate the COLOR value to pass into the command. The parameter
should be specified using an integer value.
SYNTAX:
COLOR BACKDROP COLOR Value
TEXTURE BACKDROP
This command will texture the 3D backdrop using the specified image value. To map an image onto the
backdrop, you can obtain an image using the GET IMAGE command and use the image as a texture. The
textures are pasted onto the backdrop as two rows of 3 tiles, which create six visible textures that make up
the backdrop. It is recommended you use seamless textures when texturing the backdrop. The image value
should be specified using an integer value.
SYNTAX:
TEXTURE BACKDROP Image Value
109
SCROLL BACKDROP
This command will scroll the 3D backdrop using the specified X and Y scroll values. The values represent the
percentage used to scroll the textures used by the backdrop. The textures are pasted onto the backdrop as
two rows of 3 tiles, which create six visible textures that make up the backdrop. An X value of 50 will scroll
the texture across by exactly half, and the result of an X value of 100 is identical to an X value of zero. The
X and Y values should be specified using integer values.
SYNTAX:
SCROLL BACKDROP X Value, Y Value
DRAW TO FRONT
This command will set all 2D drawing operations to overwrite any 3D that may be rendering to the screen.
Though it is not recommended for performance reasons to draw 2D whilst displaying 3D, in cases where it is
required this command will ensure text, art and other images are placed on top of any 3D graphics. It does
not, however, prevent these 2D drawings from being overwritten by subsequent cycles of rendered 3D
graphics. This is the default setting.
SYNTAX:
DRAW TO FRONT
DRAW TO BACK
This command will set all 2D drawings to be placed behind any 3D that may be rendering to the screen.
Though it is not recommended for performance reasons to draw 2D whilst displaying 3D, in cases where it is
required this command will ensure text, art and other images are placed behind any 3D graphics.
SYNTAX:
DRAW TO BACK
SYNTAX:
SET MIPMAP MODE Value
SET NORMALIZATION ON
This command will normalizes all 'normals' contained in 3D rendering data. The default is OFF in order that
the original ‘normals’ data is preserved on loading.
SYNTAX:
SET NORMALIZATION ON
SYNTAX:
SET NORMALIZATION OFF
CURVEVALUE()
This command will return an auto-interpolated value based on a given speed. This command will gradually
move a number from its current value to a destination value at a certain speed. This command can be used
to create the technique of controlling a cars velocity as it breaks to a halt. The parameters should be
specified using real numbers.
SYNTAX:
Return Value=CURVEVALUE(Destination Value, Current Value, Speed Value)
110
CURVEANGLE()
This command will return an auto-interpolated angle based on a given speed. This command will gradually
move a number from its current value to a destination value at a certain speed. This command can be used
to create the technique of a camera swinging into position from another location by curving the value of the
camera angles. The parameters should be specified using real numbers.
This command differs from the CURVEVALUE() command as this command takes into account the wrapping
of angles between 0 and 360.
SYNTAX:
Return Value=CURVEANGLE(Destination Value, Current Value, Speed Value)
WRAPVALUE()
This command will return a value that does not exceed the range of 0 to 360. Where a value is specified
that exceeds this range, the command will wrap the value around to bring it back within the range. This
command is best understood by using the number of a clock as a mental picture of how a number wraps. If
the clock hand points to 11 and is then advanced 2 hours, the number has to wrap from 12 around to 1 to
keep the cycle going. The parameter should be specified using a real number.
SYNTAX:
Return Value=WRAPVALUE(Angle Value)
NEWXVALUE()
This command will return a value that represents the new X position of a point in 3D space. This command
is used in conjunction with NEWYVALUE and NEWZVALUE commands to move from one point in space to
another point in space based on a specified angle. Rather than using COS/SIN maths, these commands
simplify the task of moving coordinates within 3D space. The step value specifies how far in the specified
direction you would like to calculate. The parameters should be specified using real numbers.
SYNTAX:
Return Value=NEWXVALUE(Current X Value, Angle Value, Step Value)
NEWYVALUE()
This command will return a value that represents the new Y position of a point in 3D space. This command
is used in conjunction with NEWXVALUE and NEWZVALUE commands to move from one point in space to
another point in space based on a specified angle. Rather than using COS/SIN maths, these commands
simplify the task of moving coordinates within 3D space. The step value specifies how far in the specified
direction you would like to calculate. The parameters should be specified using real numbers.
SYNTAX:
Return Value=NEWYVALUE(Current Y Value, Angle Value, Step Value)
NEWZVALUE()
This command will return a value that represents the new Z position of a point in 3D space. This command
is used in conjunction with NEWXVALUE and NEWYVALUE commands to move from one point in space to
another point in space based on a specified angle. Rather than using COS/SIN maths, these commands
simplify the task of moving coordinates within 3D space. The step value specifies how far in the specified
direction you would like to calculate. The parameters should be specified using real numbers.
SYNTAX:
Return Value=NEWZVALUE(Current Z Value, Angle Value, Step Value)
ALPHABLENDING AVAILABLE()
This command will return an integer value of 1 if the current 3D card supports alpha blending. Alpha
blending is used to create the effect of 3D semi-transparency used by the GHOST OBJECT command.
SYNTAX:
Return Value=ALPHABLENDING AVAILABLE()
111
FILTERING AVAILABLE()
This command will return an integer value of 1 if the current 3D card supports texture filtering. Texture
filtering is used to smooth out your textures, creating a slight bluring effect that improves visual quality.
SYNTAX:
Return Value=FILTERING AVAILABLE()
FOG AVAILABLE()
This command will return an integer value of 1 if the current 3D card supports fogging. Fogging is used to
create the effect of 3D fog used by the commands FOG ON, FOG DISTANCE and FOG COLOR.
SYNTAX:
Return Value=FOG AVAILABLE()
3DBLIT AVAILABLE()
This command will return an integer value of 1 if the current 3D card supports fast 2D operations during 3D
activity. Some graphics cards are designed only for 3D rendering, and perform 2D operations such as GET
IMAGE much slower than dedicated 2D/3D combination cards. You can use this command to ensure your
software will run fast on as many 3D cards as possible.
SYNTAX:
Return Value=3DBLIT AVAILABLE()
112
Camera 3D Command Set
The camera acts as the eye through which you see your 3D world. The camera can be angled in any
direction, pointed towards any location and placed anywhere in your scene with a single command. This
provides the power to create whatever game perspective you want; 1st person, birds-eye, isometric, ground
up or free-floating.
POSITION CAMERA
This command will set the position of the camera in 3D space. The coordinates should be real numbers.
SYNTAX:
POSITION CAMERA X, Y, Z
ROTATE CAMERA
This command will rotate the camera around its X, Y and Z axis. The angle values should be real numbers.
SYNTAX:
ROTATE CAMERA X, Y, Z
XROTATE CAMERA
This command will rotate the camera around its X axis. The angle value should be a real number.
SYNTAX:
XROTATE CAMERA Angle Value
YROTATE CAMERA
This command will rotate the camera around its Y axis. The angle value should be a real number.
SYNTAX:
YROTATE CAMERA Angle Value
ZROTATE CAMERA
This command will rotate the camera around its Z axis. The angle value should be a real number.
SYNTAX:
ZROTATE CAMERA Angle Value
POINT CAMERA
This command will point the camera to a point in 3D space. The coordinates should be real numbers.
SYNTAX:
POINT CAMERA X, Y, Z
MOVE CAMERA
This command will move the camera in the direction it is facing. The step value specifies how far to move
the camera and should be a real number.
SYNTAX:
MOVE CAMERA Step Value
113
The built-in Z-Buffer ensures that objects closer to the camera obscure objects that are further away. If you
set a very small Front Value and a very large Back Value, you will notice that objects do not always appear
behind a closer object. You must ensure that the size of your objects are proportional to the range you
select for your 3D scene.
SYNTAX:
SET CAMERA RANGE Front Value, Back Value
SYNTAX
SET CAMERA VIEW Left, Top, Right, Bottom
SYNTAX
CLEAR CAMERA VIEW Colour Value
SYNTAX:
SET CAMERA ROTATION XYZ
SYNTAX:
SET CAMERA ROTATION ZYX
SYNTAX:
SET CAMERA FOV Angle
114
SYNTAX:
SET CAMERA TO FOLLOW X, Y, Z, Angle, Camdist, Camheight, Camsmooth, ColFlag
AUTOCAM ON
This command will activate the auto camera which will reposition when a new object is loaded or created.
SYNTAX:
AUTOCAM ON
AUTOCAM OFF
This command will deactivate the auto camera. The camera will then no longer reposition when a new
object is loaded or created.
SYNTAX:
AUTOCAM OFF
SYNTAX:
TURN CAMERA LEFT Angle
SYNTAX:
TURN CAMERA RIGHT Angle
PITCH CAMERA UP
This command will pitch the camera upwards. The rotation is independent of any axis orientation and allows
free motion. The value of the angle can be positive or negative. The angle must be specified using a real
value.
SYNTAX:
PITCH CAMERA UP Angle
SYNTAX:
PITCH CAMERA DOWN Angle
SYNTAX:
ROLL CAMERA LEFT Angle
115
This command will roll the camera right. The rotation is independent of any axis orientation and allows free
motion. The value of the angle can be positive or negative. The angle must be specified using a real value.
SYNTAX:
ROLL CAMERA RIGHT Angle
SYNTAX:
SET CAMERA TO OBJECT ORIENTATION Object Number
SYNTAX:
Return Value=CAMERA POSITION X()
SYNTAX:
Return Value=CAMERA POSITION Y()
SYNTAX:
Return Value=CAMERA POSITION Z()
SYNTAX:
Return Value=CAMERA ANGLE X()
SYNTAX:
Return Value=CAMERA ANGLE Y()
SYNTAX:
Return Value=CAMERA ANGLE Z()
116
3D Lighting
3D Lights are used to illuminate your 3D scenes, creating anything from subtle ambient effects, to bright
cones of light and shadows. You are able to create up to 7 unique sources of light, each with its own style,
colour, position and in some cases direction. You can also modify light zero, which is the default illumination
for an empty scene.
MAKE LIGHT
This command will create a new light in the scene. You can create up to 7 new lights, numbered 1 to 7.
Light zero is the default light and is always present. The light number must be specified using an integer
value.
SYNTAX:
MAKE LIGHT Light Number
DELETE LIGHT
This command will delete an existing light from the scene. Light zero is the default light and cannot be
removed, only hidden. The light number must be specified using an integer value.
SYNTAX:
DELETE LIGHT Light Number
SYNTAX:
SET POINT LIGHT Light Number, X, Y, Z
SYNTAX:
SET SPOT LIGHT Light Number, Inner Angle, Outer Angle
SYNTAX:
SET DIRECTIONAL LIGHT Light Number, X, Y, Z
SYNTAX:
SET LIGHT RANGE Light Number, Range Value
117
POSITION LIGHT
This command will position an existing light within the scene. Only spot lights and point lights can make use
of this command. The light number must be specified using an integer value. The coordinates must be
specified using real values.
SYNTAX:
POSITION LIGHT Light Number, X, Y, Z
ROTATE LIGHT
This command will rotate an existing light within the scene. Only spot lights can make use of this command.
The light number must be specified using an integer value. The angles must be specified using real values.
SYNTAX:
ROTATE LIGHT Light Number, X, Y, Z
POINT LIGHT
This command will point an existing light at a location within the scene. Only spot lights and directional
lights can make use of this command. The light number must be specified using an integer value. The
coordinates must be specified using real values.
SYNTAX:
POINT LIGHT Light Number, X, Y, Z
COLOR LIGHT()
This command will color an existing light within the scene. You can specify the color as a single colourvalue
using the RGB command. Alternatively you can specify the color values individually by providing a red,
green and blue component value in the range of -255 to 255. The light number and parameters must be
specified using integer values. You can create dark-light by specifying negative component values for your
colour. Two uses of dark-light are the creation of smooth shadows and cloud cover effects.
SYNTAX:
COLOR LIGHT Light Number, Color Value
COLOR LIGHT Light Number, Red Value, Green Value, Blue Value
HIDE LIGHT
This command will hide an existing light and remove its influence from the scene.
The light number must be specified using an integer value.
SYNTAX:
HIDE LIGHT Light Number
SHOW LIGHT
This command will show an existing light within the scene. The light number must be specified using an
integer value.
SYNTAX:
SHOW LIGHT Light Number
SYNTAX:
SET LIGHT TO OBJECT POSITION Light Number, Object Number
118
To create the effect of headlamps, two spotlights would each take the rotational orientation of a car. The
parameters must be specified using integer values.
SYNTAX:
SET LIGHT TO OBJECT ORIENTATION Light Number, Object Number
SYNTAX:
SET AMBIENT LIGHT Light Value
SYNTAX:
COLOR AMBIENT LIGHT Light Rgb Value
FOG COMMANDS
FOG ON
This command will activate the effect of fogging, if the current display card supports it. All fog color and
distance settings are safely restored when using this command.
SYNTAX:
FOG ON
FOG COLOR
This command will set the color of the fogging effect. The parameter should be specified using an integer
value. The color value can be generated using the RGB command to create over 16 million different colors
of fog.
SYNTAX:
FOG COLOR color Value
FOG DISTANCE
This command will set the visible distance of the fog based on the view from the camera. The distance
value represents the Z depth at which the fog obscures 3D objects. A distance of zero sets the fog to
obscure the camera entirely. A distance of 5000 places the fog to obscure 3D objects as they are Z clipped
by the system. A distance greater than 5000 will not obscure distant 3D objects and will allow the objects to
be visibly clipped. The parameters should be specified using integer values. The parameter should be
specified using an integer value.
SYNTAX:
FOG DISTANCE Distance Value
FOG OFF
This command will deactivate the effect of fogging, if the fog has been previously activated using the FOG
ON command. All fog color and distance settings are safely stored when using this command, allowing a call
to FOG ON to restore all fog settings.
SYNTAX:
FOG OFF
119
LIGHT EXPRESSIONS
LIGHT EXIST()
This command will return a one of the light exists, otherwise a zero is returned.
SYNTAX:
Return Value=LIGHT EXIST(Light Number)
LIGHT TYPE()
This command will return one for point, two for spot and three for a directional light type. The default light
type is directional light.
SYNTAX:
Return Value=LIGHT TYPE(Light Number)
SYNTAX:
Return Value=LIGHT POSITION X(Light Number)
SYNTAX:
Return Value=LIGHT POSITION Y(Light Number)
LIGHT POSITION Z( )
This command will return the Z position of the specified light .
SYNTAX:
Return Value=LIGHT POSITION Z(Light Number)
SYNTAX:
Return Value=LIGHT DIRECTION X(Light Number)
SYNTAX:
Return Value=LIGHT DIRECTION Y(Light Number)
SYNTAX:
Return Value=LIGHT DIRECTION Z(Light Number)
LIGHT VISIBLE()
This command will return a one if the light is active, otherwise zero is returned.
120
SYNTAX:
Return Value=LIGHT VISIBLE(Light Number)
LIGHT RANGE()
This command will return the current range of the specified light.
SYNTAX:
Return Value=LIGHT RANGE(Light Number)
121
Matrix 3D Command Set
You are able to store over sixty thousand matrix planes at any one time. A matrix plane is best described as
a landscape that has been cut into a grid pattern. You can modify the landscape by raising and lowering a
point on the grid, terra forming it to whatever you want. Additionally, you can apply a special texture that
can contain several different styles of floor. These floor textures can then be mapped onto a point on the
grid allowing you paint your landscape anyway you want. To make the matrix even more powerful, you can
shift the matrix in any direction and it will automatically wrap around to effectively create an infinite
landscape!
MAKE MATRIX
This command will create a matrix to a given width and depth segmented into grid square of a specified
arrangement. A matrix can be thought of as a grid landscape with individual tiles that can be textured raised
and lowered to create a wide variety of surfaces. The matrix number and segment values should be integer
values. The width and depth should be real numbers.
SYNTAX:
MAKE MATRIX Matrix Number, Width, Depth, Xsegmented, Zsegmented
SET MATRIX
This command will change the visual properties of the matrix. When the wireframe flag is set to 0, the
matrix only shows it's wireframe form. When the transparency flag is set to 0, all parts of the matrix colored
black are not drawn to the screen. When the cull flag is set to 0, the matrix will draw polygons normally
hidden due to the direction the polygon faces. The Filter Flag activates and deactivates texture filtering,
which controls the smoothing effect of the texture as it is mapped to the matrix. The Light Flag activates
and deactivates the matrices sensitivity to any lights in the scene. The Fog Flag activates and deactivates
the matrices sensitivity to fog in the scene. The Ambient Flag activates and deactivates the matrices
sensitivity to ambient light in the scene. The matrix number and flag values should be specified using
integer values.
SYNTAX
SET MATRIX Matrix Number, Wireframe, Transparency, Cull, Filter, Light, Fog, Ambient
POSITION MATRIX
This command will place the specified matrix at a position in 3D space. The matrix number should be an
integer value. The coordinates should be real numbers.
SYNTAX:
POSITION MATRIX Matrix Number, X, Y, Z
Textures need to be of a particular size. The maximum image size you can use as a texture is 256x256. All
images are ideally square and are divisible by 2. So texture sizes of 2x2, 4x4, 8x8, 16x16, 32x32, 64x64 and
128x128 are the standard dimensions to use. The parameters should be integer values.
SYNTAX:
PREPARE MATRIX TEXTURE Matrix Number, Image Value, Across, Down
FILL MATRIX
122
This command will set each grid square in the matrix to a specified height and tile number. The matrix
number should be an integer value. The height should be a real number. The tile number must be valid
texture tile allocated by the PREPARE MATRIX TEXTURE command and should be an integer value.
SYNTAX:
FILL MATRIX Matrix Number, Height, Tile Number
RANDOMIZE MATRIX
This command will set each grid square in the matrix to a random height between 0 and the height value
given. The matrix number should be an integer value. The height should be a real number.
SYNTAX:
RANDOMIZE MATRIX Matrix Number, Height Range
SYNTAX:
SET MATRIX HEIGHT Matrix Number, X, Z, Height
SYNTAX
SET MATRIX NORMAL Matrix Number, X, Z, NormalX, NormalY, NormalZ
SYNTAX:
SET MATRIX TILE Matrix Number, X, Z, Tile Number
123
SYNTAX:
SET MATRIX TEXTURE Matrix Number, Texture Wrap Mode, Mipmap Generation Flag
UPDATE MATRIX
This command will update all changes you have made to an existing matrix. Any changes you have made
are not visible until you complete the process by using the update matrix command. Updating the matrix is
speed intensive and should be used as little as possible. The matrix number should be an integer value.
SYNTAX:
UPDATE MATRIX Matrix Number
SHIFT MATRIX UP
This command will shift the entire contents of the matrix one grid square up. The shift ensures that the
height and tile data that represent the matrix contents are wrapped around to allow continuous shifting of
the landscape. The matrix number should be an integer value.
SYNTAX:
SHIFT MATRIX UP Matrix Number
SYNTAX:
SHIFT MATRIX DOWN Matrix Number
SYNTAX:
SHIFT MATRIX LEFT Matrix Number
SYNTAX:
SHIFT MATRIX RIGHT Matrix Number
SYNTAX:
SET MATRIX WIREFRAME OFF Matrix Number
SYNTAX:
SET MATRIX WIREFRAME ON Matrix Number
124
GHOST MATRIX ON
This command will make the matrix semi-transparent, allowing the user to see through it. The matrix
number should be specified using an integer value.
SYNTAX:
GHOST MATRIX ON Matrix Number
SYNTAX:
GHOST MATRIX OFF Matrix Number
DELETE MATRIX
This command will delete a specified matrix previously created with make matrix. The matrix number should
be an integer value.
SYNTAX:
DELETE MATRIX Matrix Number
MATRIX EXPRESSIONS
MATRIX EXIST()
This command will return a one if the specified matrix exists otherwise zero will be returned. The matrix
number should be an integer value.
SYNTAX:
Return Value=MATRIX EXIST(Matrix Number)
SYNTAX:
Return Value=MATRIX POSITION X(Matrix Number)
SYNTAX:
Return Value=MATRIX POSITION Y(Matrix Number)
SYNTAX:
Return Value=MATRIX POSITION Z(Matrix Number)
125
SYNTAX:
Return Value=GET MATRIX HEIGHT(Matrix Number, X, Z)
SYNTAX:
Return Value=GET GROUND HEIGHT(Matrix Number, X, Z)
SYNTAX:
Return Value=MATRIX TILE COUNT(Matrix Number)
SYNTAX:
Return Value=MATRIX TILES EXIST(Matrix Number)
SYNTAX:
Return Value=MATRIX WIREFRAME STATE(Matrix Number)
126
System Command Set
Your PC, and indeed any PC system that runs your software will have a wide range of capabilities that your
program may wish to detect and utilize. You may also wish to present the user with a selection of possible
modes and allow a selection to be made.
GRAPHIC CARDS
SYNTAX:
PERFORM CHECKLIST FOR GRAPHICS CARDS
SYNTAX:
SET GRAPHICS CARD Name$
SET EMULATION ON
This command will set the system to software emulation. 3D accelerator hardware is not used in this mode
and renders all 3D using the system processor. This method of rendering 3D is very slow and cannot be
used for mainstream 3D games.
SYNTAX:
SET EMULATION ON
SYNTAX:
SET EMULATION OFF
EMPTY CHECKLIST
This command will clear the general purpose checklist facility.
SYNTAX:
EMPTY CHECKLIST
DISABLE TNL
This command will deactivate the use of hardware transformation and lighting. Hardware T&L is a form of
acceleration that some cards are capable of. T&L frees the main processor from the workload of processing
your 3D scenes.
SYNTAX:
DISABLE TNL
ENABLE TNL
127
This command will activate the use of hardware transformation and lighting. Hardware T&L is a form of
acceleration that some cards are capable of. T&L frees the main processor from the workload of processing
your 3D scenes.
SYNTAX:
ENABLE TNL
TNL AVAILABLE()
This command will return a value of one if the system is currently using transformation and lighting in
hardware. Only graphics cards that have a T&L chipset will be able to render using HW transformation and
lighting. T&L is active by default if the system supports it.
SYNTAX:
Return Value=TNL AVAILABLE()
CHECKLIST QUANTITY()
This command will return the total number of items in the checklist after a PERFORM CHECKLIST command
has been performed.
SYNTAX:
Return Value=CHECKLIST QUANTITY()
SYNTAX:
Return Value=CHECKLIST VALUE A(Item Number)
SYNTAX:
Return Value=CHECKLIST VALUE B(Item Number)
SYNTAX:
Return Value=CHECKLIST VALUE C(Item Number)
SYNTAX:
Return Value=CHECKLIST VALUE D(Item Number)
CHECKLIST STRING$()
This command will return the string from the specified item number in the checklist after a PERFORM
CHECKLIST command has been performed. The item number should be an integer value.
SYNTAX:
Return String=CHECKLIST STRING$(Item Number)
128
SCREEN INVALID()
This command will return a one if the application has been switched out and back in. A typical switch out is
when the user uses the keys ALT+TAB.
SYNTAX:
Return Value=SCREEN INVALID()
SYNTAX:
Return String=CURRENT GRAPHICS CARD$()
EMULATION MODE()
This command will return an integer value of one if the system is in software emulation mode, otherwise
zero will be returned.
SYNTAX:
Return Value=EMULATION MODE()
SYNTAX:
DISABLE ESCAPEKEY
ENABLE ESCAPEKEY
This command will reactivate the escape key. The escape key is deactivated using the DISABLE ESCAPEKEY.
SYNTAX:
ENABLE ESCAPEKEY
EXIT PROMPT
This command will trigger a messagebox to pop up on termination of your application. This command can
be useful if you are debugging and require data to be viewed quickly on exiting your full screen application.
SYNTAX:
EXIT PROMPT Title Name, Description Name
SYNTAX:
HIDE WINDOW
SHOW WINDOW
129
This command will show the window, having previously been hidden by the HIDE WINDOW command.
SYNTAX:
SHOW WINDOW
MINIMIZE WINDOW
This command will minimise the window.
SYNTAX:
MINIMIZE WINDOW
MAXIMIZE WINDOW
This command will maximise the window to the entire desktop screen.
SYNTAX:
MAXIMIZE WINDOW
RESTORE WINDOW
This command will restore the window top the original size and position.
SYNTAX:
RESTORE WINDOW
ALWAYS ACTIVE ON
Switches applications to 'always active' mode, where the program will constantly run even if the application
does not have focus. An application looses focus when you use ALT+TAB to activate another application.
SYNTAX:
ALWAYS ACTIVE ON
SYNTAX:
ALWAYS ACTIVE OFF
SYNTAX:
SET WINDOW TITLE String
SET WINDOW ON
This command will activate Windows Mode, forcing your application to run in a window with its own title bar
and border.
SYNTAX:
SET WINDOW ON
SYNTAX:
SET WINDOW OFF
130
This command will set the window settings. If the Full Window Flag is set to one the window is created with
title bar, minimise and close icons and an icon. If the Title Bar Flag is set to zero, the title bar is removed
from the window. If the Icon Flag is zero, the icon is removed from the window.
SYNTAX:
SET WINDOW LAYOUT Full Window Flag, Title Bar Flag, Icon Flag
SYNTAX:
SET WINDOW POSITION X, Y
SYNTAX:
SET WINDOW SIZE Width, Height
DISABLE SYSTEMKEYS
This command will disable the use of such system keys as ALT+TAB, ALT+F4.
SYNTAX:
DISABLE SYSTEMKEYS
ENABLE SYSTEMKEYS
This command will enable all system keys disabled with DISABLE SYSTEMKEYS.
SYNTAX:
ENABLE SYSTEMKEYS
APPNAME$()
This command will return the full path and filename of the executable built from the program. You can use
this command to determine the name of the executable you are running under, and thus can only return a
string when you have compiled this program and run as an executable.
SYNTAX:
Return String = APPNAME$()
WINDIR$()
This command will return the path string of windows directory. You can use this command to determine the
current Windows directory and thus find and use such areas as the Windows temporary folder (typically
“c:\Windows\temp”). It is always good practise to use this command to locate the correct location of the
Windows directory.
SYNTAX:
Return String = WINDIR$()
SYNTAX:
131
LOAD DLL Filename$, DLL Number
SYNTAX:
DELETE DLL DLL Number
SYNTAX:
CALL DLL DLL Number, Function String, [Params]
Return Data = CALL DLL(DLL Number, Function String, [Params])
SYNTAX:
Return Value = DLL EXIST(DLL Number)
SYNTAX:
Return Value = DLL CALL EXIST(DLL Number, Function String)
MEMORY COMMANDS
SYSTEM DMEM AVAILABLE()
This command will return the total video memory available on the system.
SYNTAX:
Return Value=SYSTEM DMEM AVAILABLE()
SYNTAX:
Return Value=SYSTEM SMEM AVAILABLE()
SYNTAX:
Return Value=SYSTEM TMEM AVAILABLE()
132
133
Memory Blocks
(Enhancement Pack Only)
Memblocks are used to store and manipulate various types of data. Unlike arrays that can store basic
values, memory blocks can be used to manipulate bitmap, image, sound and even 3D mesh data. There are
256 memblocks available and share the common ability to manipulate data at the byte level, share their
internal memory pointers and copy between memblocks easily.
SYNTAX:
MAKE MEMBLOCK Memblock Number, Size in Bytes
SYNTAX:
DELETE MEMBLOCK Memblock Number
SYNTAX:
COPY MEMBLOCK From, To, PosFrom, PosTo, Bytes
SYNTAX:
WRITE MEMBLOCK BYTE Memblock Number, Position, Byte
SYNTAX:
WRITE MEMBLOCK WORD Memblock Number, Position, Word
134
This command will write a dword into the specified location of the memblock. A DWord is the term for a
datatype consisting of four bytes. The memblock must exist or the command will fail. The Position value is
specified in bytes. The DWord value must be a value between 0 and 2147483648. The parameters must be
specified using integer values.
SYNTAX:
WRITE MEMBLOCK DWORD Memblock Number, Position, DWord
SYNTAX:
WRITE MEMBLOCK FLOAT Memblock Number, Position, Float
SYNTAX:
Return Value = MEMBLOCK EXIST(Memblock Number)
SYNTAX:
Return Value = GET MEMBLOCK PTR(Memblock Number)
SYNTAX:
Return Value = GET MEMBLOCK SIZE(Memblock Number)
SYNTAX:
Return Value = MEMBLOCK BYTE(Memblock Number, Position)
SYNTAX:
Return Value = MEMBLOCK WORD(Memblock Number, Position)
135
SYNTAX:
Return Value = MEMBLOCK DWORD(Memblock Number, Position)
SYNTAX:
Return Value = MEMBLOCK FLOAT(Memblock Number, Position)
SYNTAX:
MAKE MEMBLOCK FROM BITMAP Memblock Number, Bitmap Number
SYNTAX:
MAKE BITMAP FROM MEMBLOCK Bitmap Number, Memblock Number
SYNTAX:
MAKE MEMBLOCK FROM IMAGE Memblock Number, Image Number
136
MAKE MEMBLOCK FROM SOUND (Enhancement Pack Only)
This command will make a memblock from a sound. The specified values must be integer values and the
source resource must exist or the command will fail. The memblock stores the data as described below.
SYNTAX:
MAKE MEMBLOCK FROM SOUND Memblock Number, Sound Number
SYNTAX:
MAKE SOUND FROM MEMBLOCK Sound Number, Memblock Number
137
SYNTAX:
MAKE MEMBLOCK FROM MESH Memblock Number, Mesh Number
SYNTAX:
MAKE MESH FROM MEMBLOCK Mesh Number, Memblock Number
SYNTAX:
CHANGE MESH FROM MEMBLOCK Mesh Number, Memblock Number
SYNTAX:
LOCK BACKBUFFER
SYNTAX:
UNLOCK BACKBUFFER
SYNTAX:
Return Pointer = GET BACKBUFFER PTR()
SYNTAX:
Return Value = GET BACKBUFFER WIDTH()
138
GET BACKBUFFER HEIGHT (Enhancement Pack Only)
This command will return the height of the backbuffer. You can pass this data to a DLL to assist in the direct
access of backbuffer memory. You can only use this command when you have used the LOCK BACKBUFFER
command.
SYNTAX:
Return Value = GET BACKBUFFER HEIGHT()
SYNTAX:
Return Value = GET BACKBUFFER DEPTH()
SYNTAX:
Return Value = GET BACKBUFFER PITCH()
139
Multiplayer
Multiplayer is used to create and control games whose players reside on different machines. This is achieved
through a standardised connection system which allows the same commands to be used no matter whether
the game was created across a serial connection, modem, local area network or Internet. The net game
commands are extremely simple to use, and you can create a game and send data in just two commands!
There can only be one net game per application, however with multiple applications running you can
simulate a network game on a single machine.
SYNTAX:
PERFORM CHECKLIST FOR NET CONNECTIONS
SYNTAX:
SET NET CONNECTION Connection Number
SET NET CONNECTION Connection Number, Address Data
SYNTAX:
PERFORM CHECKLIST FOR NET SESSIONS
140
You will need to set a connection before you can create a net game, however this command will
automatically select the first connection it finds if you have selected one.
SYNTAX:
CREATE NET GAME Gamename, Playername, Number Of Players<br>
CREATE NET GAME Gamename, Playername, Number Of Players, Flag
SYNTAX:
JOIN NET GAME Session Number, Playername
SYNTAX:
FREE NET GAME
SYNTAX:
Return Value = NET GAME EXISTS()
SYNTAX:
Return Value = NET GAME NOW HOSTING()
SYNTAX:
Return Value = NET GAME LOST()
141
player is the current local player. Checklist Value D will be set to one if the listed player is the host player of
the net game.
SYNTAX:
PERFORM CHECKLIST FOR NET PLAYERS
SYNTAX:
CREATE NET PLAYER Playername
Return Value = CREATE NET PLAYER(Playername)
SYNTAX:
FREE NET PLAYER Player Number
SYNTAX:
Return Value = NET MESSAGE PLAYER FROM()
SYNTAX:
Return Value = NET MESSAGE PLAYER TO()
SYNTAX:
Return Value = NET PLAYER DESTROYED()
SYNTAX:
Return Value = NET PLAYER CREATED()
142
This command will send a message containing an integer value to the specified player. The Player Number
must be an integer value and an existing player in the net game. A Player Number of zero will send the
message to all players except you.
SYNTAX:
SEND NET MESSAGE INTEGER Player Number, Integer Value
SYNTAX:
SEND NET MESSAGE FLOAT Player Number, Float Value
SYNTAX:
SEND NET MESSAGE STRING Player Number, String
SYNTAX:
SEND NET MESSAGE MEMBLOCK Player Number, Memblock Number
SEND NET MESSAGE MEMBLOCK Player Number, Memblock Number, Guarantee Packet
SYNTAX:
SEND NET MESSAGE IMAGE Player Number, Image Number, Guarantee Packet
SYNTAX:
SEND NET MESSAGE BITMAP Player Number, Bitmap Number, Guarantee Packet
SYNTAX:
SEND NET MESSAGE SOUND Player Number, Sound Number, Guarantee Packet
143
SEND NET MESSAGE MESH (Enhancement Pack Only)
This command will send a message containing a mesh to the specified player. The Player Number must be
an integer value and an existing player in the net game. A Player Number of zero will send the message to
all players except you. The Guarantee Packet Flag, if set to one, will ensure the message is received and will
not be dropped due to slow system performance.
SYNTAX:
SEND NET MESSAGE MESH Player Number, Mesh Number, Guarantee Packet
SYNTAX:
GET NET MESSAGE
SYNTAX:
Return Value = NET MESSAGE INTEGER()
SYNTAX:
Return Value = NET MESSAGE FLOAT()
SYNTAX:
Return Value = NET MESSAGE STRING$()
SYNTAX:
NET MESSAGE MEMBLOCK Memblock Number
SYNTAX:
NET MESSAGE IMAGE Image Number
144
NET MESSAGE BITMAP
This command will return a bitmap from the current net message. The net message must be of the bitmap
type or the command will fail. You can determine type using the NET MESSAGE TYPE command.
SYNTAX:
NET MESSAGE BITMAP Bitmap Number
SYNTAX:
NET MESSAGE SOUND Sound Number
SYNTAX:
NET MESSAGE MESH Mesh Number
SYNTAX:
Return Value = NET MESSAGE EXISTS()
SYNTAX:
Return Value = NET MESSAGE TYPE()
145
Hidden Commands
When DarkBASIC was first released it included a few hidden commands. We now reveal them so you can
exploit every byte of the engine.
PRINTC
This command will print out the contents of the string value to screen. Unlike the standard PRINT
command, the cursor will remain at the end of the line allowing you to continue printing on the same line.
SYNTAX:
PRINTC String Value
ROTATE IMAGE
This command will rotate the specified image by ninety degree steps if supported in hardware. Value
degrees are 0, 90, 180 and 270 and must be specified as integer values.
SYNTAX:
ROTATE IMAGE Image Number, Degree
3DS2X
This command will take a standard V3 or above 3DS file and convert it to a basic X file format retaining all
mesh, texture, hierarchy and animation data in the conversion. This command is superseded by the LOAD
OBJECT which automatically converts a file with the .3DS extension. This command can be used to pre-
convert the models at compile time and speed up your game loading time.
SYNTAX:
3DS2X Filename, Filename
SYNTAX:
FLUSH VIDEO MEMORY
SCALE LISTENER
This command will adjust the relative effect of the values specified to produce 3D sound. The default value
is 1. A value of ten would mean 3D sound values would have to be larger to produce the same decibel of
sound. A value of 0.1 will make 3D sound more sensitive requiring only small values.
SYNTAX:
SCALE LISTENER Value
SYNTAX:
Return Value = OBJECT COLLISION RADIUS(Object Number)
LEEBAMBER
Provides the user with a funny comment printed to the screen
SYNTAX:
LEEBAMBER
MALCOLMBAMBER
146
Provides the user with a funny comment printed to the screen
SYNTAX:
MALCOLMBAMBER
CHRISTOPHERBAMBER
Provides the user with a funny comment printed to the screen
SYNTAX:
CHRISTOPHERBAMBER
BREAK
This will halt the program at the current line and take you to the CLI when in editing mode. When
encountered in an execute, the program will quit. You can use the optional string value to return important
information to the CLI for debugging purposes.
SYNTAX:
BREAK
BREAK String Value
WAIT KEY
Desc: This is just like the suspend key command.
SYNTAX:
WAIT KEY
SYNTAX:
CHECK LIMB LINK Object Number, Limb Number
147
GLOSSARY
2D Area Coordinates
Area coordinates require you to specify two sets of coordinates. One coordinate represents the
top/left of the area you wish to specify, and the second coordinate represents the bottom/right
corner.
2D Collision
When two rectangular areas overlap each other, the two areas are said to be colliding.
2D Coordinates
Coordinates in 2D are represented by an X and Y value. Screen coordinates start at the top/left
of the screen. The default screen size is 640 pixel wide and 480 pixel high. The first X value of
the coordinate specifies a horizontal position that counts from left to right. The second Y value
of the coordinate specifies a vertical position that counts from top to bottom.
3D Accelerator
A 3D Accelerator is a hardware device that will speed up your 3D rendering performance.
3D Coordinates
Coordinates in 3D are represented by an X, Y and Z value. This type of coordinate describes a
point in 3D space. The X describes the horizontal value of the point, the Y describes the
vertical value of the point and the Z describes how far into the distance the point is.
3D Object Animation
3D Objects can sometimes store animation data. 3D objects are animated by rotating,
positioning and scaling the limbs. The animation data describes a sequence of changes that
will be played on the 3D object. It is possible to
append animation data to the end of an existing animation sequence.
3D Object Collision
When two 3D objects in 3D space overlap, they are said to be colliding. There are three types
of collision a 3D object can use, and each depend on the shape of the area of collision. By
default, objects use a collision area that is perfectly contoured to every polygon on the model,
and represents the slowest form of collision. A spherical collision area can be wrapped around
the object to provide the fastest collision detection and a rectangular bounding box is the
third type of collision shape.
3D Object Interpolation
When a 3D object manually sets the new animation frame number, the visual alteration is
instantaneous by default. It is possible, however, to slow down the rate at which the new
frame is set. By slowing down the transition, you can create the effect of the model morphing
seamlessly from one frame to another to smooth the joints between separate animation
sequences.
3D Objects
Three dimensional models are rendered to the screen using 3D objects. The 3D objects carry
all the information about the models position, rotation, scale, special effects, settings and
collision detection.
3D Sound
148
Sounds data is universal, but the manner in which it can be played can vary tremendously. 3D
sounds can be loaded from normal sound data and played as a 3D sound by adding
information about the position of the sound and the position of the listener at the time the
sound is played. This is all the information you are required to provide to create 3D sound.
3D Space
You can imagine 3D space as the infinite void of space. Imagine that you come into this
universe at its very center. You are able to create and position objects within this 3D space to
create absolutely anything you can imagine.
Ambient Light
Ambient light is the light that is automatically introduced into any 3D scene. The intensity of
the light can be adjusted from its current high level to absolutely zero. A second light source
positioned high like the sun provides directional light. 3D objects whose surfaces face this
directional light will be brighter than the ambient light level. By reducing ambient light to zero,
the directional light becomes very distinct.
Analogue Joystick
An analogue joystick is a device which allows you to read analogue data from a joystick.
Analogue is better than digital because it returns precisely how far you have moved the
joystick handle from the center position, whereas digital only returns either True or False for a
particular direction.
Arrays
Arrays are areas of memory reserved for the storage of program data. They can be accessed
using indexes, like a filing system, to allow the program to write out ordered data and retrieve
it at any time.
ASCII Codes
ASCII codes are the values that represent the identities of the characters that make up the
text you are reading now. There are 256 ASCII codes in the standard English character set,
and most of them are hardly ever used. The most common ASCII codes are values 65-89 that
represent the uppercase characters 'A' to 'Z' and values 48-58 that represent characters '0' to
'9'.
Backdrop
The backdrop is an automatic backdrop system when using 3D objects. The backdrop can be
any color, textured and even scrolled to create simple horizon, skyscape and star effects. The
backdrop can even be used as a scrolling ground terrain for games that use a birds-eye
perspective.
Bitmaps
A bitmap is an area in memory were pixel data is stored. This map of pixel data will make up a
graphic image which can be then displayed on screen. Based on the pixel bit depth, a pixel can
take anything from 8 to 32 bits to store the color.
Blitter Objects
149
To blit something is to paste an image to the screen. Blitter objects will repeatedly paste an
image to the screen at a particular position. The advantage of using the blitter object is that
you can move your image around your screen without disturbing the background. You can
keep changing the image to create animation, or scale, stretch, flip and mirror the blitter
object as you see fit. It is a fundamental ingredient to any 2D game.
Camera
Even without using the camera, it is a critical ingredient to displaying any 3D on screen. You
can imagine the camera as an invisible eye that peeks into your 3D world at a particular
position. The camera can either be pointed to a coordinate in 3D space, or rotated to a
specified angle.
Checklists
Checklists are an easy way to gather specific data. Each time you perform a checklist for
particular data, it stores the results of the search in a list and numbers them incrementally.
You can then get the size of the final list, and retrieve any item from the data you wish.
Color Values
Any commands that require a color value will only accept a single integer to specify the color.
You must generate this color value using the RGB command that takes a Red, Green and Blue
component to determine the final color.
Conditions
A condition is created when you compare two values using an operator. A condition will always
be True or False. An operator can be Equal To, Greater Than, Less Than, Greater Or Equal to,
Less Or Equal To or Not Equal To. You can
add additional comparisons using the AND and OR statements. E.g.
IF A=10 THEN PRINT "VARIABLE A IS EQUAL TO TEN"
IF A>10 THEN PRINT "VARIABLE A IS GREATER THAN TEN"
IF A>10 AND B>20 THEN PRINT "A IS GREATER THAN TEN AND B GREATER THAN 20"
Control Devices
Control devices can range from Force Feedback joysticks to Head Mounted Virtual Reality
Headsets. The different types of devices are incredible, but their use can be generalized into
analogue data and button presses. Other devices can be issued commands through the force
feedback commands.
Data Statements
To include data inside your program you can use the DATA commands. Data is compiled with
your program and accessed internally removing the need for external data files. Data can be
stored as integer numbers, real numbers and
strings.
150
Data Types
There are three main types of data. Integer Numbers are whole numbers without a decimal
point. Real Numbers use a decimal point. Strings are the third type of data and are used to
store single characters and whole sentences.
Digital Joystick
A digital joystick is a device which allows you to read the direction when you move the joystick
handle. Unlike analogue joysticks, digital joysticks do not tell you accurately how far the
joystick handle has moved.
Display Modes
The choice of display modes is determined by the type of graphics card you have. The default
display mode is 640x480x16 which creates a screen to that size and bit depth. Providing your
card supports it, you can set the display mode to anything you wish. Eight bit display modes
are not supported.
DLL
Stands for Device Link Library. These can be created using other languges such as C or C++.
You can then call a DLL using the specific DLL commands within Dark BASIC (Enhanced version
only).
Expressions
An expression is a mathematical calculation that evaluates to a value. An expression can be
made up of commands that return a value, user functions that return a value, variables and
immediate values. You can use brackets and mathematical operators on all values, providing
the expression is calculable and makes sense.
File System
The file system is the part of the PC that handles the access, reading and writing of files on
your drives. You should have some knowledge of drives, directories and files before using file
system commands. You may accidentally delete something important.
Fogging
Most modern 3D cards have a fog feature that allows the world to be cloaked in a mist that
obscures the scene the further away from the camera you look. Fog color and thickness can be
controlled to create a variety of effects.
Fonts
A collection of text character sets with predefined typefaces. Two examples of fonts are
Courier or Times New Roman. Fonts can also be altered in style, size, color and transparency.
Force Feedback
A type of control device that can provide force to the operator of a joystick. Force feedback
can make a joystick move the stick in any direction and even create realistic tensions such as
the mobility you might feel if wading through water.
Graphics Cards
151
A part of a PC that controls the screen display. Most PCs are fitted with 2D cards as standard,
sufficient to operate Windows smoothly. Many games require a graphics card with 3D
acceleration to handle the demands of modern software.
Hardware Acceleration
Hardware Acceleration can be achieved by fitting a 3D graphics card.
Images
Images are no more than graphic blocks that have been grabbed from a bitmap and stored in
memory. Images are used for fast graphics pasting, but more often are used to provide the
animations for bobs and the textures for 3D objects.
Integer Number
A whole number without a decimal point.
Jumps
When a program finds a jump command, it leaps to a new part of the program and continues
running from its new location. GOSUB jumps allow the program to return to the point from
which it jumped. GOTO jumps are permanent jumps and do not allow this. All jumps require a
label in the program to jump to.
Keyboard
The keys on a keyboard can be divided into two types. Normal keys and control keys. Normal
keys are the letters, numbers and symbols you associate with printable characters. Control
keys are often indicated as the shaded keys on the keyboard. These keys use different
commands to detect their use as very often control keys are used in combination with normal
keys.
Label
A label is a plain English marker that is used by the program to make a jump. Labels are most
often used to declare a subroutine that must always be headed by a label, or used to declare
the start of a set of DATA statements.
Loading Media
Media files can be any of the BMP, AVI, WAV, MID, X or TXT type. Media files are often used
to store data that has been retrieved or prepared externally and represents the visuals and
audio of your software. When you load media files, an area of memory is used to store the
data and it will remain their until you either quit the program or delete it.
Loops
A program is run by executing the first command in the program, then moving to the next
one. This process repeats until there are no more commands to execute. A program loop takes
this pointer and returns it to an earlier part of the program. When such a loop occurs, the
program continually re-executes the same section of commands until the loop is broken. There
are several types of program loop, but all share the same process of looping until the loop is
broken.
Matrix Grids
A Matrix can be described as a grid of tiles that can be raised and lowered to create
landscapes. You can also texture, rotate and scroll the matrix to create a variety of realistic
landscape scenes and effects.
Memory Block
152
An area of memory that’s laid out in a set format for easy storing and manipulation of game
specific data (e.g. sound, music, mesh, images etc).
Meshes
A mesh is a wireframe description of a 3D shape.
Mouse Pointer
The arrow that moves around the screen when you move the mouse is the mouse pointer. You
can retrieve the 2D coordinate of a mouse pointer and detect for mouse button clicks very
easily.
Multiplayer
Term used to describe a game that involved 2 or more players. Multiplayer games can exist in
a single DarkBASIC file or in a Client-Server based system.
Music
Music is played using the MIDI sequencer that takes advantage of any advanced sound card
technology.
PC System
It is important to realize that if you wish your software to be used on other machines that your
software will not fail. It is always important to check for the existence of a mode or device
before presuming you can use it. Checking the memory of a machine can reveal how much
media you can afford to load in at any one time.
Real Number
These numbers use decimal points to specify floating point values. Real variables are
recognized for having a hash(#) as the last character.
Remarks
Remarks are used to make comments within the program, providing a plain English description
of what a particular piece of code does. There are many ways to implement remarks, including
the time honoured REM statement.
Screens
A screen is defined by the current display mode. The default display mode is 640 pixels wide,
480 pixels high and has a bit depth of 16. This means your visible screen is 640x480. If you
change the display mode you change the screen. The screen itself uses bitmap zero to draw
to. Anything you draw to bitmap zero will appear on the visible screen. You only have one
screen at any one time, but you are able to store bitmaps off-screen and use bitmap zero as
the work area for your software.
153
Sounds
Sounds are played using WAV data. You are able to alter a sounds speed, volume and
panning. Panning is the effect of moving a sound from one speaker to another. You can also
generate true 3D sounds by providing 3D information for the sound. You are able to play many
sounds simultaneously, but it is recommended to keep to 4-6 for performance reasons.
Strings
Strings are used to store single characters, words and whole sentences. They are recognized
by enclosing the text you wish to treat as a string in speech marks. String variables are
recognized for having a dollar($) sign as the last character.
System Memory
The main RAM chips plugged into your motherboard represent the total amount of system
memory in your machine. Do not confuse this with available total memory which takes into
account memory used by Windows, other applications and your software.
Text Settings
At any time, the text settings hold data that determines how text printed by the TEXT or
CENTER TEXT commands will be output to the screen. Text settings hold typeface, style, size,
color and transparency information.
Textures
Textures are used to paint the surfaces of 3D objects. You can apply your own texture to a 3D
object by grabbing an image from a bitmap and simply texturing it. Textures cannot be greater
than 256x256 is size. The texture size must be divisible by two. Some graphics cards will not
render the texture if the width and height are different sizes.
Time Format
Commands that require a time value must be given a value measured in milliseconds where
1000 units represent 1 second of time.
Video Memory
The RAM built into your graphics card represents the total amount of video memory in your
machine. It is not possible to determine how much video memory is being used at any one
time due to the dynamic nature of Dark Basic.
Visible Screen
154
The visible screen uses the contents of bitmap zero as the work area. Drawing to bitmap zero,
which is the default, is in effect drawing to the screen. Bitmap zero cannot be deleted. If the
program switches the display mode, the screen also changes to the dimensions of the display
mode.
Wireframe
A wireframe is a method of displaying a shape, matrix or 3D object without filling it in with
shades or textures. Wireframe displays are useful for measuring polygon complexity and a few
parlour tricks. The downside to using wireframe is that the shapes are clipped when they leave
the screen, allowing the user to see the triangle divisions taking place that may not be
desirable in a finished piece of software.
X File Format
The XOF file format is the primary format used by DirectX developers to load 3D data quickly.
It is not the most common file format amongst modellers and 3D animators, but converters
are available to convert the more common 3DS, LWO and COB files over.
155
Command Index
CAMERA ANGLE X(), 115
# CAMERA ANGLE Y(), 115
CAMERA ANGLE Z(), 115
#INCLUDE, 39 CAMERA POSITION X(), 115
CAMERA POSITION Y(), 115
3 CAMERA POSITION Z(), 115
3DBLIT AVAILABLE(), 110 CASE, 36
3DS2X, 144 CASE DEFAULT, 36
CD, 51
A CENTER TEXT, 63
CHANGE MESH, 106
ABS(), 58 CHANGE MESH FROM MEMBLOCK, 136
ACOS(), 59 CHECK DISPLAY MODE(), 67
ADD LIMB, 103 CHECKLIST QUANTITY(), 127
ALPHABLENDING AVAILABLE(), 110 CHECKLIST STRING$(), 127
ALWAYS ACTIVE OFF, 129 CHECKLIST VALUE A(), 127
ALWAYS ACTIVE ON, 129 CHECKLIST VALUE B(), 127
ANIMATION EXIST(), 85 CHECKLIST VALUE C(), 127
ANIMATION HEIGHT(), 85 CHECKLIST VALUE D(), 127
ANIMATION LOOPED(), 85 CHR$(), 65
ANIMATION PAUSED(), 85 CHRISTOPHERBAMBER, 145
ANIMATION PLAYING(), 85 CIRCLE, 61
ANIMATION POSITION X(), 85 CL$(), 40
ANIMATION POSITION Y(), 85 CLEAR ALL OBJECT KEYFRAMES, 95
ANIMATION WIDTH(), 85 CLEAR CAMERA VIEW, 113
APPEND OBJECT, 89 CLEAR ENTRY BUFFER, 57
APPEND OBJECT ANIMATION, 94 CLEAR OBJECT KEYFRAME, 95
APPNAME$(), 130 CLONE SOUND, 77
ASC(), 64 CLOSE FILE, 53
ASIN(), 59 CLS, 61
ATAN(), 59 COLOR AMBIENT LIGHT, 118
ATANFULL(), 59 COLOR BACKDROP, 108
ATTACH OBJECT TO STATIC, 97 COLOR LIGHT(), 117
AUTOCAM OFF, 114 COLOR LIMB, 104
AUTOCAM ON, 114 COLOR OBJECT, 90
CONTROL DEVICE NAME$(), 48
B CONTROL DEVICE X(), 48
BACKDROP OFF, 108 CONTROL DEVICE Y(), 48
BACKDROP ON, 108 CONTROL DEVICE Z(), 48
BIN$(), 64 CONTROLKEY(), 41
BITMAP DEPTH(), 71 COPY BITMAP, 69
BITMAP EXISTS(), 70 COPY FILE, 52
BITMAP FLIPPED(), 71 COPY MEMBLOCK, 132
BITMAP HEIGHT(), 71 COS(), 59
BITMAP MIRRORED(), 71 CREATE BITMAP, 69
BITMAP WIDTH(), 70 CREATE NET GAME, 138
BLUR BITMAP, 70 CREATE NET PLAYER, 140
BOX, 61 CURRENT BITMAP(), 70
BREAK, 145 CURRENT GRAPHICS CARD$(), 128
CURVEANGLE(), 109
C CURVEVALUE(), 109
156
D EXP(), 59
DATA, 37
F
DEC, 58
DELETE ANIMATION, 85 FADE BITMAP, 70
DELETE BITMAP, 70 FADE OBJECT, 91
DELETE DIRECTORY, 52 FILE END(), 56
DELETE DLL, 130 FILE EXIST(), 56
DELETE FILE, 52 FILE OPEN(), 56
DELETE IMAGE, 74 FILE SIZE(), 56
DELETE LIGHT, 116 FILL MATRIX, 121
DELETE MATRIX, 124 FILTERING AVAILABLE(), 110
DELETE MEMBLOCK, 132 FIND FIRST, 51
DELETE MESH, 106 FIND NEXT, 51
DELETE MUSIC, 82 FIX OBJECT PIVOT, 98
DELETE OBJECT, 87 FLIP BITMAP, 69
DELETE OBJECT COLLISION BOX, 100 FLIP SPRITE, 73
DELETE SOUND, 78 FLUSH VIDEO MEMORY, 144
DELETE SPRITE, 74 FOG AVAILABLE(), 110
DELETE STATIC OBJECTS, 96 FOG COLOR, 118
DETACH OBJECT FROM STATIC, 97 FOG DISTANCE, 118
DIM, 38 FOG OFF, 118
DIR, 51 FOG ON, 118
DISABLE ESCAPEKEY, 128 FOR NEXT, 33
DISABLE OBJECT ZDEPTH, 92 FORCE ANGLE, 45
DISABLE STATIC OCCLUSION, 96 FORCE AUTO CENTER OFF, 46
DISABLE SYSTEMKEYS, 130 FORCE AUTO CENTER ON, 45
DISABLE TNL, 126 FORCE CHAINSAW, 45
DLL CALL EXIST, 131 FORCE DOWN, 44
DLL EXIST, 131 FORCE IMPACT, 45
DO LOOP, 34 FORCE LEFT, 44
DOT, 61 FORCE NO EFFECT, 45
DOWNKEY(), 41 FORCE RIGHT, 44
DRAW TO BACK, 108 FORCE SHOOT, 45
DRAW TO FRONT, 108 FORCE UP, 44
DRIVELIST, 51 FORCE WATER EFFECT, 45
FREE NET GAME, 139
E FREE NET PLAYER, 140
FTP CONNECT, 48
ELLIPSE, 62
FTP DELETE FILE, 49
EMPTY CHECKLIST, 126
FTP DISCONNECT, 49
EMULATION MODE(), 128
FTP FIND FIRST, 49
ENABLE ESCAPEKEY, 128
FTP FIND NEXT, 49
ENABLE OBJECT ZDEPTH, 92
FTP GET FILE, 49
ENABLE STATIC OCCLUSION, 96
FTP PROCEED, 49
ENABLE SYSTEMKEYS, 130
FTP PUT FILE, 49
ENABLE TNL, 126
FTP SET DIR, 48
END, 35
FTP TERMINATE, 49
ENDCASE, 36
FUNCTION, 34
ENDFUNCTION, 35
ENDSELECT, 36
G
ENTRY$, 57
ESCAPEKEY(), 42 GET BACKBUFFER DEPTH, 137
EXECUTE FILE, 52 GET BACKBUFFER HEIGHT, 136
EXIT, 34 GET BACKBUFFER PITCH, 137
EXIT PROMPT, 128 GET BACKBUFFER PTR, 136
EXITFUNCTION, 35 GET BACKBUFFER WIDTH, 136
157
GET CLIPBOARD$(), 57 IF THEN, 33
GET DATE$(), 40 IMAGE EXIST(), 75
GET DIR$(), 55 INC, 58
GET FILE DATE$(), 56 INK, 61
GET FILE NAME$(), 56 INKEY$(), 41
GET FILE TYPE(), 56 INPUT, 41
GET FTP DIR$(), 50 INT(), 58
GET FTP ERROR$(), 50
GET FTP FAILURE(), 50 J
GET FTP FILE NAME$(), 50
GET FTP FILE SIZE(), 50 JOIN NET GAME, 139
GET FTP FILE TYPE(), 50 JOYSTICK DOWN(), 47
JOYSTICK FIRE A(), 46
GET FTP PROGRESS(), 50
JOYSTICK FIRE B(), 46
GET FTP STATUS(), 50
JOYSTICK FIRE C(), 46
GET GROUND HEIGHT(), 125
JOYSTICK FIRE D(), 46
GET IMAGE, 74
GET MATRIX HEIGHT(), 124 JOYSTICK HAT ANGLE(), 48
GET MEMBLOCK PTR, 133 JOYSTICK LEFT(), 47
JOYSTICK RIGHT(), 47
GET MEMBLOCK SIZE, 133
JOYSTICK SLIDER A(), 47
GET NET MESSAGE, 142
JOYSTICK SLIDER B(), 47
GET OBJECT COLLISION X(), 102
JOYSTICK SLIDER C(), 47
GET OBJECT COLLISION Y(), 102
GET OBJECT COLLISION Z(), 102 JOYSTICK SLIDER D(), 47
GET REGISTRY, 57 JOYSTICK TWIST X(), 47
JOYSTICK TWIST Y(), 48
GET SOUND PAN(), 80
JOYSTICK TWIST Z(), 48
GET SOUND SPEED(), 80
JOYSTICK UP(), 47
GET SOUND VOLUME(), 80
JOYSTICK X(), 46
GET STATIC COLLISION HIT(), 97
GET STATIC COLLISION X(), 97 JOYSTICK Y(), 46
GET STATIC COLLISION Y(), 97 JOYSTICK Z(), 46
GET STATIC COLLISION Z(), 97
GET TIME$(), 40 K
GHOST MATRIX OFF, 124 KEYSTATE(), 42
GHOST MATRIX ON, 123
GHOST OBJECT OFF, 91 L
GHOST OBJECT ON, 91
GLUE OBJECT TO LIMB, 91 LEEBAMBER, 144
GOSUB, 35 LEFT$(), 65
GOTO, 35 LEFTKEY(), 41
LEN(), 65
H LIGHT DIRECTION X(), 119
LIGHT DIRECTION Y(), 119
HCOS(), 60 LIGHT DIRECTION Z(), 119
HEX$(), 65 LIGHT EXIST(), 119
HIDE ALL SPRITES, 73 LIGHT POSITION X(), 119
HIDE LIGHT, 117 LIGHT POSITION Y(), 119
HIDE LIMB, 102 LIGHT POSITION Z( ), 119
HIDE MOUSE, 42 LIGHT RANGE(), 119
HIDE OBJECT, 89 LIGHT TYPE(), 119
HIDE SPRITE, 73 LIGHT VISIBLE(), 119
HIDE WINDOW, 128 LIMB ANGLE X(), 105
HSIN(), 60 LIMB ANGLE Y(), 105
HTAN(), 60 LIMB ANGLE Z(), 105
LIMB DIRECTION Y(), 106
I LIMB EXIST(), 104
IF ENDIF, 33 LIMB OFFSET X(), 104
158
LIMB OFFSET Y(), 104 MAKE OBJECT CUBE, 88
LIMB POSITION X(), 105 MAKE OBJECT CYLINDER, 88
LIMB POSITION Y(), 105 MAKE OBJECT PLAIN, 88
LIMB POSITION Z(), 105 MAKE OBJECT SPHERE, 88
LIMB TEXTURE NAME(), 106 MAKE OBJECT TRIANGLE, 88
LIMB TEXTURE(), 106 MAKE SOUND FROM MEMBLOCK, 135
LIMB VISIBLE(), 106 MAKE STATIC OBJECT, 96
LINE, 61 MALCOLMBAMBER, 144
LINK LIMB, 103 MATRIX EXIST(), 124
LISTENER ANGLE X(), 81 MATRIX POSITION X(), 124
LISTENER ANGLE Y(), 81 MATRIX POSITION Y(), 124
LISTENER ANGLE Z(), 81 MATRIX POSITION Z(), 124
LISTENER POSITION X(), 81 MATRIX TILE COUNT(), 125
LISTENER POSITION Y(), 81 MATRIX TILES EXIST(), 125
LISTENER POSITION Z(), 81 MATRIX WIREFRAME STATE(), 125
LOAD 3DSOUND, 77 MAXIMIZE WINDOW, 129
LOAD ANIMATION, 84 MEMBLOCK BYTE, 133
LOAD ARRAY, 38 MEMBLOCK DWORD, 133
LOAD BITMAP, 69 MEMBLOCK EXIST, 133
LOAD CDMUSIC, 82 MEMBLOCK FLOAT, 134
LOAD DLL, 130 MEMBLOCK WORD, 133
LOAD IMAGE, 74 MESH EXIST(), 107
LOAD MESH, 106 MID$(), 65
LOAD MUSIC, 82 MINIMIZE WINDOW, 129
LOAD OBJECT, 87 MIRROR BITMAP, 69
LOAD SOUND, 77 MIRROR SPRITE, 73
LOAD STATIC OBJECTS, 97 MOUSECLICK(), 43
LOCK BACKBUFFER, 136 MOUSEMOVEX(), 43
LOCK OBJECT OFF, 92 MOUSEMOVEY(), 43
LOCK OBJECT ON, 92 MOUSEMOVEZ(), 43
LOOP ANIMATION, 84 MOUSEX(), 43
LOOP MUSIC, 82 MOUSEY(), 43
LOOP OBJECT, 89 MOUSEZ(), 43
LOOP SOUND, 77 MOVE CAMERA, 112
LOWER$(), 65 MOVE FILE, 52
MOVE OBJECT, 98
M MUSIC LOOPING(), 83
MUSIC PAUSED(), 83
MAKE BITMAP FROM MEMBLOCK, 134
MUSIC PLAYING(), 83
MAKE DIRECTORY, 52
MAKE FILE, 52
N
MAKE IMAGE FROM MEMBLOCK, 134
MAKE LIGHT, 116 NET GAME EXISTS(), 139
MAKE MATRIX, 121 NET GAME LOST(), 139
MAKE MEMBLOCK, 132 NET GAME NOW HOSTING(), 139
MAKE MEMBLOCK FROM BITMAP, 134 NET MESSAGE BITMAP, 143
MAKE MEMBLOCK FROM FILE, 55 NET MESSAGE EXISTS(), 143
MAKE MEMBLOCK FROM IMAGE, 134 NET MESSAGE FLOAT, 142
MAKE MEMBLOCK FROM MESH, 135 NET MESSAGE IMAGE, 142
MAKE MEMBLOCK FROM SOUND, 134 NET MESSAGE INTEGER, 142
MAKE MESH FROM MEMBLOCK, 136 NET MESSAGE MEMBLOCK, 142
MAKE MESH FROM OBJECT, 107 NET MESSAGE MESH, 143
MAKE OBJECT, 88 NET MESSAGE PLAYER FROM(), 140
MAKE OBJECT BOX, 88 NET MESSAGE PLAYER TO(), 140
MAKE OBJECT COLLISION BOX, 100 NET MESSAGE SOUND, 143
MAKE OBJECT CONE, 88 NET MESSAGE STRING, 142
159
NET MESSAGE TYPE(), 143 PERFORM CHECKLIST FOR NET PLAYERS,
NET PLAYER CREATED(), 140 139
NET PLAYER DESTROYED(), 140 PERFORM CHECKLIST FOR NET
NEWXVALUE(), 109 SESSIONS, 138
NEWYVALUE(), 110 PERFORM CHECKLIST FOR OBJECT
NEWZVALUE(), 110 LIMBS, 102
PITCH CAMERA DOWN, 114
O PITCH CAMERA UP, 114
PITCH OBJECT DOWN, 99
OBJECT ANGLE X(), 93
PITCH OBJECT UP, 99
OBJECT ANGLE Y(), 94 PLACE ANIMATION, 84
OBJECT ANGLE Z(), 94 PLAY ANIMATION, 84
OBJECT COLLISION RADIUS, 144
PLAY MUSIC, 82
OBJECT COLLISION(), 101
PLAY OBJECT, 89
OBJECT EXIST(), 93
PLAY SOUND, 77
OBJECT FRAME(), 95
POINT CAMERA, 112
OBJECT HIT(), 101 POINT LIGHT, 117
OBJECT IN SCREEN(), 102 POINT OBJECT, 98
OBJECT INTERPOLATION(), 95
POINT(), 62
OBJECT LOOPING(), 95
POSITION CAMERA, 112
OBJECT PLAYING(), 95
POSITION LIGHT, 117
OBJECT POSITION X(), 93
POSITION LISTENER, 79
OBJECT POSITION Y(), 93 POSITION MATRIX, 121
OBJECT POSITION Z(), 93 POSITION MOUSE, 43
OBJECT SCREEN X(), 101
POSITION OBJECT, 98
OBJECT SCREEN Y(), 101
POSITION SOUND, 79
OBJECT SIZE X(), 94
PREPARE MATRIX TEXTURE, 121
OBJECT SIZE Y(), 94
PRINT, 63
OBJECT SIZE Z(), 94 PRINTC, 144
OBJECT SIZE(), 93
OBJECT SPEED(), 95
R
OBJECT VISIBLE(), 94
OFFSET LIMB, 103 RANDOMIZE, 58
OFFSET SPRITE, 73 RANDOMIZE MATRIX, 122
OPEN TO READ, 53 READ, 37
OPEN TO WRITE, 53 READ BYTE, 53
READ DIRBLOCK, 55
P READ FILE, 53
READ FILEBLOCK, 54
PASTE IMAGE, 74
READ FLOAT, 53
PASTE SPRITE, 73
READ LONG, 53
PATH EXIST(), 56
READ MEMBLOCK, 55
PAUSE ANIMATION, 84 READ STRING, 54
PAUSE MUSIC, 82 READ WORD, 53
PAUSE SOUND, 78
RECORD SOUND, 78
PERFORM CHECKLIST FOR CONTROL
REM, 39
DEVICES, 44
REMEND, 39
PERFORM CHECKLIST FOR DISPLAY
REMSTART, 39
MODES, 67 RENAME FILE, 52
PERFORM CHECKLIST FOR DRIVES, 51 REPEAT UNTIL, 34
PERFORM CHECKLIST FOR FILES, 51
RESTORE, 37
PERFORM CHECKLIST FOR FONTS, 63
RESTORE WINDOW, 129
PERFORM CHECKLIST FOR GRAPHICS
RESUME ANIMATION, 84
CARDS, 126
RESUME MUSIC, 82
PERFORM CHECKLIST FOR NET RESUME SOUND, 78
CONNECTIONS, 138 RETURNKEY(), 42
160
RGB(), 62 SET CAMERA VIEW, 113
RIGHT$(), 65 SET CONTROL DEVICE, 44
RIGHTKEY(), 41 SET CURRENT BITMAP, 69
RND(), 58 SET CURSOR, 63
ROLL CAMERA LEFT, 114 SET DIR, 51
ROLL CAMERA RIGHT, 114 SET DIRECTIONAL LIGHT, 116
ROLL OBJECT LEFT, 99 SET DISPLAY MODE, 67
ROLL OBJECT RIGHT, 99 SET EAX, 79
ROTATE CAMERA, 112 SET EMULATION OFF, 126
ROTATE IMAGE, 144 SET EMULATION ON, 126
ROTATE LIGHT, 117 SET GAMMA, 67
ROTATE LIMB, 103 SET GLOBAL COLLISION OFF, 101
ROTATE LISTENER, 79 SET GLOBAL COLLISION ON, 101
ROTATE OBJECT, 98 SET GRAPHICS CARD, 126
SET LIGHT RANGE, 116
S SET LIGHT TO OBJECT ORIENTATION, 117
SET LIGHT TO OBJECT POSITION, 117
SAVE ARRAY, 39 SET MATRIX, 121
SAVE BITMAP, 70
SET MATRIX HEIGHT, 122
SAVE IMAGE, 74
SET MATRIX NORMAL, 122
SAVE OBJECT ANIMATION, 94
SET MATRIX TEXTURE, 122
SAVE SOUND, 78
SET MATRIX TILE, 122
SAVE STATIC OBJECTS, 96 SET MATRIX WIREFRAME OFF, 123
SCALE LIMB, 103 SET MATRIX WIREFRAME ON, 123
SCALE LIMB TEXTURE, 104
SET MIPMAP MODE, 109
SCALE LISTENER, 144
SET NET CONNECTION, 138
SCALE OBJECT, 90
SET NORMALIZATION OFF, 109
SCALE OBJECT TEXTURE, 90
SET NORMALIZATION ON, 109
SCALE SPRITE, 72 SET OBJECT, 87
SCANCODE(), 42 SET OBJECT COLLISION OFF, 100
SCREEN DEPTH(), 68
SET OBJECT COLLISION ON, 100
SCREEN FPS(), 68
SET OBJECT COLLISION TO BOXES, 100
SCREEN HEIGHT(), 67
SET OBJECT COLLISION TO POLYGONS,
SCREEN INVALID(), 127
101
SCREEN TYPE(), 67 SET OBJECT COLLISION TO SPHERES, 100
SCREEN WIDTH(), 67 SET OBJECT FRAME, 90
SCROLL BACKDROP, 108
SET OBJECT INTERPOLATION, 90
SCROLL LIMB TEXTURE, 104
SET OBJECT KEYFRAME, 95
SCROLL OBJECT TEXTURE, 90
SET OBJECT ROTATION XYZ, 91
SELECT, 36
SET OBJECT ROTATION ZYX, 91
SEND NET MESSAGE BITMAP, 141 SET OBJECT SPEED, 90
SEND NET MESSAGE FLOAT, 141 SET OBJECT TEXTURE, 92
SEND NET MESSAGE IMAGE, 141
SET OBJECT TO CAMERA ORIENTATION,
SEND NET MESSAGE INTEGER, 140
100
SEND NET MESSAGE MEMBLOCK, 141
SET OBJECT TO OBJECT ORIENTATION, 99
SEND NET MESSAGE MESH, 142
SET POINT LIGHT, 116
SEND NET MESSAGE SOUND, 141 SET SOUND PAN, 78
SEND NET MESSAGE STRING, 141 SET SOUND SPEED, 78
SET AMBIENT LIGHT, 118
SET SOUND VOLUME, 78
SET CAMERA FOV, 113
SET SPOT LIGHT, 116
SET CAMERA RANGE, 112
SET SPRITE, 72
SET CAMERA ROTATION XYZ, 113
SET STATIC OBJECTS TEXTURE, 96
SET CAMERA ROTATION ZYX, 113 SET TEXT FONT, 63
SET CAMERA TO FOLLOW, 113 SET TEXT OPAQUE, 64
SET CAMERA TO OBJECT ORIENTATION,
SET TEXT SIZE, 63
115 SET TEXT TO BOLD, 64
161
SET TEXT TO BOLD ITALIC, 64 STOP MUSIC, 82
SET TEXT TO ITALIC, 64 STOP OBJECT, 89
SET TEXT TO NORMAL, 64 STOP RECORDING SOUND, 78
SET TEXT TRANSPARENT, 64 STOP SOUND, 77
SET WINDOW LAYOUT, 129 STR$(), 65
SET WINDOW OFF, 129 STRETCH SPRITE, 72
SET WINDOW ON, 129 SUSPEND FOR KEY, 37
SET WINDOW POSITION, 130 SUSPEND FOR MOUSE, 37
SET WINDOW SIZE, 130 SYNC, 38
SET WINDOW TITLE, 129 SYNC RATE, 38
SHIFT MATRIX DOWN, 123 SYSTEM DMEM AVAILABLE(), 131
SHIFT MATRIX LEFT, 123 SYSTEM SMEM AVAILABLE(), 131
SHIFT MATRIX RIGHT, 123 SYSTEM TMEM AVAILABLE(), 131
SHIFT MATRIX UP, 123
SHIFTKEY(), 42 T
SHOW ALL SPRITES, 73
SHOW LIGHT, 117 TAN(), 59
SHOW LIMB, 102 TEXT, 63
TEXT BACKGROUND TYPE(), 66
SHOW MOUSE, 42
TEXT FONT$(), 66
SHOW OBJECT, 89
TEXT HEIGHT(), 66
SHOW SPRITE, 73
TEXT SIZE(), 66
SHOW WINDOW, 128
SIN(), 59 TEXT STYLE(), 66
SIZE SPRITE, 72 TEXT WIDTH(), 66
TEXTURE BACKDROP, 108
SLEEP, 37
TEXTURE LIMB, 103
SOUND EXIST(), 79
TEXTURE OBJECT, 90
SOUND LOOPING(), 80
TIMER(), 40
SOUND PAUSED(), 80
SOUND PLAYING(), 80 TNL AVAILABLE(), 127
SOUND POSITION X(), 80 TOTAL OBJECT FRAMES(), 93
TURN CAMERA LEFT, 114
SOUND POSITION Y(), 80
TURN CAMERA RIGHT, 114
SOUND POSITION Z(), 80
TURN OBJECT LEFT, 99
SOUND TYPE(), 79
TURN OBJECT RIGHT, 99
SPACEKEY(), 42
SPRITE, 72
SPRITE COLLISION(), 76 U
SPRITE EXIST(), 75 UNDIM, 39
SPRITE FLIPPED(), 76 UNGLUE OBJECT FROM LIMB, 92
SPRITE HEIGHT(), 75 UNLOCK BACKBUFFER, 136
SPRITE HIT(), 76 UPDATE MATRIX, 123
SPRITE IMAGE(), 75 UPKEY(), 41
SPRITE MIRRORED(), 76 UPPER$(), 65
SPRITE OFFSET X(), 76
SPRITE OFFSET Y(), 76 V
SPRITE SCALE X(), 75
SPRITE SCALE Y(), 76 VAL(), 64
SPRITE WIDTH(), 75
SPRITE X(), 75 W
SPRITE Y(), 75 WAIT, 38
SQRT(), 58 WAIT KEY, 37, 145
STATIC LINE OF SIGHT X(), 107 WHILE ENDWHILE, 34
STATIC LINE OF SIGHT Y(), 107 WINDIR$(), 130
STATIC LINE OF SIGHT Z(), 107 WRAPVALUE(), 109
STATIC LINE OF SIGHT(), 107 WRITE BYTE, 54
STEP, 33 WRITE DIRBLOCK, 55
STOP ANIMATION, 84 WRITE FILE, 54
162
WRITE FILEBLOCK, 55 X
WRITE FLOAT, 54
XROTATE CAMERA, 112
WRITE LONG, 54
XROTATE OBJECT, 98
WRITE MEMBLOCK, 55
WRITE MEMBLOCK BYTE, 132
WRITE MEMBLOCK DWORD, 132 Y
WRITE MEMBLOCK FLOAT, 133 YROTATE CAMERA, 112
WRITE MEMBLOCK WORD, 132 YROTATE OBJECT, 98
WRITE STRING, 54
WRITE TO CLIPBOARD, 55 Z
WRITE TO REGISTRY, 57
WRITE WORD, 54 ZROTATE CAMERA, 112
ZROTATE OBJECT, 98
163