TYPE

TYPE is a CAOS command used to find the type of a token.

Usage
Syntax: TYPE something

Returns an integer from the following list depending on what something is.
 * 0: integer
 * 1: floating point
 * 2: string
 * 3: simple agent
 * 4: pointer
 * 5: compound agent
 * 6: vehicle
 * 7: creature
 * -1: NULL agent pointer
 * -2: unknown agent - signifies an internal error

Examples
This is an obvious 'print anything' command. It prints va00. DOIF TYPE va00 eq 0 or TYPE va00 eq 1 OUTV va00 ELIF TYPE va00 eq 2 OUTS va00 ELIF TYPE va00 ge 3 and TYPE va00 le 7 DOIF TYPE va00 eq 3 OUTS "Simple" ELIF TYPE va00 eq 4 OUTS "Pointer" ELIF TYPE va00 eq 5 OUTS "Compound" ELIF TYPE va00 eq 6 OUTS "Vehicle" ELIF TYPE va00 eq 7 OUTS "Creature" ENDI TARG va00 OUTS " agent, class number " OUTV FMLY OUTS " " OUTV GNUS OUTS " " OUTV SPCS OUTS ", current id " OUTV UNID ELIF TYPE va00 eq -1 OUTS "NULL agent" ELSE OUTS "ERROR" ENDI

Bugs
Attempting to check the TYPE of a NAME variable named an empty string ("") will return '0' but will render the agent unable to access NAME variables via NAMN. (Variables can still be accessed directly) outv type name "" Because of this, be cautious when using TYPE in conjunction with NAMN to check the types of NAME variables, since NAMN will return an empty string at when there are no more variables, triggering the bug if it is then TYPE checked. namn va00 outv type name va00 namn va00 doif va00 ne "" outv type name va00 endi GAME and EAME variables are not susceptible to this bug, as the engine will throw an error if a script tries to access an empty-string variable.
 * this line breaks the targ agent so NAMN no longer is able to find NAME variables on the agent
 * do not do this, because if va00 is an empty string, it will break the agent
 * do this instead