Wizzup?
2007-06-19 03:03:15
This is a quick example I just made, which uses my FindArrayColorsSpiralTolerance, it searches for bots colors, blue wizard, rune and aubury colors, then hovers mouse towards those points, if it finds an aubury uptext, then it choose the option talk to, so you won't be teleported…. ;)
program New;
{.include SRL/SRL.scar}
Function NearbyPointInArray(P: TPoint; Dist:Integer; a: TPointArray): Boolean;
Var
I: Integer;
Begin
For I := 0 To GetArrayLength(a) - 1 Do
If (Abs(P.x - a[i].x) <= Dist) And (Abs(P.y - a[i].y) <= Dist) Then
Begin
Result := True;
Exit;
End;
End;
Function RearrangeAndShortenArray(a: TPointArray; SortDist: Integer): TPointArray;
Var
I: Integer;
Begin
For I := 0 To GetArrayLength(a) - 1 Do
If Not NearbyPointInArray(a[I], SortDist, Result) Then
Begin
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[GetArrayLength(Result) - 1] := a[I];
End;
End;
Procedure FindArrayColorsSpiralTolerance(x, y: Integer; Var TPA: TPointArray;
ColorsA: TIntegerArray; x1, y1, x2, y2: Integer; ToleranceArray: TIntegerArray);
Var
I, Count, C, E, L: Integer;
TPAArray: Array Of TPointArray;
Begin
If GetArrayLength(ToleranceArray) <> GetArrayLength(ColorsA) Then
Exit;
If (GetArrayLength(ToleranceArray) = 0) Or (GetArrayLength(ColorsA) = 0) THen
Exit;
SetArrayLength(TPAArray, GetArraylength(ColorsA));
For I:= 0 To GetArrayLength(ColorsA) - 1 Do
Begin
FindColorsSpiralTolerance(x, y, TPAArray[I], ColorsA[I], x1, y1, x2, y2, ToleranceArray[I]);
Count := Count + GetArrayLength(TPAArray[I]);
End;
TPA := TPAArray[0];
SetArrayLength(TPA, Count);
E := 0;
For I := 0 To GetArrayLength(TPAArray) - 1 Do
Begin
L := GetArrayLength(TPAArray[I]);
For C := 0 To L - 1 Do
TPA[E + C] := TPAArray[I][C];
E := E + L;
End;
End;
{
Aubury Color: 3129339;
Runite : 8681050;
Bot head: 7576522;
Bot legs: 3693856;
Blue mage robe: 6964745
}
Function FindAuburyBusy: Boolean;
Var
tempTPA ,Points: TPointArray;
I, C: Integer;
Begin
ColorToleranceSpeed(1);
FindArrayColorsSpiralTolerance(MSCX, MSCY, tempTPA, [3129339, 8681050,
7576522, 3693856, 6964745], MSX1 + 50, MSY1 + 50, MSX2 - 50,
MSY2 - 50, [14, 19, 14, 14, 14]);
Points := ReArrangeAndShortenArray(tempTPA, 30);
For I := 0 To GetArrayLength(Points) - 1 Do
Begin
FindColorsTolerance(tempTPA, GetColor(Points[I].X, Points[I].Y),
Points[I].X - 20, Points[I].Y - 10,
Points[i].X + 20, Points[I].Y + 40, 14);
If GetArrayLength(tempTPA) <> 0 Then
Begin
WriteLn('Color found ' + IntToStr(GetColor(Points[I].X, Points[I].Y)));
x := 0;
y := 0;
For C := 0 To GetArrayLength(tempTPA) - 1 Do
Begin
x := x + tempTPA[C].X;
y := y + tempTPA[C].Y;
End;
x := x Div GetArrayLength(tempTPA);
y := y Div GetArrayLength(tempTPA);
MMouse(x, y, 0, 0);
Wait(100);
If IsUpText('bury') Then
Begin
Mouse(x, y, 0, 0, False);
If ChooseOption(x, y, 'Talk') Then
Exit;
End;
End;
End;
End;
begin
SetupSRL;
FindAuburyBusy;
end.