Nava2
2008-08-18 17:27:15
Use Bobarkinators Object finding, unless you do want to still kick it oldschool kinda with this.
Okay, this works great, but its not perfect. Also, it uses colors not UID's (h)
Feel free to use, just credit.
Okay, this works great, but its not perfect. Also, it uses colors not UID's (h)
{*******************************************************************************
function FindObjREF(var x, y: integer; TileX, TileY, TileH, Color, Length, Height, PointRef, Tol: integer; UpText: TStringArray): boolean;
By Nava2
Description: Finds an object using reflection for accuracy. Length and Height
are of the object, and the PointRef is for the area around the MSTile Point to search around.
*******************************************************************************}
function FindObjREF(var x, y: integer; TileX, TileY, TileH, Color, Length, Height, PointRef, Tol: integer; UpText: TStringArray): boolean;
var
I, H, CTS : integer;
P : TPoint;
Pts : TPointArray;
PtsA : T2DPointArray;
begin
P := Point(TileX, TileY);
if (DistanceFrom(P) > 5) then
begin
if not TileOnMM(P) then
begin
Writeln('Could not find object, exiting.');
Exit;
end;
WalkToTile(P, 0, 0);
R_FFlag(1);
Wait(75 + random(50));
end;
P := TileToMS(P, TileH);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(P.x, P.y, Pts, Color, P.x - PointRef, P.y - PointRef, P.x + PointRef, P.y + PointRef, tol);
Writeln(IntToStr(GetArrayLength(Pts)));
PtsA := SplitTPAEx(Pts, Length, Height);
H := High(PtsA);
for I := 0 to H do
begin
P := MiddleTPA(PtsA[I]);
MMouse(P.x, P.y, 4, 4);
Wait(90 + Random(50));
if IsUpTextMultiCustom(UpText) then
begin
Result := true;
break;
end;
end;
if Result then
GetMousePos(x, y)
else
Writeln('Did not find object.');
ColorToleranceSpeed(CTS);
end;Feel free to use, just credit.