Awkwardsaw
2009-08-10 04:46:18
this thread is just to post my personally fave object finding procedure(made by me of course)
go ahead and post yours up here, if you have one :p i know i should add atpas, but imo for current use, this works just fine as it is
procedure A_Debug(text: string); //posted because its used in A_FindObj
begin
writeln('[' + thetime + ']' + ' Error Occured at: ' + text + '.');
alert('[' + thetime + ']' + ' Error Occured at: ' + text + '.');
end;
function A_FindObj(color, tol : integer; uptext : string; left : boolean): boolean;
var
T : tpointarray;
i, x, y, d: integer;
time : integer;
begin
result:= true;
d:= 0;
if not loggedin then loginplayer;
ColorToleranceSpeed(3);
time := 0;
marktime(time);
while not FindColorsSpiralTolerance(MSCX, MSCY, T, color, MSX1, MSY1, MSX2, MSY2, tol) do
begin
FindColorsSpiralTolerance(MSCX, MSCY, T, color, MSX1, MSY1, MSX2, MSY2, tol);
if time > 5000 then break;
end;
ColorToleranceSpeed(1);
if Length(T) = 0 then
begin
A_Debug('color not found');
result:= false;
exit;
end;
for i:= 0 to high(t) do
begin
mmouse(T[i].X, T[i].Y, 0, 0);
if isuptext(uptext) then
begin
getmousepos(x, y);
mouse(x, y, 0, 0, left);
wait(100 + random(2000));
end;
end;
if not result then
begin
A_Debug('Something has gone wrong');
players[currentplayer].active := false;
end;
end;go ahead and post yours up here, if you have one :p i know i should add atpas, but imo for current use, this works just fine as it is