SCAR Code:
{ - need new way of detecting when trees are cut down
- need new way of detecting which tree the mouse is over}
program PowerChopper;
{.Include SRL\SRL\Misc\SMART.SCAR}
{.include SRL\SRL.scar}
var
HatchetDTM : Array of Integer;
i, x, y, NumOfLogs, TotalProggies, CP : integer;
TreeColor : TIntegerArray;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Pin := '';
Players[0].Strings[0] := 'willow';//Which tree to cut?
Players[0].Integers[0] := 270;//How many logs to cut?
Players[0].BoxRewards := ['Xp', 'mote', 'ostume'];
end;
procedure FindRandoms;
begin
LampSkill := 'woodcutting';
FindNormalRandoms;
end;
procedure MyAntiBan;
begin
case Random(70) of
0: RandomMovement;
1: BoredHuman;
2: HoverSkill('random', false);
3: RandomRClick;
4: begin
case Random(2) of
0: begin
KeyDown(VK_RIGHT);
Wait(50 + Random(1300));
KeyUp(VK_RIGHT);
Wait(60 + Random(2000));
KeyDown(VK_LEFT);
Wait(70 + Random(1100));
KeyUp(VK_LEFT);
end;
1: begin
KeyDown(VK_LEFT);
Wait(50 + Random(1300));
KeyUp(VK_LEFT);
Wait(60 + Random(2000));
KeyDown(VK_RIGHT);
Wait(70 + Random(1100));
KeyUp(VK_RIGHT);
end;
end;
end;
5: begin
KeyDown(VK_LEFT);
Wait(100 + Random(1200));
KeyUp(VK_LEFT);
end;
6: begin
KeyDown(VK_RIGHT);
Wait(150 + Random(1100));
KeyUp(VK_RIGHT);
end;
7..69:
end;
end;
procedure HatchetDTMs;
begin
SetArrayLength(HatchetDTM, 7);//[0]:= Bronze, [6]:= Rune
HatchetDTM[0] := DTMFromString('78DA630C646260D8C4C8800C7CAC9519F8813' +
'44C94D113A86617AA1A982C5C8D1B50CD36026ABC816AD6125013' +
'0C54B38E809A504C3763A80921EC1E00949107EF');
HatchetDTM[1] := DTMFromString('78DA630C626260D8C4C8800C02BDBD19F8813' +
'448F43F1030BA03D5EC47550391859140DA0DA8662B01355E4035' +
'6B09A80906AA5947404D2850CD06026A42806AB6E157030033F30' +
'C28');
HatchetDTM[2] := DTMFromString('78DA630C626260D8C8C8800CCAF3F318F8813' +
'448F43F10307A02D5EC40550391859140DA0DA8660B01355E4035' +
'6B09A80904AA5947404D28A69BB1AAD98A5F0D0090050C8D');
HatchetDTM[3] := DTMFromString('78DA63F4676260D8C0C8800C44454418F8813' +
'448F43F1030BA03D5EC43550391859140DA05A8661701351E4035' +
'EB09A80900AA5947404D28A69BB1AAD98A5F0D0095870B78');
HatchetDTM[4] := DTMFromString('78DA630C646260D8C8C8800C1C1CE319F8813' +
'44C94D10DA8E600AA1A982C5C8D2B50CD0E026A3C806A36105013' +
'0054B38E809A504C3763A80901AAD9865F0D00C5940824');
HatchetDTM[5] := DTMFromString('78DA63EC64626038C0C8800C9C829D18F8813' +
'44C94B101A8E614AA1A982C8A9A7D04D4F402D5EC2742CD21026A' +
'6A816AAEE05703006FA208C7');
HatchetDTM[6] := DTMFromString('78DA630C606260D8C8C8800C5CA2531944803' +
'44C94D11DA8662FAA1A982C5C8D1B50CD56026ABC806AD6125013' +
'0C54B38E809A504C3763A80901AAD9865F0D00E749084A');;
end;
procedure Cut_FindHatchet;
var
b: Boolean;
begin
for i:= 0 to 6 do
if(FindDTM(HatchetDTM[i], x, y, MIX1, MIY1, MIX2, MIY2))then
begin
b:= True;// assign b:= True, now you know it's found.
Break;// break the loop - once found, no need to keep going through.
end;
begin
if(b = True)then// since it's only a check, = is needed, rather than :=
Writeln('Found hatchet.')
else
begin
Writeln('Didn''t find hatchet, logging out.');
LogOut;
end;
end;
end;
procedure Cut_TreeColors;
begin
SetArrayLength(TreeColor, 4);
TreeColor := [6266770, 1199164, 8497045, 1718835];
case LowerCase(Players[CP].Strings[0]) of
'normal': i := 0;
'oak': i := 1;
'willow': i := 2;
'yew': i := 3;
else
begin
Writeln('No tree specified, logging out.');
Logout;
Exit;
end;
end;
end;
procedure Cut_TreeCutDown;
var
TrCols : TPointArray;
Box : Integer;
begin
i := Length(TrCols);
repeat
FindColorsTolerance(TrCols, TreeColor[i], Box.x1, Box.y1, Box.x2, Box.y2, 3);//This is line 152 <<<<<
if(Length(TrCols) <> i)then
begin
Writeln('Tree has been cut down.');
Exit;
end;
Wait(80 + Random(100));
until(InvFull or not(LoggedIn));
end;
function Cut_CutTrees: Boolean;
var
fx, fy, i : integer;
TPA : Array of TPoint;
T2D : T2DPointArray;
Box : TBox;
begin
repeat
FindColorsSpiralTolerance(fx, fy, TPA, TreeColor[i], MSX1, MSY1, MSX2, MSY2, 5);
T2D := SplitTPAEx(TPA, 3, 4);
if Length(T2D) = 0 then exit;
for i := 0 to High(T2D) do
begin
if MiddleTPAEx(T2D[i], fx, fy) then
begin
Wait(30 + Random(20));
MMouse(fx, fy, 4, 4);
end;
if(IsUpText('hop'))then
begin
GetMousePos(x, y);
Wait(50 + Random(300));
Mouse(x, y, 4, 4, True);
IntToBox(x - 20, y - 20, x + 20, y + 20);
Cut_TreeCutDown;
Result := True;
end;
end;
until(InvFull or not(LoggedIn));
end;
procedure Cut_DropLogs;
begin
if(InvFull)then
begin
Wait(500 + Random(100));
for i := 2 to 28 do
DropItem(i);
NumOfLogs := NumOfLogs + 27;
if(NumOfLogs >= Players[0].Integers[0])then
begin
Writeln('Cut desired number of logs, logging out.');
Wait(50 + Random(1000));
Logout;
end;
end;
FindRandoms;
end;
procedure ProgReport;
begin
Inc(TotalProggies);
Writeln(' _______________________________________________');
Writeln(PadR('| Coh3n''s Power Chopper', 48) + '|');
Writeln('|_________________First Script__________________|');
Writeln('| |');
Writeln(PadR('| Time run: ' + TimeRunning, 48) + '|');
Writeln(PadR('| Loads: ' + IntToStr(NumOfLogs / 27), 48) + '|');
Writeln(PadR('| Logs: ' + IntToStr(NumOfLogs), 48) + '|');
Writeln('|_______________________________________________|');
end;
begin
SMARTSetupEx(152, False, True, False);
Wait(5000);
SetTargetDC(SmartGetDC);
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
SetAngle(True);
HatchetDTMs;
Cut_FindHatchet;
repeat
if(ExistsItem(1))then
Cut_TreeColors;
Cut_CutTrees;
Cut_DropLogs;
ProgReport;
FindRandoms;
until(not LoggedIn);
end.