Using the Perimeter-Scan Formula
Data:
This kind of line is almost always preceded by a perimeter-scan
formula
There are three parts to this line:
-
if value ~v2 < 3
The value of v2 will be less than 3 when an enemy
is directly next to Torque
-
if value #enemy_x <> 0
If the enemy is cloaked, then the information
gathered by the perimeter-scan formula will be wrong. The value of #enemy_x
in this situation is 0, so this check means that the condition is false.
Normally this just stops Torque from discharging energy unnecessarily.
-
if value ~v9 = ~v9
OK, so this probably looks a bit wierd at first
sight! The reason for its inclusion is as follows: When AI Wars is in the
process of being updated, there are lots of beta versions, and aspects
of the game change. In this case, the introduction of cloaking meant that
there had to be a decision on whether a cloaked enemy's coordinates would
be 0 or whether the coordinates would be those of the next-closest enemy.
While this was still being decided, Shea put this statement in so that
if necessary, he could add a statement to this line using a simple copy
and replace. If no extra statements were needed, then this code doesn't
affect the operation of Torque in any way, so it just gets left in.
If all these conditions are met, then it means that there is probably
an enemy next to Torque, so the 'Goto 2' statement jumps to a routine for
zapping it with energy discharges.