As far as other things to avoid if writing T2 scripts? There are a handful of real interpreter bugs.
Beware when using binary operators, because some are broken:
%a = ~0;
%b = -1;
echo(%a);
echo(%b);
echo(%a == %b);
This will print: -1, -1, 0. The two -1's are not equal for some reason.
Any arithmetic operator involving values greater than 10^6 run in floating point, even if you only want integers. Not strictly a bug, but it's not really desirable behavior.
Performing a modulo operator with a zero divisor will crash the game.
echo(5 % 0);
If evaluating expressions with local variables, you need to perform some sort of dummy operation using the local variables for them to register.
The following code will lose the value of %x in the context of the eval() call (e.g. if you have equation = "%x * %x", and x = 2, this will return 0).
function evalEquation(%equation, %x)
{
eval("%ret=" @ %equation @ ";");
return %ret;
}
Whereas this will work correctly (and for the example would properly return 4):
function evalFunction(%equation, %x)
{
%x = %x; // dummy operation, required
eval("%ret=" @ %equation @ ";");
return %ret;
}