weequ
2011-12-06 17:06:59
I fixed Flag Finding and and made FindFlag function. FindFlag is necessary because finding flag isn't just one line of code anymore. Made all the functions in Flag.scar to use FindFlag.
program FlagTest;
{.include SRl\SRL.scar}
function FindFlag(var X, Y: Integer): Boolean;
var
I: Integer;
TPA: TPointArray;
begin
Freeze;
FindColors(TPA, 65536, MMX1, MMY1, MMX2, MMY2);
for I := 0 to High(TPA) do
begin
if (GetColor(TPA[I].X-1, TPA[I].Y-1) - GetColor(TPA[I].X, TPA[I].Y-1) = 6381921) then
begin
Unfreeze;
X := TPA[I].x;
Y := TPA[I].y;
Result := True;
Exit;
end;
end;
UnFreeze;
Result := False;
end;
function FlagPresent2: Boolean;
var
X, Y: Integer;
begin
Result := FindFlag(X, Y);
end;
function FlagDistance2: Integer;
var
X, Y: Integer;
begin
Result := -1;
if (FindFlag(X, Y)) then
Result := Distance(MMCX, MMCY, X, Y);
end;
function FlagEx2(Dist: Integer; RoadColorCheck: Boolean): Boolean;
var
Tx, Ty, M, D1, D2: Integer;
begin
Result := False;
M := GetSystemTime;
while (FindFlag(Tx, Ty)) do
begin
wait(50);
D1 := Distance(Tx, Ty, MMCX, MMCY);
if (D1 <= Dist) then
begin
Result := True;
Exit;
end;
if (RoadColorCheck) then
RoadColorChecker;
Wait(100);
if (GetColor(6, 6) <> clWhite) then
if (GetSystemTime - M > 5000) then
begin
if (D1 = D2) then Exit;
D2 := D1;
M := GetSystemTime;
end;
if (Random(20) = 0) then IdleTime(500, 1000, 0.01);
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
end;
Wait(RandomRange(200, 400));
end;
begin
if FlagPresent2 then WriteLn('Flag found');
end.