I think the problem is the line is meant to be:
If damage is = 0 then
If damage = 0 then
The only if ... thens where there aren't any is are bump barrier and value. There may be others to.
What I use though is:
;This is far 5 because I use gosub far #scan,
;and scan is 0-5, depending on what the last
;thing you scanned was. e.g. 2=enemy, 5=flag.
if damage is < 1 then discharge energy
long range scan
goto far #scan
;This is goto so that the programme is faster.
;Trust me, it works
It is fairly short and simple, but it works for me. You have to gosub to it though.
If you want any other help at all with anything, then just e-mail me at email@example.com