JuKKa
2008-05-11 16:15:34
I just noticed that the gas color has changed!
Due to this i made a function which also works pretty well!
Forgot to save the new gas color pictures =(
but i picked quite a few. Here if someone wants to check them out or whatever..
Due to this i made a function which also works pretty well!
program New;
{.Include SRL/SRL.Scar}
{.Include SRL/SRL/Skill/Mining.Scar}
function n_GasMove(Var gx, gy: Integer): Boolean;
var
clientcanvas, gascanvas1, gascanvas2: TCanvas;
X1, Y1, X2, Y2, xG, yG, count: Integer;
pic1, pic2: Integer;
begin
X1 := gX - 30;
Y1 := gY - 50;
X2 := gX + 30;
Y2 := gY + 50;
pic1 := BitmapFromString(60, 100, '');
pic2 := BitmapFromString(60, 100, '');
gascanvas1 := GetBitmapCanvas(pic1);
gascanvas2 := GetBitmapCanvas(pic2);
clientcanvas := getclientcanvas;
CopyCanvas(clientcanvas, gascanvas1, X1, Y1, X2, Y2, 0, 0, 40, 40);
Wait(100);
CopyCanvas(clientcanvas, gascanvas2, X1, Y1, X2, Y2, 0, 0, 40, 40);
count := 0;
for yG := 1 to 100 do
for xG := 1 to 60 do
if ((gascanvas1.pixels[xG, yG]) <> (gascanvas2.pixels[xG, yG])) then
Inc(Count);
if ( (Count/6000)*100 > 40) then
begin
writeln('gas change ' + IntTostr(Round((Count/6000)*100))+'%');
Result := True;
end;
FreeBitmap(pic1);
FreeBitmap(pic2);
end;
Function n_FindGas(Var gX, gY: Integer; Avoid: Boolean): Boolean;
Var
I, X1, Y1, X2, Y2, CTS: Integer;
aTPA: Array [0..6] Of TPointArray;
TIntArr, TIntArr2: TIntegerArray;
TPA: TPointArray;
Begin
If(gX - 30 < 0)Or(gY - 50 < 0)Or(gX + 30 > MSX2)Or(gY + 50 > MSY2)Then
Exit;
X1 := gX - 30;
Y1 := gY - 50;
X2 := gX + 30;
Y2 := gY + 50;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsTolerance(aTPA[0], 10397609, X1, Y1, X2, Y2, 20);
FindColorsTolerance(aTPA[1], 9740966, X1, Y1, X2, Y2, 20);
FindColorsTolerance(aTPA[2], 11055025, X1, Y1, X2, Y2, 20);
FindColorsTolerance(aTPA[3], 10464173, X1, Y1, X2, Y2, 20);
FindColorsTolerance(aTPA[4], 10792881, X1, Y1, X2, Y2, 20);
FindColorsTolerance(aTPA[5], 9214622, X1, Y1, X2, Y2, 20);
FindColorsTolerance(aTPA[6], 10924724, X1, Y1, X2, Y2, 20);
For I:= 0 To 6 Do
Begin
TIntArr2 := GetColors(aTPA[I]);
TIntArr := CombineIntArray(TIntArr2, TIntArr);
TPA := CombineTPA(aTPA[I], TPA);
End;
ClearSameIntegersAndTPA(TIntArr, TPA);
MiddleTPAEx(TPA, gX, gY);
Status(IntToStr(High(TPA)));
If(High(TIntArr) > 100)And(High(TPA) > 100)Then
Result := n_GasMove(gX, gY);
If(Result)And(Avoid)Then
Begin
Mouse(MMCx - 10, MMCY - 10, 10, 10, True);
Flag;
End;
ColorToleranceSpeed(CTS);
End;
Var
X, Y: Integer;
Begin
SetupSRL;
Repeat
GetMousePos(X, Y);
If(n_FindGas(X, Y, True))Then
Writeln('Found Gas!');
Wait(100);
Until False
End.Forgot to save the new gas color pictures =(
but i picked quite a few. Here if someone wants to check them out or whatever..
New Gas Colors =
10397609
9740966
11055025
10464173
10792881
9214622
10924724
Old Gas Colors =
8296866
5795704
5270391
5599613
5136998
6321275
6123901