Code:
program TreeCutter;
{$i SRL-6/srl.simba}
function rsps_getUpText:string; //trying to make my own UpText CMD
var
blueTPA: tpointarray;
blueATPA: t2dpointarray;
bmp: integer;
begin
FindColorsTolerance(blueTPA, 16776960, 10, 50, 130, 70, 15);
if (length(blueTPA) > 1) then
blueATPA :=splitTPAEx(blueTPA, 1, 10);
SortATPAFromFirstPointX(blueATPA, point(0, 0));
result:= getTextATPA(blueATPA, 5, 'UpChars07');
end;
procedure Inventory; //little test i did to open inv unknown use atm
var
x, y:Integer;
begin
if FindColorTolerance(x, y, 2249607, 650, 220, 665, 235, 10) then
begin
mouse(x, y, 0, 0);
ClickMouse(x, y, 1);
Wait(300 + Random(710));
end;
end;
procedure ClickTree; //click tree procedure
var
X, Y:Integer;
begin
if FindColorTolerance(x, y, 6260864, 10, 50, 510, 375, 15) then
//else if rsps_getUpText( 'agic') then//trying to figure out stuff
begin
mouse(x, y, 0, 0); //moves mouse
wait(Random(250)); //wait about a 1/4 second
ClickMouse(x, y, 1); //left clicks at x y found
writeln('Cutting Tree');
wait(5000 +random(5000));
end;
end;
procedure CheckTree; //procedure to check if tree is cut
var
x, y:integer;
begin
if FindColorTolerance(x, y, 12621, 130, 50, 390, 375, 1) then true;
if true then ClickTree; //if tree is cut. Find new tree
writeln('tree cut down');
if false then writeln('tree not cut waiting');
wait(1000 +random(4000)); //waits up to 1sec +random int 4
repeat CheckTree until true; //repeat procedure until loops to Clicktree
end;
begin
ClearDebug;
//Inventory;
ClickTree;
CheckTree;
end;