function DetectGas(X, Y: Integer): Boolean;
var
tmpCTS, ColorCount: Integer;
tmpHue, tmpSat: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
GetColorSpeed2Modifiers(tmpHue, tmpSat);
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.31, 0.35);
SMART_DrawBoxEx(True, False, IntToBox(X - 10, Y - 10, X + 10, Y + 10), clRed);
ColorCount := CountColorTolerance(8097941, X - 10, Y - 10, X + 10, Y + 20, 13);
Result := (ColorCount > 10);
SetColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(tmpHue, tmpSat);
end;
You feed the function the center coordinates of the rock you are mining.