This Work?
SCAR Code:
Function TFindMMStoneColor: Integer;
Var
R, G, B, I,
TestColor: Integer;
H, S, L, X,
Y, Z: Extended;
TPA: TPointArray;
Begin
FindColorsTolerance(TPA, 789772, MMX1, MMY1, MMX2, MMY2, 80);
For I := 0 To High(TPA) Do
If rs_OnMiniMap(TPA[I].X, TPA[I].Y) Then
Begin
TestColor := GetColor(TPA[I].X, TPA[I].Y);
If SimilarColors(TestColor, 789772, 50) Then
Begin
ColortoHSL(TestColor, H, S, L);
ColortoRGB(TestColor, R, G, B);
ColortoXYZ(TestColor, X, Y, Z);
If InRange(R - G, -21, 19) Then
If InRange(R - B, -20, 20) Then
If InRange(Round(X) - Round(Y), -15, 15) Then
If InRange(Round(X) - Round(Z), -15, 15) Then
If InRange(Round(H) - Round(S), 22, 36) Then
If InRange(Round(H) - Round(L), 21, 35) Then
Begin
WriteLn('MM Stone Color = ' + IntToStr(TestColor));
Result := TestColor;
Exit;
End;
End;
End;
WriteLn('Couldn''t Find MM Stone Color!');
End;
If Gets The Color Too Soon, Try This One...
SCAR Code:
Function TFindMMStoneColor: Integer;
Var
R, G, B, I,
TestColor: Integer;
H, S, L, X,
Y, Z: Extended;
TPA: TPointArray;
Begin
FindColorsTolerance(TPA, 928089, MMX1, MMY1, MMX2, MMY2, 80);
For I := 0 To High(TPA) Do
If rs_OnMiniMap(TPA[I].X, TPA[I].Y) Then
Begin
TestColor := GetColor(TPA[I].X, TPA[I].Y);
If SimilarColors(TestColor, 928089, 50) Then
Begin
If ((GetColor(TPA[I].X - 1, TPA[I].Y) - 923172) = TestColor) Then
Begin
ColortoHSL(TestColor, H, S, L);
ColortoRGB(TestColor, R, G, B);
ColortoXYZ(TestColor, X, Y, Z);
If InRange(R - G, 28, 68) Then
If InRange(R - B, 55, 95) Then
If InRange(Round(X) - Round(Y), -14, 16) Then
If InRange(Round(X) - Round(Z), -11, 19) Then
If InRange(Round(H) - Round(S), -74, -60) Then
If InRange(Round(H) - Round(L), -21, -7) Then
Begin
WriteLn('MM Stone Color = ' + IntToStr(TestColor));
Result := TestColor;
Exit;
End;
End;
End;
End;
WriteLn('Couldn''t Find MM Stone Color!');
End;