3Garrett3
2010-08-22 17:36:10
So I just made this, and it was suggested that it could be added to MSI if it was working, then I thought it might be useful for people to use in SRL. Lots of people have problems using TPAs to walk, and this is a pretty good method with lots of options.
There are way too many options, but I expect it can be shortened however the Devs might like to. This is just the large version, it could be modified any way.
There are way too many options, but I expect it can be shortened however the Devs might like to. This is just the large version, it could be modified any way.
Function WalkTPAEx(C1, XMod, YMod, Tolerance, ColTolS, SplitMethod, SortMethod,
StartRadial, EndRadial, MinRadius, MaxRadius : Integer; HueMod, SatMod : Extended;
Filter : Boolean; SortPoint : TPoint; Dist : TIntegerArray) : Boolean;
Var
TPA: TPointArray;
TDPA: T2DPointArray;
I, H, X, Y, CTS: Integer;
Begin
If Not LoggedIn Then Exit;
cts := GetColorToleranceSpeed;
if ColTolS = 2 then
SetColorspeed2Modifiers(HueMod, SatMod);
ColorToleranceSpeed(ColTolS);
FindColorsTolerance(TPA, C1, MMX1, MMY1, MMX2, MMY2, Tolerance);
Writeln('Found colour, length of array = ' + IntToStr(Length(TPA)));
If Length(TPA) = 0 Then
begin
Writeln('Didn''t find the colour, quitting walktpa');
Exit;
end;
if Filter then
FilterPointsPie(TPA, StartRadial, EndRadial, MinRadius, MaxRadius, MMCx, MMCy);
Case SplitMethod of
1:
TDPA := TPAToATPA(TPA, Dist[0]);
2:
TDPA := TPAToATPAEx(TPA, Dist[0], Dist[1]);
3:
TDPA := SplitTPA(TPA, Dist[0]);
4:
TDPA := SplitTPAEx(TPA, Dist[0], Dist[1]);
end;
Case SortMethod of
1:
SortATPAFromFirstPoint(TDPA, SortPoint);
2:
SortATPASize(TDPA, True);
3:
SortATPASize(TDPA, False);
end;
Wait(10);
try
DebugATPABounds(TDPA);
except end;
H := High(TDPA);
For i := 0 To H Do
Begin
MiddleTPAEx(TDPA[i], x, y);
If rs_OnMinimap(x,y) Then
Begin
Mouse(x , y , 2, 2, True);
Wait(RandomRange(200,300));
FFlag(0);
Result := True;
Wait(200 + Random(80));
Exit;
End;
End;
Result := False;
End;