Simba Code:
program DraynorChopper;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
var
LocFailSafe, AxeFailSafe, Lag, BankDTM, ChopWaitTime,AnimationCheck,
InitChopWait, InitWait, AxeFailSafeToggle, RunFromCombat, AxeFailSafe1, AxeFailSafe2,AxeFailSafeTime: Integer;
Location: string;
procedure GetDTMS;
var
ChopWaitTime, TreeColor, BankColor, BankDTM:integer;
begin
Lag := strtoint('500') ; //lag time in ms
ChopWaitTime := strtoint('140') ; //time in seconds to check if chopping
AnimationCheck := strtoint ('250') ; //for pixelshift, chopping
Location := 'Willow';
begin
TreeColor := 12892;
BankColor := 8229016;
BankDTM := DTMFromString('mbQAAAHicY2VgYHBgZmCwZ4bQlkBsDsRfgeLvgPgnELMwMjC8AtJ//jDB8efPb8EYG2DEgsEAACUmEKg=');
end;
begin
RunFromCombat := 1;
end;
end;
Procedure P07_DeclarePlayer;
Begin
P07_PlayerName:='';
P07_PlayerPass:='';
end;
procedure WaitHumanClick;
begin
case random(606) of
1..442: Wait(RandomRange(0, 125));
443..575: Wait(RandomRange(0, 201));
573..590: Wait(RandomRange(0, 605));
591..606: Wait(RandomRange(412, 1009));
end;
end;
procedure FreeBankDTM;
var
BankDTM:Integer;
begin
FreeDTM(BankDTM);
end;
procedure GoToBank;
var x, y,BankDTM,Location, Lag: integer;
begin
P07_MakeCompassNorth;
if(not(P07_BankScreen)) then
begin
WaitHumanClick;
if(findDTM(BankDTM, x, y, 565, 7, 717, 157)) then
begin
case Location of
'Willow': Mouse(RandomRange(X + 17, x + 21), RandomRange(Y - 10, Y - 13), random(4), random(4), true);
end;
end;
P07_FFlag;
wait (Lag);
end;
end;
procedure BankLogs;
var
Lag:Integer;
begin
wait(Lag);
if(P07_BankScreen) then
begin
P07_Deposit(1, 28, True);
wait (Lag);
end;
end;
procedure OpenBank1;
var x, y: integer;
begin
Repeat
If P07_FindObj(x, y, 'ank booth', BankColor, 10) Then
begin
LocFailSafe := 0;
WaitHumanClick;
Mouse(RandomRange(X - 6, x + 4), RandomRange(Y - 8, Y + 5), random(3), random(3), false);
WaitHumanClick;
P07_ChooseOptionMulti(['se-q']);
end
else
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassDegree(randomrange(25, 35));
LocFailSafe := LocFailSafe + 1;
Writeln('Failed to find the bank, change variables');
GoToBank;
end;
P07_FFlag;
wait (Lag);
until(P07_BankScreen)
end;
procedure GoToTrees;
var x, y: integer;
begin
P07_MakeCompassNorth;
WaitHumanClick;
if(findDTM(BankDTM, x, y, 565, 7, 717, 157)) then
begin
case Location of
'Willow': Mouse(RandomRange(X - 7, x - 17), RandomRange(Y + 17, Y + 27), random(4), random(3), true);
end;
end;
P07_FFlag;
wait (Lag);
end;
procedure ChopTree;
var
TreeColor, InitChopWait, InitWait,x,y:Integer;
begin
If P07_FindObj(x, y, Location, TreeColor, 5) Then
begin
WaitHumanClick;
MMouse(x, y, Random(2), Random(2));
WaitHumanClick;
if (P07_ContainsText(GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 13423640, 65, 'P07UpChars'), [Location])) then
begin
GetMousePos(x, y);
LocFailSafe := 0;
if(random(2) = 1) then
begin
Mouse(x, y, 0, 0, true);
end
else
begin
Mouse(x, y, 0, 0, false); //clicks it
P07_ChooseOptionMulti(['hop']) //mouse precedure
end;
end
else
begin
GoToTrees; //failsafe back to tree
end;
P07_FFlag;
wait (Lag * 2 + 250);
MMouse(x, y, 0, 0);
if (P07_FindObj(x, y, Location, TreeColor, 5) and P07_ContainsText(GetTextAtExWrap(35, 8, 170, 21, 0, 5, 1, 13423640, 65, 'P07UpChars'), [Location])) then //tries to find tree again
begin
if(AxeFailSafe > ChopWaitTime) then
begin
MarkTime(InitChopWait);
InitWait := 1;
end;
//Mouse(RandomRange(X - 5, x + 5), RandomRange(y - 5, y + 5), random(5), random(5), True);
end
else
begin
Mouse(242, 195, random(3), random(3), true);
end;
end
else
begin
wait(2000); //goes to trees if cant find trees
if((LocFailSafe = 0) or (LocFailSafe = 5) or (LocFailSafe = 10) or (LocFailSafe = 15) or (LocFailSafe = 20)) then
begin
P07_MakeCompassDegree(randomrange(25, 35));
GoToTrees;
end;
LocFailSafe := LocFailSafe + 1;
end;
end;
procedure TurnOnRun;
var x, y: integer;
begin
Mouse(671, 482, random(5), random(5), true);
WaitHumanClick;
if(FindColorTolerance(x, y, 4803917, 651, 422, 659, 430, 10)) then
begin
Mouse(640, 426, random(5), random(5), true);
end;
Mouse(644, 184, random(5), random(5), true);
end;
Function isMoving1: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(220, 140, 300, 200);
Result := (AveragePixelShift(PBox, 250, 500) > AnimationCheck);
end;
Function AntiBan: Boolean;
begin
case random(320) of
0: P07_HoverSkill('woodcutting', random(5000));
1: TurnOnRun;
2: P07_MakeCameraAngleHigh;
3: P07_MakeCompassSouth;
4: P07_MakeCompassEast;
5: P07_MakeCompassWest;
6: P07_MakeCompassNorth;
9: P07_HoverSkill('strength', random(5000));
end;
end;
begin
SetupSRL();
P07_DeclarePlayer;
SetupP07Include;
ActivateClient;
Wait(2000);
If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
end;
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
InitChopWait := 0;
InitWait := 0;
GetDTMs;
AddOnTerminate('FreeDTMs')
TurnOnRun;
LocFailSafe := 0;
AxeFailSafe := 80;
AxeFailSafeToggle := 0;
AxeFailSafe1 := 0;
AxeFailSafe2 := 0;
MarkTime(AxeFailSafeTime);
repeat
AntiBan;
if(TimeFromMark(InitChopWait) > (ChopWaitTime * 500)) then
begin
InitWait := 0;
end;
if(timefromMark(AxeFailSafeTime) > 500) then
begin
if(AxeFailSafeToggle = 0) then
begin
AxeFailSafe1 := p07_invCount;
AxeFailSafeToggle := 1;
end
else
begin
AxeFailSafe2 := p07_invcount;
AxeFailSafeToggle := 0;
if (AxeFailSafe2 = AxeFailSafe1) then
begin
AxeFailSafe := AxeFailSafe + 1;
end
else
begin
AxeFailSafe := 0;
end;
end;
MarkTime(AxeFailSafeTime);
end;
if(((CountColorTolerance(255, 220, 140, 300, 200, 2) + CountColorTolerance(65280, 230, 130, 280, 180, 2)) > 100) and (RunFromCombat = 1)) then
begin
Mouse(305, 174, random(10), random(10), true);
P07_FFlag;
wait (Lag);
if((CountColorTolerance(255, 220, 140, 300, 200, 2) + CountColorTolerance(65280, 230, 130, 280, 180, 2)) > 100) then
begin
GoToBank;
begin
OpenBank1;
BankLogs;
end;
GoToTrees;
end;
end;
if(not P07_TabInventoryTab(4)) then
begin
P07_TabInventoryTab(4)
end;
if(P07_InvFull) then
begin
GoToBank;
OpenBank1;
BankLogs;
GoToTrees;
end
else
begin
if(not isMoving1) then
begin
ChopTree;
end
else
begin
if((AxeFailSafe > ChopWaitTime) and (InitWait = 0)) then
begin
ChopTree;
end
else
begin
if(random(10) = 1) then
begin
MMouse(RandomRange(-100, 900), RandomRange(-100, 600), random(10), random(10));
end;
end;
end;
end;
until (Not P07_LoggedIn or (LocFailSafe > 25) or (AxeFailSafe > 100))
writeln(P07_LoggedIn);
writeln('LocFailSafe: ' + inttostr(LocFailSafe));
writeln('AxeFailSafe: ' + inttostr(AxeFailSafe));
TerminateScript;
end.