Procedure IsFlag;
Begin
If IsMoving Then
Writeln('Walking to Portal.');
If FlagPresent = (True) Then
Begin
Writeln('Found flag');
Repeat
Writeln(FlagDistance);
Until FFlag(0) or FlagPresent = (False);
Writeln('Flag is present must be moving')
//Antiban;
End Else
Writeln('Flag is not present, not moving');
End;


Here is the Debug

Flag is not present, not moving
Flag is not present, not moving
Found flag
64
-1
-1
-1
-1
-1
Successfully executed.

FlagDistance always returns -1 why?