program woodCutter;
{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files
{$loadlib AND_TPA}
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;
////////////////*************SCRIPT*****************\\\\\\\\\\\\\\\\\\\\\\\\\\\
//RunToTrees
procedure runToTrees();
var
pathToTrees: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToTrees := [Point(49, 35), Point(54, 45), Point(68, 61), Point(73, 75), Point(79, 96), Point(85, 114), Point(93, 149), Point(95, 172), Point(95, 189), Point(100, 216), Point(104, 242),Point(125, 252)];
if SPS.walkPath(pathToTrees) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the trees');
end;
//changeCompass
procedure changeCompass();
begin
//minimap.setAngle(MM_DIRECTION_SOUTH);
end;
//chopTrees
function chopTrees(): boolean;
var
x, y, i, r : integer;
TPA: TPointArray;
TPA_Brown: TPointArray;
TPA_Green: TPointArray;
TPA_Willow: TPointArray;
ATPA: T2DPointArray;
treeTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
// treetimer.start();
repeat
if (tabBackpack.isFull()) then
Break;
wait(randomRange(500, 1500));
//spiral tolerance starts x,y first and then spirals out
//willows
findColorsSpiralTolerance(x, y, TPA_Willow, 2703947, mainScreen.getBounds(), 3, colorSetting(2, 0.57, 2.21));
if not isLoggedIn() then
exit;
if (Length(TPA_Willow) < 1) then
exit;
//FilterTPADistTPA(TPA_Brown,1,50,TPA_Green);
//ATPA := TPA_Brown.cluster(5);
ATPA := TPA_Willow.cluster(5);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
{ if random(9) = 4 then
smallRandomMouse(80 + random(100));
if random(20) = 5 then
sleepAndMoveMouse(randomRange(250, 750));
}
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
inc(r);
if isMouseOverText(['hop','down','illow'], 300) then
begin
treetimer.start();
if random(30) = 1 then
begin
wait(randomRange(500, 1000));
fastClick(MOUSE_RIGHT);
chooseOption.select(['hop','down','illow']);
smartImage.clear();
break;
end;
// else
// if isMouseOverText(['hop','down','oak'], 100) then
// if random(30) = 1 then
// begin
// wait(randomRange(1560, 2600));
// fastClick(MOUSE_RIGHT);
// chooseOption.select(['hop','down','oak']);
// tabBackpack.waitForShift(10000);
/// smartImage.clear();
// break;
// end
//else if treeTimer.getTime() >= 6000 then
//TerminateScript;
if random(100) = 4 then
// begin
// antiban();
// end;
if random(200) = 4 then
smallRandomMouse(10 + random(10));
//
fastClick(MOUSE_LEFT);
//
if random(200) = 4 then
fastClick(MOUSE_LEFT);
wait(1000 + random(500));
if random(50) = 5 then
sleepAndMoveMouse(randomRange(1000, 1400));
//
smartImage.clear();
break;
end;
end;
//tabBackpack.waitForShift(4000);
// claimSpinTicket();
// if (tabBackpack.isItemInSlot(28)) then
// begin
// wait(100)
//chooseOption.select(['rop','']);
// end;
until (not isLoggedIn()) or (treeTimer.getTime() > 20000);
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
//packIsFull
procedure packIsFull();
var
dropTimer: TTimeMarker;
begin
if tabBackpack.isFull() then
writeln('The backpack is full!');
tabBackpack.dropItems();
minimap.clickCompass(true);
mainScreen.setAngle(MS_ANGLE_HIGH);
//minimap.mouseOffCompass();
smartImage.clear();
end;
//isStillChopping
function isStillChopping(): boolean;
var
pxShift:integer;
begin
if (not (isLoggedIn())) then
exit;
if tabBackpack.isFull() then
exit(false);
smartImage.drawBox(mainScreen.playerBox, false, clRed);
pxShift := getPixelShiftAverage(mainScreen.playerBox, 50, 500);
result := (pxShift > 150);
//writeDebug('Still chopping? ' + lowercase(toStr(result)) + ', with an average pixel shift of ' + toStr(pxShift));
end;
//waitWhileChopping
procedure waitWhileChopping();
begin
if (not isLoggedIn()) then
exit;
while isStillChopping() do
begin
// smartImage.debugDtm(oakLogsDtm, tabBackpack.getBounds(), clRed);
wait(randomRange(800,1500));
writeln('*****we are still chopping******');
//antiPattern();
end;
end;
// main loop
begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
declarePlayers();
SPS.setup('Clay_miner01',RUNESCAPE_OTHER);
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitTreasure();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
// packIsFull();
repeat
repeat
if chopTrees() then
waitWhileChopping();
until tabBackPack.isFull
if tabBackPack.isFull() then
begin
packIsFull();
end;
until false;
end.