SRL Archive - SRL Archives

findObjFast


munk

2007-11-20 23:22:29

This is a mod of a ladderfinder in my guildminer. Im just kinda interested to see what everyone thinks of it and hopefully get some improvements so I can use them:)


function findObjFast(var rx,ry:integer;uTs:Array of string;col,x1,y1,x2,y2,tol,cts:integer):boolean;
var
i,rad,mx,my,cx,cy:integer;
p:Array of Tpoint;
pp:Array of Array of Tpoint;
begin
colortolerancespeed(cts);
FindColorsSpiralTolerance(mscx,mscy,p,col,x1,y1,x2,y2,tol);
colortolerancespeed(1);
pp:=TPAtoATPAEx(p,50,50);
SortATPASize(pp,true);
if length(pp)>0 then
begin
middleTPAex(pp[0],cx,cy);
rad:=random(90);
for i:=0 to 25 do
begin
mx:=round((i*3)*sine(rad))+cx;
my:=round(-(i*3)*cose(rad))+cy;
mmouse(mx,my,2,2);
if isUptextMultiCustom(uTs) then
begin
getMousePos(mx,my);
rx:=mx;
ry:=my;
result:=true;
exit;
end;
rad:=rad+20;
end;
end;
writeln('Object not found!');
result:=false;
end;

it basically finds the highest concentration of the color, then draws a radial outwards with the mouse while checking for the TstringArray as upText. It works pretty good for doors, ladders, and I even started using it for bank finding. Please post some feedback!

HyperSecret

2007-11-21 00:43:26

i like the radians idea, looks close to mine in my lumberjack script

n3ss3s

2007-11-23 09:37:54

Looks good, but two things -

a) Maybe return the ColorToleranceSpeed back to original?
b) Params for the TPAToATPA's Width and Height

Gj, keep it up