SCAR Code:
program DraynorChopNBank;
{.Include SRL\SRL\Misc\SMART.SCAR}
{.include SRL\SRL.scar}
{.include SRL\SRL\Misc\Debug.scar}
var
NumOfLogs, Loads, TotalProggies : Integer;
TP : TPoint;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;//Use this player?
Players[0].Pin := '';//Bank pin. Leave blank if you don't have one.
Players[0].Integers[0] := 000;//How many logs to cut?
Players[0].Booleans[0] := True;//Is hatchet equiped?
Players[0].BoxRewards := ['Xp', 'mote', 'ostume'];
{Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Pin := '';
Players[0].Integers[0] := 000;
Players[0].Booleans[0] := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume'];}
end;
procedure S_FindRandoms;
begin
LampSkill := 'woodcutting';
FindNormalRandoms;
end;
function S_LevelUp: Boolean;
begin
if FindNPCChatText('ongrat', Nothing)then
begin
ClickContinue(True, True);
Wait(80 + Random(100));
HoverSkill('woodcutting', True);
CloseWindow;
Writeln('Congratulations, you have gained a Woodcutting level!');
Result := True;
end;
end;
procedure S_MyAntiBan;
begin
case Random(70) of
0: RandomMovement;
1: BoredHuman;
2: HoverSkill('random', false);
3: RandomRClick;
4: begin
case Random(2) of
0: begin
MakeCompass(20 + Random(40));
MakeCompass(320 - Random(40));
end;
1: begin
MakeCompass(50 + Random(30));
MakeCompass(300 - Random(30));
end;
end;
end;
5: begin
MakeCompass(80 + Random(20));
MakeCompass(280 - Random(80));
end;
6: begin
MakeCompass(120 + Random(50));
MakeCompass(220 - Random(30));
end;
end;
end;
procedure W_WalkToWillows;
var
x, y : Integer;
begin
if not LoggedIn then Exit;
RunEnergy(60);
MakeCompass('n');
if RadialWalk(FindWaterColor, 180, 220, 60, 2, 1)then
begin
Wait(80 + Random(100));
Writeln('Walking to Willows.');
FFlag(0);
end else
if FindSymbol(x, y, 'fish')then
begin
Wait(80 + Random(100));
Writeln('Found fishing symbol, walking to Willows.');
Mouse(x, y + Random(20), 4, 4, True);
FFlag(0);
end else
begin
Writeln('Couldn''t walk to Willows.');
Logout;
Players[CurrentPlayer].Active := False;
end;
end;
function W_BankColor: Integer;
var
Bank, x, y : Integer;
begin
Bank := DTMFromString('78DA632C6162608866400181DEDE0CFF81342' +
'310FF0702C62CA09A4454357FFE30313043D58000584D1C116AC2' +
'F0AB0100EC370F0C');
if DTMRotated(Bank, x, y, MMX1, MMY1, MMX2, MMY2)then
begin
Result := GetColor(x + 15, y);
Writeln('Bank floor color = ' + IntToStr(Result));
end else
Writeln('Didn''t find bank color.');
FreeDTM(Bank);
end;
procedure W_WalkToBank;
var
x, y : Integer;
begin
if not LoggedIn then Exit;
RunEnergy(60);
MakeCompass('n');
if RadialWalk(W_BankColor, 0, 77, 68, -2, 1)then
begin
Wait(80 + Random(100));
Writeln('Inventory full, walking to bank.');
FFlag(2);
end else
if FindSymbol(x, y, 'bank')then
begin
Wait(80 + Random(100));
Mouse(x, y, 4, 4, True);
Writeln('Found bank symbol, walking to bank.');
FFlag(2);
end else
begin
Writeln('Couldn''t walk to bank.');
Logout;
Players[CurrentPlayer].Active := False;
end;
end;
procedure Cut_FindHatchet;
var
HatchetDTM, x, y : Integer;
begin
HatchetDTM := DTMFromString('78DA63CC6664605805C448A0354590811F488' +
'344FF0301631690B509550D44164602E934206B23013520739611' +
'50930F642D24A0A61CC85A44404D2990B51ABF1A00963F0CC9');
if Players[CurrentPlayer].Booleans[0] = True then
GameTab(5)
else
GameTab(4);
if FindDTM(HatchetDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
Writeln('Found hatchet.')
else
begin
Writeln('Didn''t find hatchet, logging out.');
Logout;
Players[CurrentPlayer].Active := False;
end;
FreeDTM(HatchetDTM);
end;
procedure Cut_WhileChopping;
var
ClickTree, NCTime, LastCount : Integer;
begin
MarkTime(ClickTree);
NCTime := 15000 + Random(10000);
LastCount := InvCount;
while(InvCount < 28)and LoggedIn do
begin
if TimeFromMark(ClickTree) > NCTime then
if InvCount = LastCount then Break;
S_MyAntiBan;
Wait(80 + Random(5000));
S_LevelUp;
S_FindRandoms;
end;
end;
function Cut_TreeCutDown: Boolean;
var
TPA : TPointArray;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.87);
FindColorsTolerance(TPA, 7774874, TP.x - 20, TP.y - 20, TP.x + 20, TP.y + 20, 15);
if(Length(TPA) < 10)then
begin
Writeln('Length inside box: ' + IntToStr(Length(TPA)));
Result := False;
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
end;
procedure Cut_ChopTrees;
var
fx, fy, i, x, y : Integer;
s : String;
TPA : TPointArray;
ATPA : T2DPointArray;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.87);
repeat
FindColorsSpiralTolerance(fx, fy, TPA, 7774874, MSX1, MSY1, MSX2, MSY2, 15);
ATPA := SplitTPAEx(TPA, 5, 5);
DebugATPA(ATPA, '');
if Length(ATPA) = 0 then Exit;
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
for i := 0 to High(ATPA) do
begin
Writeln('Length:' + IntToStr(Length(ATPA[i])));
if(Length(ATPA[i]) < 30)then Continue;
MiddleTPAEx(ATPA[i], fx, fy);
Wait(30 + Random(20));
MMouse(fx, fy, 4, 4);
s := RS_GetUpText;
if((Pos('hop', s) > 0) and (Pos('illow', s) > 0))then
begin
GetMousePos(x, y);
Wait(80 + Random(100));
Mouse(x, y, 0, 0, True);
TP := IntToPoint(x, y);
repeat
Cut_WhileChopping;
until(Cut_TreeCutDown or InvFull);
end;
end;
until(InvFull or not LoggedIn);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
end;
function B_BankItems: Integer;
var
Logs, x, y : Integer;
begin
Logs := DTMFromString('78DA630C6364607804C44820C84B96811F48C' +
'34419C381AC2BA86A60B270358940D675026AA280AC6704D4B803' +
'598FF1AB0100F99906E6');
if FindDTM(Logs, x, y, MIX1, MIY1, MIX2, MIY2) then
Result := CountItems(Logs, 'dtm', []);
if OpenBank('db', True, True)then
begin
if Players[CurrentPlayer].Booleans[0] = True then
begin
DepositAll;
CloseBank;
NumOfLogs := NumOfLogs + Result;
Inc(Loads);
end else
begin
Deposit(2, 28, True);
CloseBank;
NumOfLogs := NumOfLogs + Result;
Inc(Loads);
end;
if(NumOfLogs >= Players[CurrentPlayer].Integers[0])then
begin
Writeln('Cut desired number of logs, logging out.');
Wait(80 + Random(100));
Logout;
Players[CurrentPlayer].Active := False;
end;
end else
begin
Wait(80 + Random(100));
Writeln('Couldn''t find bank booth, logging out.');
Logout;
Players[CurrentPlayer].Active := False;
end;
FreeDTM(Logs);
end;
{*******************************************************************************
function Prg_PlayerActivity(i: integer): string;
By: Drags111
Description: Determines whether the player is active or not.
*******************************************************************************}
function Prg_PlayerActive(i : Integer): String;
begin
if Players[i].Active then Result := 'T' else Result := 'F';
end;
procedure Prg_ProgReport;
var
i : Integer;
begin
Inc(TotalProggies);
Players[i].Integers[9] := Loads;
Players[i].Integers[10] := NumOfLogs;
Writeln(' _______________________________________________');
Writeln(PadR('| Draynor Willow Chop N'' Bank', 48) + '|');
Writeln('|______________________V.4______________________|');
Writeln('| |');
Writeln(PadR('| Time run: ' + TimeRunning, 48) + '|');
Writeln(PadR('| Loads: ' + IntToStr(Loads), 48) + '|');
Writeln(PadR('| Logs: ' + IntToStr(NumOfLogs), 48) + '|');
Writeln(PadR('| Exp Gained: ' + FloatToStr(NumOfLogs * 67.5), 48) + '|');
Writeln('|_______________________________________________|');
Writeln('|________________Player''s Stats_________________|');
Writeln('| Nick T/F Loads Logs |');
Writeln('| ¯¯¯¯ ¯¯¯ ¯¯¯¯¯ ¯¯¯¯ |');
for i := 0 to High(Players)do
Writeln('| ' + PadR(Players[i].Nick, 10) + PadR(Prg_PlayerActive(i), 9)
+ PadR(IntToStr(Players[i].Integers[9]), 11)
+ PadR(IntToStr(Players[i].Integers[10]), 11) + '|');
Writeln('|_______________________________________________|');
end;
procedure F_Setup;
begin
//ClearDebug;
SetupSRL;
DeclarePlayers;
LoginPlayer;
end;
begin
F_Setup;
repeat
SetAngle(True);
repeat
Cut_FindHatchet;
begin
W_WalkToWillows;
Cut_ChopTrees;
W_WalkToBank;
B_BankItems;
Prg_ProgReport;
end;
until(NumOfLogs >= Players[CurrentPlayer].Integers[0])or(not LoggedIn);
NextPlayer(LoggedIn);
until AllPlayersInactive;
end.