n3ss3s
10-13-2007, 07:50 PM
Yeah, SRL was down about half an hour (?), and I was bored since I wasnt able to view threads, so I made two finding functions.
1. FastFindAnvil - Finds anvil in ~78 milliseconds.
2. FastFindVarrockFountain - Finds fountain in ~30 milliseconds.
Anvil finder is good for smithing scripts and fountain one for clay softeners etc.
Both pretty simple, both work even better.
Function FastFindAnvil(Var Ax, Ay: Integer): Boolean;
Var
TPA, TPA2: TPointArray;
Var
I, CTS, M: Integer;
Var
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
M := GetSystemTime;
FindColorsTolerance(TPA2, 5987683, MSX1, MSY1, MSX2, MSY2, 10);
For I := 0 To GetArrayLength(TPA2) - 1 Do
Begin
TP := TPA2[i];
FindColorsTolerance(TPA, 5987683, TP.x - 15, TP.y - 15, TP.x + 15, TP.y + 15, 10);
If(GetArrayLength(TPA) >= 20)Then
Begin
TP := MiddleTPA(TPA);
Result := True;
Ax := TP.x;
Ay := TP.y;
Break;
End;
End;
ColorToleranceSpeed(CTS);
Writeln('Found anvil in '+IntToStr(GetSystemTime - M));
End;
End;
Function FastFindVarrockFountain(Var Fx, Fy: Integer): Boolean;
Var
X, Y, I, C, CTS, M: Integer;
Var
TPA: TPointArray;
Var
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
M := GetSystemTime;
FindColorTolerance(X, Y, 9405792, MSX1, MSY1, MSX2, MSY2, 10);
FindColorsTolerance(TPA, 9405792, X - 20, Y - 20, X + 20, Y + 20, 10);
If(Not(GetArrayLength(TPA) >= 100))Then Exit;
Begin
TP := MiddleTPA(TPA);
Fx := TP.x;
Fy := TP.y;
Result := True;
End;
ColorToleranceSpeed(CTS);
Writeln('Found fountain in '+IntToStr(GetSystemTime - M));
End;
End;
Enjoy ;)
You are free to use them, but only if you credit me.
1. FastFindAnvil - Finds anvil in ~78 milliseconds.
2. FastFindVarrockFountain - Finds fountain in ~30 milliseconds.
Anvil finder is good for smithing scripts and fountain one for clay softeners etc.
Both pretty simple, both work even better.
Function FastFindAnvil(Var Ax, Ay: Integer): Boolean;
Var
TPA, TPA2: TPointArray;
Var
I, CTS, M: Integer;
Var
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
M := GetSystemTime;
FindColorsTolerance(TPA2, 5987683, MSX1, MSY1, MSX2, MSY2, 10);
For I := 0 To GetArrayLength(TPA2) - 1 Do
Begin
TP := TPA2[i];
FindColorsTolerance(TPA, 5987683, TP.x - 15, TP.y - 15, TP.x + 15, TP.y + 15, 10);
If(GetArrayLength(TPA) >= 20)Then
Begin
TP := MiddleTPA(TPA);
Result := True;
Ax := TP.x;
Ay := TP.y;
Break;
End;
End;
ColorToleranceSpeed(CTS);
Writeln('Found anvil in '+IntToStr(GetSystemTime - M));
End;
End;
Function FastFindVarrockFountain(Var Fx, Fy: Integer): Boolean;
Var
X, Y, I, C, CTS, M: Integer;
Var
TPA: TPointArray;
Var
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
M := GetSystemTime;
FindColorTolerance(X, Y, 9405792, MSX1, MSY1, MSX2, MSY2, 10);
FindColorsTolerance(TPA, 9405792, X - 20, Y - 20, X + 20, Y + 20, 10);
If(Not(GetArrayLength(TPA) >= 100))Then Exit;
Begin
TP := MiddleTPA(TPA);
Fx := TP.x;
Fy := TP.y;
Result := True;
End;
ColorToleranceSpeed(CTS);
Writeln('Found fountain in '+IntToStr(GetSystemTime - M));
End;
End;
Enjoy ;)
You are free to use them, but only if you credit me.