Code:
program CutAndLight;
{$DEFINE SMART}
{$i srl/srl.simba}
Var
PBox: TBox;
Procedure Setup;
begin
SetAngle (SRL_ANGLE_HIGH);
MakeCompass ('N');
end;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
Function InvEmpty: Boolean;
begin
Result:= FindColor (dx, dy, 2770782, 20, MIX1, MIY1, MIX2, MIY2);
end;
Function DetectCutting: Boolean; //Detects if you're cutting trees.
begin
PBox:= IntToBox(245, 130, 285, 195);
Result:= (AveragePixelShift (PBox, 250, 300) > 190);
end;
Function FireOnFloor: Boolean; //Checks if theres a fire under you.
var (FBox: TBox; fx, fy: integer);
begin
FBox:= IntToBox (250, 173, 272, 187);
Result:= FindObj (fx, fy, 2258409, 87, FBox);
end;
Function DetectBurning: Boolean; //Detects if you're burning logs.
begin
PBox:= IntToBox(245, 130, 285, 195);
Result:= (AveragePixelShift (PBox, 250, 300) > BurningPShift);
end;
Procedure CutAndBurnLogs;
var x, y: integer;
begin
Setup;
repeat
begin
repeat
if FindObj (x, y, ree, 1795912, 35, MSX1, MSY1, MSX2, MSY2) then
Mouse (x, y, 2, 2, true);
if DetectCutting then
Wait (300 + random(100));
until (InvFull);
end;
begin
repeat
if not DetectBurning and if not FireOnFloor then
begin
TypeByte (49);
if FindObj (x, y, 6316644, 1, MSX1, MSY1, MSX2, MSY2) then
Mouse (x, y, 2, 2, true);
end;
else
if DetectBurning and if not FireOnFloor then
Wait (200 + random (100));
else
if not DetectBurning and if FireOnFloor then
begin
If (FindColor (x, y, 2379333, 10, MMX1, MMY1, MMX2, MMY2)) then
Mouse (x, y, 0, 0, true;)
end;
until not (InvEmpty);
end;
until (false);
end;
begin
SetupSRL;
DeclarePlayers;
ActivateClient;
Repeat
if not LoggedIn then LoginPlayer;
CutAndBurnLogs;
until (false);
end.
Unfortunately, I'm getting the following error.