SCAR Code:
Function FindRockVein(Var Rx, Ry, C: Integer; x1, y1, x2, y2: Integer): Boolean;
Var
L, I, Mx, My, P, CTS: Integer;
TPA, TPA2, TPA3: TPointArray;
Box, B2: TBox;
TP: TPoint;
Begin
If Not LoggedIn Then Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Box := IntToBox(MSCX - 15, MSCY - 20, MSCX + 15, MSCY + 20);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, C, x1, y1, x2, y2, 15);
L := High(TPA);
For I := 0 To L Do
Begin
TP := TPA[i];
If(Not(PointInBox(TP, Box)))Then
Begin
FindColorsTolerance(TPA2, 736344, TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10, 15);
If(GetArrayLength(TPA2) >= 100)Then
Begin
MiddleTPAEx(TPA2, TP.x, TP.y);
B2 := IntToBox(TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10);
Mx := B2.x2 - B2.x1 shr 1;
My := B2.y2 - B2.y1 shr 1;
FindColorsSpiralTolerance(Mx, My, TPA3, C, B2.x1, B2.y1, B2.x2, B2.y2, 15);
If(GetArrayLength(TPA3) >= 15)Then
Begin
P := Round((GetArrayLength(TPA3) / GetArrayLength(TPA2)) * 100);
If(P > 3) And (P < 20)Then
Begin
Result := True;
MiddleTPAEx(TPA3, Rx, Ry);
C := GetColor(TPA3[0].x, TPA3[0].y);
Break;
End;
End;
End;
End;
End;
ColorToleranceSpeed(CTS);
End;