Yeah, I was running it at Lumby. You have it right, and what I mean by it couldn't attack the chickens from there is that when it clicked to attack a chicken it automatically just walked next to the fence and stood there mirroring the chicken. I think this occurred because in the time it took to walk over to the west, somebody closed the gate (otherwise it should have automatically walked to the chicken around the pen, right?).
My suggestion for a fix: When you click to walk to a chicken, use GetFlag(Tile : TPoint): boolean which returns true if a flag is present and also stores the flag's tile in Tile (Not sure if I got that completely right, check it out in the include). Then check if Tile is in the chicken pen; if not, automatically recalibrate to the pen by going to the center tile or something. Nice script though (<3 the form) ;)
EDIT: Another bug. After going through all my 6 players once -
Your NextTruePlayer function
SCAR Code:
function NextTruePlayer: Integer;
var
i : integer;
begin
if AllPlayersInactive then
begin
Writeln('All Players are false!');
Proggy;
TerminateScript;
end;
i := CurrentPlayer + 1;
while Players[i].Active = False do
begin
if i = High(Players) then
i := 0 else
Inc(i);
end;
Result := i;
end;
That won't work because as soon as it gets to the end of the player array it will continue to add on, causing an out of range. What you need to do is
SCAR Code:
function NextTruePlayer: Integer;
var
i : integer;
begin
if AllPlayersInactive then
begin
Writeln('All Players are false!');
Proggy;
TerminateScript;
end;
if CurrentPlayer < HowManyPlayers - 1 then
i := CurrentPlayer + 1
else
i := 0;
while Players[i].Active = False do
begin
if i = High(Players) then
i := 0 else
Inc(i);
end;
Result := i;
end;
;)