Code:
program AutoColor;
{$i SRL\SRL.simba}
var
x, y, ChopDown, DropWillowLog:Integer;
function TreeColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.09, 0.15);
if not (FindColorsTolerance(arP, 4023404, MSX1, MSY1, MSX2, MSY2, 6)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
procedure WillowColor;
begin
WriteLn('Seaching for the willow');
If FindColorTolerance(x, y, TreeColor, MSX1, MSY1, MSX2, MSY2, 5) then
begin
Case random (2) Of
0: begin
MMouse(x, y, 3, 3);
ClickMouse(x, y, 1);
Wait(5000+random(1000));
end;
1: begin
Mouse(x, y, 3, 3, false);
If FindBitmapToleranceIn(ChopDown, x, y, MSX1, MSY1, MSX2, MSY2, 5) then
begin
Wait(500+random(200));
Mouse(x, y, 3, 4, true)
end;
end;
end;
end;
end;
procedure FindLastWillowLog;
begin
WriteLn('Searching For Color');
If FindColorTolerance(x, y, 4155249, 689, 431, 733, 462, 15) or
FindColorTolerance(x, y, 1919571, 689, 431, 733, 462, 15) or
FindColorTolerance(x, y, 2051671, 689, 431, 733, 462, 15) then
begin
If FindColorTolerance(x, y, 4155249, MIX1, MIY1, MIX2, MIY2, 15) or
FindColorTolerance(x, y, 1919571, MIX1, MIY1, MIX2, MIY2, 15) or
FindColorTolerance(x, y, 2051671, MIX1, MIY1, MIX2, MIY2, 15) then
begin
Mouse(x, y, 5, 5, false);
If FindBitmapToleranceIn(DropWillowLog, x, y, MIX1, MIY1, MIX2, MIY2, 10) then
begin
Mouse(x, y, 3, 3, true);
Wait(500+Random(200));
WriteLn('We found the color');
end;
end;
end;
end;
procedure NoWillowLogInLastSpot;
begin
If (Not FindColorTolerance(x, y, 4155249, 689, 431, 733, 462, 15)) or
(Not FindColorTolerance(x, y, 1919571, 689, 431, 733, 462, 15)) or
(Not FindColorTolerance(x, y, 2051671, 689, 431, 733, 462, 15)) then
begin
WriteLn('There is no log in the last inventory slot, we will keep cutting');
end;
end;
begin
DropWillowLog := BitmapFromString(70, 8, 'meJzdVEkOgCAM9Gne+gGu/MkfA6F' +
'JU7sJkRi1mcMo02WAACmXHlsP5JCywH6UhibQhFaF0uOUq/X6Uw9w' +
'WQqYI8FnHd3kOMyUI5O/xJHAA47M1njuqxzRLq1yREFzxqa4bKRdn' +
'M43xxxgvBScX4bADsKT8T8ej9NN7rUISsU37aP4jSO8hBVccmtn');
ChopDown := BitmapFromString(115, 6, 'meJzNk1EKwCAIhr1dF9hr9z/GBg' +
'oif2pGBRMf1G3+9tna09vTXzYiapyqR/VTfrs/SxArkFuROKrvD5a' +
'DVYseVepJZ9V1v03SZLwRozIEaEQOTHhHUrsFWMqYFsHyYHgiGalS' +
'j+Ss7rTnmEbjJWBtULyxGtvtRPCBYQ7WHhYgFOMjPYVbvgtPbg52M' +
'3Z/hCLYzXi/J9iK3F2w4NF5bfA3sHotl+RcAmKnwOqyLNgPQNL5Cg==');
SetupSRL;
ClearDebug;
repeat
WillowColor;
FindLastWillowLog;
NoWillowLogInLastSpot
until(false);
FreeBitmap(ChopDown);
FreeBitmap(DropWillowLog);
end.