Integers

An integer is a 32-bit signed value in the range from -2,147,483,648 to 2,147,483,647. Literal values may be specified in binary, octal, decimal, or hexadecimal format:


10b         // binary for 2
10o         // octal for 8
10h or 10x  // hexadecimal for 16
10          // decimal for, yep, 10

Hexadecimal numbers which begin with letters, such as FF00h for exaple, must be preceeded with a leading zero (0FF00h) so the compiler can distinguish them from identifiers.

The underscore symbol (_) can by used to separate digits for easier readablility.


5_000_000             // five-million
0110_0100_0101_0100b  // 16-bit binary number

Strings

Strings are lines of text spoken by objects or printed with the print-statement. When a literal string is encountered in an expression, an integer value is returned which is its index into the game's string table. This makes it possible to assign strings to variables.


int s = "I'm saving this string for later."
print(s);
There are a few escape codes allowed in strings, each beginning with the backslash symbol. Escape codes are case-sensitive.

Code Description
\' Single-quote
\" Double-quote
\. Continues the string at the first non-whitespace character on the next line. (Otherwise, strings are not allowed to span multiple lines.)
\s Space. All adjacent whitespace in a string is reduced to a single space character. This code is used to force whitespace.
\r Carriage-return
\n New-line
\t Tab
\\ Backslash

If two or more literal strings match exactly, they may share same the index in the string table.

See Also...

Characters

Literal characters are enclosed in a pair of single-quotes. They are evaluated as integers, so they are compatible with any expression.


'A'  // letter A
'1'  // digit 1
'%'  // percent-sign
' '  // space
'\'' // single-quote

Characters allow all the same escape codes as strings.

Floating-point values

Numbers that contain a decimal point, or end with a decimal point, are taken as floating-point values. The first character must be a digit, though.

Floating-point values are not compatible with the the standard AGAST operators, because the operators expect integer operands, so functions that expect floating-point values must be used instead.


var a;                 
a = 0.5;               // OK: assignment always works
a = a + 1.0;           // Error: 1.0 is floating-point
a = FloatAdd(a, 1);    // Error: 1 is an integer
a = FloatAdd(a, 1.0);            // OK
a = FloatAdd(a, intToFloat(1));  // OK
See Also...