SCAR Code:
Function FindGas(RockX, RockY : Integer; Var GasX, GasY : Integer): Boolean;
Var
TPA, Points : TPointArray;
ATPA : T2DPointArray;
I, Bmp, Hi, temp, Bmp2, J, K, Count : Integer;
H, S, L : Extended;
Box : TBox;
Canv1, Canv2 : TCanvas;
Begin
Bmp := BitmapFromString(0, 0, '');
Bmp2 := BitmapFromString(0, 0, '');
SetLength(Points, 0);
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 8820900, RockX - 30, RockY - 30, RockX + 30, RockY + 30, 30);
ColorToleranceSpeed(1);
If Length(TPA) = 0 Then
Exit;
Hi := High(TPA);
For I := 0 To Hi Do
Begin
temp := GetColor(TPA[I].X, TPA[I].Y);
ColorToHSL(temp, H, S, L);
If H < 13 Then
If H > 6 Then
Begin
SetLength(Points, Length(Points) + 1);
Points[High(Points)] := TPA[I];
End;
End;
ATPA := SplitTPA(Points, 10);
Hi := High(ATPA);
For I := 0 To Hi Do
Begin
If Length(ATPA[I]) < 100 Then
Continue;
Box := GetTPABounds(ATPA[I]);
CopyClientToBitmap(Bmp, Box.X1, Box.Y1, Box.X2, Box.Y2);
Wait(250);
CopyClientToBitmap(Bmp2, Box.X1, Box.Y1, Box.X2, Box.Y2);
Canv1 := GetBitmapCanvas(Bmp);
Canv2 := GetBitmapCanvas(Bmp2);
For J := Box.X1 To Box.X2 Do
For K := Box.Y1 To Box.Y2 Do
If Canv1.Pixels[J, K] <> Canv2.Pixels[J, K] Then
Inc(Count);
If (Count / ((Box.X2 - Box.X1) + (Box.Y2 - Box.Y1))) * 100 >= 70 Then
Begin
Writeln('Found Gas!');
Result := True;
MiddleTPAex(ATPA[I], GasX, GasY);
FreeBitmap(Bmp);
FreeBitmap(Bmp2);
Exit;
End;
End;
FreeBitmap(Bmp);
FreeBitmap(Bmp2);
End;
I have tested it with gasses, haven't failed