Avaphi
2007-02-16 13:17:11
Hey there guys, I just decided to make another FindObj function… But I modeled this to how RadialRoadWalk works, so it will scan in a circular motion just like RRW, except from the middle out, finding the object nearest you. Hope it gets implemented :) Here it is :
Function RadialFindObj(var Obx, Oby : integer; Text : string; Color, Tolerance : integer): boolean;
var MinRadius, MaxRadius, SRadial, ERadial, i, Tempx, Tempy : integer;
begin
SRadial := 0;
ERadial := 360;
MinRadius := 15;
MaxRadius := 175;
BenMouse := True;
begin
repeat
for i := SRadial to ERadial do
begin
Tempx := Round(MinRadius * Sine(i)) + MSCX;
Tempy := Round(-MinRadius * Cose(i)) + MSCY;
if (FindColorTolerance(x, y, Color, Tempx, Tempy, Tempx+1, Tempy+1, Tolerance)) then
begin
Obx := x;
Oby := y;
MMouse(Obx, Oby, 0, 0);
if (IsUpText(Text)) then
begin
Result := True;
Exit;
end;
end;
end;
MinRadius := MinRadius + 5;
until (MinRadius >= MaxRadius);
end;
end;