Code:
program WillowChopper;
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\Woodcutting.scar}
{.include SRL\SRL\Extended\xDTM.scar}
{.include SRL\SRL\Extended\xAntiBan.scar}
var
Ent:boolean;
ChopMark, DoDebug:integer;
const
WillowColor1=5535856;//The first willow color.
WillowColor2=3561552;//The second willow color.
WillowColor3=4489328;//The third willow color.
WaitTime=7;//time IN SECONDS that you want to wait before cutting another willow
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;//How many players are you running?
CurrentPlayer:= 0; // Which player you want to start with.
NumberOfPlayers(HowManyPlayers);
Players[0].Name := 'doomessenger';//Username of the player
Players[0].Pass := ''; //Password of the player
Players[0].Nick := 'mes'; //3 Lowercase Letters of your username
Players[0].Integer1:= 25; //Loads For Player
Players[0].Boolean1:= False; //Equip Axe?
Players[0].Active := True; //Is the player active?
end;
Function InBank:Boolean;
begin
Result:= FindColorSpiralTolerance(x,y,8091511,5,5,512,334,5)
end;
procedure DoomDebug(S:String);
begin
Case DoDebug Of
1:DisguiseScar(S);
2:Writeln(S);
3:Status(S);
4: Begin
DisguiseScar(S);
Writeln(S);
Status(S);
end;
end;
end;
procedure WalkToTrees;
begin
Mouse(626,126,4,4,true);
Flag;
end;
Function GetUpTextYellow:String;
Begin
Result := Trim(GetTextAtEx(7, 7, 140, upchars, true,
true, 0, 2, 1305063, 50, True, tr_AllChars));
End;
Function IsUpTextYellow(Text: String): Boolean;
Begin
Result := (Pos(Text, GetUpTextYellow) <> 0)
End;
Function CheckEnt(WhichTreeType:String):Boolean;
//results true if an ent is found.
begin
Case WhichTreeType Of
'willow' : begin
if(IsUpTextYellow(Capitalize(WhichTreeType)))then
begin
Result:=true;
Ent:=true;
end;
if(not(IsUpTextYellow(Capitalize(WhichTreeType))))then
begin
Result:=false;
Ent:=false;
end;
end;
end;
end;
Function CharmFindObject(var cx, cy: Integer; color1, color2, color3, tolerance: Integer): Boolean;
Var
x, y, a, c, i, x1, y1, x2, y2 : Integer;
Begin
If FindColorSpiralTolerance(x, y, Color1, MSX1, MSY1, MSX2, MSY2, Tolerance) or FindColorSpiralTolerance(x, y, Color2, MSX1, MSY1, MSX2, MSY2, Tolerance) or FindColorSpiralTolerance(x, y, Color3, MSX1, MSY1, MSX2, MSY2, Tolerance) Then
Begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
Repeat
If (not (Loggedin)) Then
break;
a := a + 1;
If (a = 1) Then
c := c + 1;
If (a = 3) Then
c := c + 1;
for i := 1 to c do
Begin
If (a = 1) Then
Begin
x1 := x1 + 30;
x2 := x2 + 30;
End;
If (a = 2) Then
Begin
y1 := y1 - 20;
y2 := y2 - 20;
End;
If (a = 3) Then
Begin
x1 := x1 - 30;
x2 := x2 - 30;
End;
If (a = 4) Then
Begin
y1 := y1 + 20;
y2 := y2 + 20;
End;
If (x1 = 485) and (x2 = 517) Then
x2 := x2 - 2;
If (y1 = 325) and (y2 = 345) Then
y2 := y2 - 7;
If (x2 > 515) Then
Break;
If (FindColorTolerance(x, y, color1, x1, y1, x2, y2, tolerance)) or
(FindColorTolerance(x, y, color2, x1, y1, x2, y2, tolerance)) or
(FindColorTolerance(x, y, color3, x1, y1, x2, y2, tolerance)) then
Begin
MMouse(x, y, 5, 5);
GetMousePos(x, y);
cx:= x;
cy:= y;
If (IsUpTextMulti('illow', 'low', 'own Will')) Then
Begin
If NOT(CheckEnt('Willow'))then
Begin
Mouse(MMCX, MMCY, 5, 5, True);
Wait(2000+Random(5000));
FindNormalRandoms;
EntsAvoided:= EntsAvoided + 1;
Break;
Result:= False;
End else
Begin
Result := True;
Break;
End
End;
End;
End;
If (a = 4) Then
a := 0;
Until (x2 > 515) or (Result = True);
End;
End;
Function ChopWillow:Boolean;
begin
If(Random(20) <=10)then
FindAxeHeadColor;
If(CharmFindObject(x,y,WillowColor1,WillowColor2,WillowColor3,15))then
Begin
Result:= True;
If(not(CheckEnt('Willow')))then
Begin
Status('Chopping');
If(Random(20) <= 10)then
Begin
Mouse(X, Y, 2, 2, True);
End
Else
Begin
Mouse(X, Y, 2, 3, False);
ChooseOption(x, y, 'hop down');
End
End
If(FlagPresent)then
Begin
Flag;
End
Wait(200-Random(50));
DoomDebug('CheckAxe');
FindAxeHeadColor;
MarkTime(ChopMark);
Repeat
If(not(LoggedIn))then Break;
DoomDebug('FindRandoms');
FindNormalRandoms;
If(InvFull)then Break;
until(TimeFromMark(ChopMark) >= (WaitTime*1000+Random(1000)))
end;
end;
procedure ChopAndBankLoop;
begin
//repeat
//if not LoggedIn or WeAreDead then break
If InBank Then
begin
MakeCompass('N');
WalkToTrees;
repeat
ChopWillow;
until(InvFull);
end;
end;
begin
SetupSRL;
DeclarePlayers;
ActivateClient;
GameTab(4);
ChopAndBankLoop;
end.