pwnaz0r
2007-10-21 16:09:44
Well, I made this function for my newest script. I hated having to mess with MFNF, etc because they don't really solve the problem if the flag is not on Minimap. Thus, I made this. Basically, it will wait a maximum of 7 seconds (b/c if they are walking) to wait for flag, but will break out of this is the flag is found. then it will wait until you get to the flag. i also made it so if you character gets stuck, like if the flag stays in the same postition the whole time, it will click on the flag again if possible.
function InMiniMap(ax, ay: integer): boolean;
begin
result:= ((ax >= MMX1) and (ax <= MMX2) and (ay >= MMY1) and (ay <= MMY2));
end;
function MouseWaitFF(ax, ay, rx, ry: integer): boolean;
var
FMark, cx, cy, lx, ly, i: integer;
begin
Flag; // <-- To Stop current Flag.
wait(200+ random(150));
if not InMiniMap(ax, ay) then
begin
Writeln('Point not in MiniMap');
exit;
end;
Mouse(ax, ay, rx, ry, true);
lx:= 0;
ly:= 0;
MarkTime(FMark);
repeat
wait(10);
until((FlagPresent) or (TimeFromMark(FMark) >= 7000));
if not (FlagPresent) then
begin
Writeln('Error finding flag');
exit;
end else
Writeln('Flag Found!');
for i:= 0 to (FlagDistance * 2) do
begin
inc(i);
wait(50);
if not FindColor(cx, cy, 255, MMX1, MMY1, MMX2, MMY2) then break;
if ((i mod 10) = 0)then
begin
if (lx = cx) or (ly = cy) then
begin
Writeln('Flag has stopped');
if FindColor(lx, ly, 255, MMX1, MMY1, MMX2, MMY2) then
MouseWaitFF(lx, ly, rx, ry);
end else
begin
lx:= cx;
ly:= cy;
end;
end;
end;
result:= true;
end;