n3ss3s
2008-01-26 17:09:27
From now on, I will post my functions only here, and functions less "significant" will only be edited instead of getting their own post.
To start…:
and something I had this nice idea of using in a rock finder:
The idea was to take a TPA of the mud, then the bounds of the mud tpa, and "grab the tpa there" and get the percent of the ore in the mud.
and this one is a radialwalk kind of for walking in port sarim, though the two colors have to be picked manually since I don't have an autocolor and I'm really not in the mood for making over 0.4 speed2mods.
Iron finder that finds all irons (new rocks) on the mainscreen, needs only 3 Tol, maybe even less since it uses the Hue and Sat mods, which aren't very big either.
To start…:
Function FindWhirlPool(x1, y1, x2, y2: Integer): Boolean;
Var
CTS, X, Y, L, C, I, WM: Integer;
wPools: Array of TPointArray;
wPts: TPointArray;
TB: TBox;
Begin
If Not LoggedIn Then Exit;
CTS := GetColorToleranceSpeed;
If Not CTS = 2 Then ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, wPts, 14935266, x1, y1, x2, y2, 15);
wPools := SplitTPA(wPts, 1);
L := High(wPools);
SetArrayLength(wPts, 0);
For I := 0 To L Do
If GetArrayLength(wPools[i]) >= 20 Then
Begin
SetArrayLength(wPts, GetArrayLength(wPools[i]));
wPts := wPools[i];
Result := True;
Break;
End;
If Result Then
Begin
MouseFindFlag(MMCX, MMCY, 1, 1);
Writeln('*** FOUND WHIRLPOOL ***');
FFlag(0);
TB := BoxFromTPA(wPts);
MiddleTPAEx(wPts, X, Y);
C := GetColor(X, Y);
WM := GetSystemTime;
While FindColorTolerance(X, Y, C, TB.x1, TB.y1, TB.x2, TB.y2, 5) Do
If GetSystemTime - WM > 12000 + Random(1000) Then
Break;
End;
ColorToleranceSpeed(CTS);
End;
and something I had this nice idea of using in a rock finder:
Function GrabTPA(TPA: TPointArray; x1, y1, x2, y2: Integer): TPointArray;
Var
I, Z, L: Integer;
B: TBox;
Begin
L := High(TPA);
B := IntToBox(x1, y1, x2, y2);
SetArrayLength(Result, GetArrayLength(TPA));
For I := 0 To L Do
If PointInBox(TPA[i], B) Then
Begin
Result[i] := TPA[i];
Z := Z + 1;
End;
SetArrayLength(Result, Z);
End;
The idea was to take a TPA of the mud, then the bounds of the mud tpa, and "grab the tpa there" and get the percent of the ore in the mud.
Function GetPlayers: Integer;
Var
TPAA: Array of TPointArray;
TPA: TPointArray;
I, CTS: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsTolerance(TPA, 16711422, MMCX - 35, MMCY - 35, MMCX + 35, MMCY + 35, 5);
TPAA := TPAToATPAEx(TPA, 4, 4);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) >= 10 Then
Result := Result + 1;
ColorToleranceSpeed(CTS);
End;
Function RadialTPAWalk(Color: Integer; MinPix, SR, ER, MinD, MaxD, M: Integer): Boolean;
Var
TPAA: Array of TPointArray;
X, Y, Z, I, S, E: Integer;
TPA: TPointArray;
Begin
FindColorsSpiralTolerance(MMCX, MMCY, TPA, Color, MMX1, MMY1, MMX2, MMY2, 0);
FilterPointsPie(TPA, 0, 359, MinD, MaxD, MMCX, MMCY);
TPAA := TPAToATPA(TPA, Round(Sqrt(MinPix)));
S := SR + Round(Rs_GetCompassAngleDegrees);
E := ER + Round(Rs_GetCompassAngleDegrees);
If S > 360 Then S := S - 315;
If E > 360 Then E := E - 315;
For I := High(TPAA) DownTo 0 Do
Begin
MiddleTPAEx(TPAA[i], X, Y);
If M <> 1 Then
Begin
Z := Round(Degrees(ArcTan2(MMCY - Y, MMCX - X))) - 90;
If Z < 0 Then
Z := Z + 360;
End Else
Z := Round(Degrees(ArcTan2(MMCY - Y, MMCX - X))) - 90;
If Z > SR Then
If Z < ER Then
Begin
MouseFindFlag(X, Y, 1, 1);
Flag;
Result := True;
Exit;
End;
End;
End;
Function HarborWalk(SD, ED: Integer): Boolean;
Var
S, E, L, I, CTS, Z: Integer;
TPAA: Array of TPointArray;
t1, t2, TPA: TPointArray;
Begin
If Not LoggedIn Then Exit;
CTS := GetColorTolerancespeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MMCX, MMCY, t1, 2049872, MMX1, MMY1, MMX2, MMY2, 5);
FindColorsSpiralTolerance(MMCX, MMCY, t2, 2248798, MMX1, MMY1, MMX2, MMY2, 5);
TPA := CombineTPA(t1, t2);
S := SD { + Round(Rs_GetCompassAngleDegrees)};
E := ED {+ Round(Rs_GetCompassAngleDegrees)};
TPAA := TPAToATPA(TPA, 10);
L := High(TPAA);
SetArrayLength(TPA, 0);
For I := 0 To L Do
If GetArrayLength(TPAA[i]) >= 20 Then
Begin
SetArrayLength(TPA, GetArrayLength(TPA) + 1);
TPA[High(TPA)] := MiddleTPA(TPAA[i]);
End;
// SortTPAFrom(TPA, IntToPoint(MMCX, MMCY));
L := High(TPA);
For I := 0 To L Do
If Distance(TPA[i].x, TPA[i].y, MMCX, MMCY) >= 35 Then
Begin
Try
Z := Round(Degrees(ArcTan2(MMCY - TPA[i].y, MMCX - TPA[i].x))) - 90;
If Z < 0 Then
Z := Z + 360;
Except
Continue;
End;
If Z < E Then
If Z > S Then
Begin
Mouse(TPA[i].x, TPA[i].y, 1, 1, True);
Flag;
Result := True;
Break;
End;
End;
ColorToleranceSpeed(CTS);
End;
and this one is a radialwalk kind of for walking in port sarim, though the two colors have to be picked manually since I don't have an autocolor and I'm really not in the mood for making over 0.4 speed2mods.
Function FindIrons: TPointArray;
Var
TPAA: Array of TPointArray;
TPA: TPointArray;
CTS, I: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.22, 0.23);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2964577, 20, 20, MSX2 - 20, MSY2 - 20, 3);
TPAA := TPAToATPAEx(TPA, 20, 19);
For I := 0 To High(TPAA) Do
If GetArrayLength(TPAA[i]) > 7 Then
Begin
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[High(Result)] := MiddleTPA(TPAA[i]);
End;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(2);
End;Iron finder that finds all irons (new rocks) on the mainscreen, needs only 3 Tol, maybe even less since it uses the Hue and Sat mods, which aren't very big either.
^^ the spammer(not really, kinda though :p) got 0wned :D