SCAR Code:
program New;
{.include SRL/SRL.scar}
Function DebugATPA(aPoints: Array Of TPointArray; BmpName: String): Boolean; //Wizzup
Var
Width, Height, ClientBMP, I, L, C, Col: Integer;
xs, ys, xe, ye: Integer;
OuterPoints: TPointArray;
Begin
For I := 0 To High(aPoints) Do
L := L + Length(aPoints[i]);
SetLength(OuterPoints, L + 1);
C := 0;
For I := 0 To High(aPoints) Do
For L := 0 To High(aPoints[i]) Do
Begin
C := C + 1;
OuterPoints[C] := aPoints[i][L];
End;
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;
For I := 0 To High(OuterPoints) Do
Begin
xs := Min(xs, OuterPoints[i].X);
ys := Min(ys, OuterPoints[i].Y);
xe := Max(xe, OuterPoints[i].X);
ye := Max(ye, OuterPoints[i].Y);
End;
Width := xe - xs;
Height := ye - ys;
DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');
CopyClientToBitmap(ClientBMP, xs, ys, xe, ye)
For I := 0 To High(aPoints) Do
Begin
Col := Random(16777215);
For L := 0 To High(aPoints[i]) Do
FastSetPixel(ClientBMP, aPoints[i][L].X - xs, aPoints[i][L].Y - ys, Col);
End;
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;
Function FindFire(Var X, Y : Integer): Boolean;
Var
TPA, FP : TPointArray;
ATPA : T2DPointArray;
I, Hi : Integer;
H, S, L : Extended;
Begin
ColorToleranceSpeed(3);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5158121, MSX1, MSY1, MSX2, MSY2, 50);
ColorToleranceSpeed(1);
If Length(TPA) = 0 Then
Exit;
Hi := High(TPA);
For I := 0 To Hi Do
Begin
ColorToHSL(GetColor(TPA[i].X, TPA[i].Y), H, S, L);
If (H > 8.0) And (H < 12.0) Then
Begin
SetLength(FP, Length(FP) + 1);
FP[High(FP)] := TPA[i];
End;
End;
If Length(FP) = 0 Then
Exit;
ATPA := TPAtoATPA(FP, 25);
DebugATPA(ATPA, '');
Hi := High(ATPA);
For I := 0 To Hi Do
Begin
If Length(ATPA[i]) >= 250 Then
Begin
MiddleTPAex(ATPA[i], X, Y);
Result := True;
Exit;
End;
End;
End;
var
x, y : integer;
begin
ActivateClient;
SetupSRL;
Wait(500);
FindFire(X, y);
Mouse(x, y, 2, 2, true);
end.