SCAR Code:
{.Script Info:
# ScriptName = Lumberjack
# Author = Bad Processor
# Description = Cuts down trees of a specified type.
# Version = 1.00
# Date = 9/9/09
# Comments = I'd recommend a combat level of at least 15 if cutting near draynor, the dark wizard gets really annoying.
/Script Info}
program Lumberjack;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/WoodCutting.scar}
// Remember to fill in your players!!!
const
TreeType = 'Tree'; // Types: Tree, Oak, Willow, etc. Capitals please.
ScriptVer = '1.01'; // Don't change
//Don't touch below unless you know what you're doing!
var
DLg, Cycles, Randoms, Loads, dvC, dvN, dvT: Integer;
procedure DeclarePlayers;
begin
HowManyPlayers:= 1; // FILL IN! IMPORTANT
NumberOfPlayers( HowManyPlayers );
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Integers[0] := 5; // Loads to cut per login cycle.
Players[0].Active := True;
{Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := '';
Players[0].Integers[0] := 5; // Loads to cut per login cycle.
Players[1].Active := True;}
WriteLn('Using '+IntToStr(HowManyPlayers) + ' players in script.');
end;
procedure AntiBanRandoms;
begin
case Random(6) of
0..3: BoredHuman; // the .. means from 0 to 3 so you dont list them all, bored human is better than what you had
4: PickUpMouse;
5: RandomRClick;
end;
if(FindNormalRandoms) then Randoms := randoms +1;
if(FindFight) then RunAway('W', true, 1, 10000);
if(FindDead) then begin
WriteLn(Players[CurrentPlayer].Name + ' found dead, switching player...');
NextPlayer(false);
end;
end;
procedure LoadDTMs;
begin
DLg := DTMFromString('78DA63CC646260B8C3800618E1E47F2060CC0' +
'0AAF9805B0D98AE06AA794E404D2C50CD4B026A92806ADE125093' +
'4E847B8A816A6E1250938CDFEF60BA14A8E6350135D94035EFF1A' +
'B010036CF115F'); // All types of logs
end;
procedure CutTrees;
var
tx, ty, ocount, tstart, tend, FoundFight, FoundNest:Integer;
begin
if(not LoggedIn) then LoginPlayer;
OCount := InvCount; //need to have before cutting starts incase its a quick cut
if FindObjTPA(tx, ty, 1857098, 25, 25, 50, 50, 10, ['down '+TreeType, TreeType]) then
begin //using the if statement it will mean we can controle the script better
MMouse(tx, ty, 3, 3) //move mouse to color found spot
Wait(500+random(500));
GetMousePos(tx, ty); //get the position of mouse for later
if IsUpText(TreeType)then //checks the up text as a fail safe so we dont click for no reason
begin //if up text is there then we continue
Case Random(8) of
0..3: Mouse(tx, ty, 0, 0, true); //normal click mouse
4..7: begin
Mouse(tx, ty, 0, 0, false); //right clicks and then chooses chop down option
ChooseOption('down');
end;
end;
end;
end;
AntiBanRandoms;
tstart := GetTimeRunning;
repeat
Wait(random(100));
if(FindFight) then
begin
RunAway('W', true, 1, 10000);
inc(FoundFight) // allos us to count fights instead of just 0 or 1
end;
until(ocount <> InvCount) or (tstart > 12000); //its is actually an infinite loop, miss click will cause this ,
//the tstart > 12000 will exit is chopping takes longer than 12 seconds, but will simply restart chopping again
tend := GetTimeRunning - tstart;
if FindBirdsNest then inc(FoundNest); //if we find and deal with it then add one to foundnest
ClearDebug;
WriteLn('Lumberjack '+ScriptVer+' by Bad Processor');
WriteLn('Trees cut so far: '+inttostr(dvT));
WriteLn('Found nest in this tree: '+inttostr(FoundNest));
WriteLn('Found fight: '+inttostr(FoundFight));
WriteLn('Time taken to cut tree: '+inttostr(floor(tend / 1000))+' seconds');
end;
procedure CutAllTreesAndDrop;
begin
repeat
CutTrees;
inc(dvT); //adds one to it same as dvT:= + 1; just shorter code
until(InvFull);
ClickAllItems('dtm', DLg, 'Drop', Random(250), []);
inc(Loads);
end;
procedure ProgressReport;
begin
ClearDebug;
WriteLn('Lumberjack '+ScriptVer+' by Bad Processor');
WriteLn('Time running: '+TimeRunning); //time since you started script
WriteLn('Randoms encountered: '+inttostr(Randoms));
WriteLn('Number of total players: '+inttostr(HowManyPlayers));
WriteLn('Total loads completed: '+inttostr(Loads));
WriteLn('Total logins done: '+inttostr(dvC));
WriteLn('Total nests found: '+inttostr(dvN));
WriteLn('Total trees cut: '+inttostr(dvT));
WriteLn('Please post this progress report, thanks!');
end;
procedure MainLoop; //its good to have a seperate procedure for main loop
begin
repeat
LoginPlayer;
SetAngle(True);
Wait(500); //small wait to get screen still
for cycles := 1 to Players[CurrentPlayer].Integers[0] do
begin
CutAllTreesAndDrop;
AntiBanRandoms;
end;
inc(dvC);
until(AllPlayersInactive);
end;
begin
SetupSRL;
SetupWoodcutting;
LoadDTMs;
DeclarePlayers;
MainLoop; //calls main procedure
ProgressReport;
FreeDTM(DLg);
end.