Blumblebee
2009-08-31 10:22:36
Well I figured it would help to make TPA walking more readily available for the average person, so here it is.
there is a little extra at the end there that isnt really needed but I figured a Rs_OnMiniMap check might be a useful thing, however it can be removed to optimize speed.
Used as so:
Function GetMMPoints(x, y, color, width, height, tolerance: Integer): TpointArray;
var tpa: TpointArray; atpa: T2DpointArray; l, i, p: Integer;
begin
FindColorsSpiralTolerance(x, y, tpa, color, MMx1, MMy1, MMx2, MMy2, tolerance);
Atpa := TPAtoATPAEx(Tpa, width, height);
for i := 0 to High(atpa) do
begin
if Length(atpa) > 5 then
begin
l := getarraylength(Result);
SetArrayLength(Result, l+1);
Result[l] := MiddleTpa(atpa[i]);
end;
end;
if Length(result) = 0 then Exit;
for i := 0 to High(Result) do
if rs_OnMiniMap(result[i].x, result[i].y) then Inc(p);
if p = 0 then SetArrayLength(Result, 0);
end;there is a little extra at the end there that isnt really needed but I figured a Rs_OnMiniMap check might be a useful thing, however it can be removed to optimize speed.
Used as so:
Function WalkExample: Boolean;
var TPA: TPointArray; I: Integer;
begin
TPA := GetMMPoints(MMcx, MMcy, 14630407, 1, 1, 35);
if Length(TPA) <= 0 then Exit;
for i := 0 to High(TPA) do
begin
if not rs_OnMiniMap(tpa[i].x, tpa[i].y) then Continue; // useless check if rs_OnMiniMap stays in the function
Mouse(tpa[i].x+xmod, tpa[i].y+ymod, 5, 5, True);
if FlagPresent then
begin
Result := FFlag(10);
Exit;
end;
end;
end;