From: YoHoJo
Program YohojosPowerChopper;
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\woodcutting.scar}
{.include SRL/SRL/extended/xMapWalk.scar}
var
{->Tree Names / Up Text<-}
ObjTree1,ObjTree2,ObjTree3,TreeT,TreeT2:String;
{->Variables For Progess Report<-}
Cut,Loads:Integer;
{->DTMSt<-}
DTMLogs,Drop,Axe,Axehandle,Ent:Integer;
{->Random Letter Variables<-}
Q,Z,L,I,P,G:Integer;
{->Tree and Axe Colors<-}
TreeColor1,TreeColor2,TreeColor3,PlayerStart,WaitTawime,Tr,Ee:Integer;
{->Variables for Axe Procedures<-}
Handle,CHead,CHead2,CHead3,BrokenHead,FAxColor,AxeLocNum:Integer;
{->Time Variables<-}
Chop:Integer;
{->Color-}
TreeRef,Tolerance:Integer;
{->TPoints-<}
TreeColor:TPointArray;
{->Co-Ords-<}
CurrentPosX,CurrentPosY:integer;
TreeRef
//----------------------------------------------------------------------------//
//---> Players
//----------------------------------------------------------------------------//
Procedure DeclarePlayers;
begin
HowManyPlayers :=1; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=0;
Players[0].Name :=''; // Usernmae
Players[0].Pass :=''; // Password
Players[0].Nick :='joh'; // Few letters of username
Players[0].Active:=True; // Use char for this session
Players[0].WaitTime :=3; // Max wait (seconds) before clicking tree
Players[0].Integer1 :=1; //1=Normal 2=Oak 3=Willow 4=Maple 5=Yew 6=Magic
Players[0].Integer3 :=265228; //TreeColor
end;
Function FindTree(Click:Boolean):Boolean; ForWard;
Function RandomTreeColor:Integer; ForWard;
//----------------------------------------------------------------------------//
//---> Loads DTMs
//----------------------------------------------------------------------------//
Procedure Load;
begin
WriteLn('Loading DTMs and Bitmaps');
DTMLogs:= DTMFromString('78DA639CCAC4C0E0C1C8800A18914820BD08A' +
'8C695809A79403551F8D50000BF8402CF');
Axe:= DTMFromString('78DA63AC646260B8C18006189148209D0554F' +
'382809A5CA09A3704D45400D53C20A0A610A8E63A7E3500BDA806' +
'B6');
Axehandle := DTMFromString('78DA637CCFC4C0E0C6C8800CCA227819FE036' +
'990E87F2060FC06546389AA06220B2381F473A09A00026ADE00D5' +
'F81350F316A8C685809A97403541F8D50000D0090D3C');
BrokenHead := DTMFromString('78DA634C656060C86640038C4824900E05129' +
'504D4A4008974026A6281441A01351940220FBF1A00AA530412');
Drop := BitmapFromString(28, 2, 'z78DA737343000330307531353' +
'1317723421C5916BF5E08401687A8245EBD1B05EEC47421A97A89' +
'170700C40A5011');
Ent := DTMFromString('78DA636C63606078C68002EEDDBBCB2002A41' +
'981F83F1030CE0332DE41E458A16AEEDEBD035703028CEB81C463' +
'5435AF5E3E4155F310483C87B00561E6DC61649043520300AB3E1' +
'46C');
end;
//----------------------------------------------------------------------------//
//---> Axe Position and Colorfinding Procedures
//----------------------------------------------------------------------------//
Procedure GetAxeLoc;
Begin
WriteLn('Fining Axe');
If NoGameTab Then
Logout;
Gametab(4);
Wait(100+Random(300));
If FindDTM(Axe,q,z,551, 203,741, 464)then
Begin
AxeLocNum:=1
WriteLn('You axe is not equiped');
Exit;
end ;
begin
Gametab(5);
Wait(100+Random(300));
If FindDTM(Axe,q,z,MIX1, MIY1,MIX2, MIY2)then
Begin
AxeLocNum:=2;
WriteLn('You axe is equiped');
Exit;
end else
AxeLocNum:=3
Logout;
end;
end;
Procedure OpenAxeTab;
Begin
Writeln('Opening AxeTab');
Case AxeLocNum Of
1: GameTab(4);
2: GameTab(5);
end;
end;
Procedure ReportAxeProblem;
Begin
OpenAxeTab;
If FindDTM(AxeHandle,x,y,MIX1,MIY1,MIX2,MIY2) Then
Begin
WriteLn('Axe Head Missing')
end;
If FindDTM(BrokenHead,x,y,MIX1,MIY1,MIX2,MIY2) Then
Begin
WriteLn('Axe Head Broken')
Logout;
end;
end;
Procedure GetAxeColor;
begin
If (AxeLocNum=1)then
begin
WriteLn('Getting axe colors');
OpenAxeTab;
Wait(100+Random(100));
CHead:=GetColor(589, 221);
CHead2:=Getcolor(592, 221);
CHead3:=Getcolor(589, 218);
Handle:=Getcolor(580, 230);
Writeln('Axe colors are ' + inttostr(CHead) + ' ' + inttostr(CHead2) + ' ' + inttostr(CHead3));
End;
If (AxeLocNum=2)then
begin
WriteLn('Getting axe colors');
OpenAxeTab;
Wait(100+Random(100));
CHead:=GetColor(595, 295);
CHead2:=Getcolor(599, 297);
CHead3:=Getcolor(598, 295);
Handle:=Getcolor(589, 304);
Writeln('Axe colors are ' + inttostr(CHead) + ' ' + inttostr(CHead2) + ' ' + inttostr(CHead3));
end;
end;
Function HandleFound:Boolean;
Begin
If FindDTM(AxeHandle,x,y,MIX1,MIY1,MIX2,MIY2) Then
Begin
Result:=True;
end else
Begin
Result:=False;
Logout;
End;
end;
Function AxeColorsGone:Boolean;
Begin
Case AxeLocNum Of
1: Begin
OpenAxeTab;
Wait(200+Random(200));
If (Not(GetColor(589, 221)=CHead)) and
(Not(Getcolor(592, 221)=CHead2))and
(Not(Getcolor(589, 218)=CHead3))then
Result:=True;
end;
2:Begin
OpenAxeTab;
Wait(200+Random(200));
If (Not(GetColor(595, 295)=CHead)) and
(Not(Getcolor(599, 297)=CHead2))and
(Not(Getcolor(598, 295)=CHead3))then
Result:=True;
end;
end;
end;
Function AxeHeadGone:Boolean;
begin
OpenAxeTab;
Wait(200+RandoM(200));
If HandleFound and AxeColorsGone Then
Result:=True;
end;
Function AxeBroke:Boolean;
Begin
OpenAxeTab;
Wait(200+Random(200));
If FindDTM(BrokenHead,x,y,MIX1,MIY1,MIX2,MIY2) then
Begin
Result:=True;
Writeln('Im so sorry your axe is is broken')
Logout;
end;
end;
Function CheckAxeIfNeeded:Boolean;
Begin
WriteLn('Checking Axe, If Needed')
If IsChatMessage('You do not') Then
Begin
Result:=True;
WriteLn('Axe Head Missing Or Broken');
End else
Result:=False;
end;
Procedure GoneOrBroken;
Begin
For I:=1 To 2 Do
Case (I) Of
1:AxeBroke
2:Begin
If AxeHeadGone Then
Begin
AxeTalk;
FixAxeHead;
end;
Procedure AxeTalk;
Begin
Case Random (12)+1 of
0:TypeSend('ahh my axe broke');
1:TypeSend('lets see where did that head fly off to');
2:TypeSend('anyone see where my axe head fell?');
3:TypeSend('ugh i hope i find my axe head');
4:TypeSend('wow im so strong that my axe head flew off');
end;
end;
Function FindAxeHead:Boolean;
Begin
WriteLn('Searching For Axe Head');
L:=0;
For I:=1 To 3 Do
Begin
L:=L+1
Case L Of
1: FAxColor:=CHead;
2: FAxColor:=CHead2;
3: FAxColor:=CHead3;
end;
X:=MSCX;
Y:=MSCY;
For P:=0 To 5 Do
Begin
WriteLn('Trying Color ' + InttoStr(FAXColor)+ ' with a tol of ' + IntToStr(p));
If FindColorSpiralTolerance(x,y,FAxColor,MSX1,MSY1,MSX2,MSY2,P) Then
Begin
MMouse(x,y,2,2);
Wait(300+Random(700));
If IsUptext('Ta') Then
Begin
Mouse(x,y,0,0,False);
Wait(300+Random(300));
PopUp('Take');
Result:=True;
G:=1;
WriteLn('Axe Head Found');
end;
If (G=1) Then Exit;
end;
If G=1 Then Exit;
end;
If G=1 Then Exit;
end;
end;
Procedure AllAxeChekcs;
Begin
If CheckAxeIfNeeded Then
Begin
AxeTalk;
If GoneOrBroken=1 Then
Procedure CheckAndFix;
Begin
If CheckAxeIfNeeded Then
Begin
AxeTalk;
AxeBroke;
If AxeHeadGone Then FindAxeHead;
end;
end;
Procedure AxeCheckAndFix;
Begin
GetAxeLoc;
GetAxeColor;
CheckAndFix;
end;
//----------------------------------------------------------------------------//
//---> Random Finding Procedures
//----------------------------------------------------------------------------//
Function FindRandoms(FFight: Boolean; Direction: String) : Boolean;
begin
If FindNormalRandoms Then
Result:= True;
Writeln('Searching For Randoms')
if (FFight)then
begin
if(FindFight)then
begin
Result:= True;
RunAwayDirection(Direction);
Wait(8000+random(1000));
RunBack;
end;
end;
end;
Procedure AnteeTalk;
begin
case (Random(7)+1) of
1: TypeSend('this is kinda borring');
2: TypeSend('wc makes me prety good money');
3: TypeSend('sweet im about to level');
4: TypeSend('i love chopping '+(TreeT2)+'s');
5: TypeSend('wc levels?');
6: TypeSend('i like powerchopping its fast xp');
7: TypeSend('come on hit hit!');
end;
end;
Procedure AnteeBan;
begin
WriteLn('Doing antiban');
case (Random(80))of
5: AlmostLogout;
10: Hoverskill('Woodcut',False);
15: PickUpMouse;
20: RandomRClick;
25: AnteeTalk;
30: RandomRClick;
35: HoverSkill('Random',False);
40: PickUpMouse;
end;
end;
//----------------------------------------------------------------------------//
//---> Converts numbers from Consts into tree names
//---> AND
//---> Converts numbers from Consts into xp per tree
//----------------------------------------------------------------------------//
Procedure ConvertTree;
begin
WriteLn('Converting Trees');
Case Players[CurrentPlayer].Integer1 of
1: TreeT:='Chop down Tree';
2: TreeT:='Chop down Oak';
3: TreeT:='Chop down Willow';
4: TreeT:='Chop down Maple';
5: TreeT:='Chop down Yew';
6: TreeT:='Chop down Magic';
end;
end;
Procedure ConvertTree2;
begin
WriteLn('Converting Trees')
Case Players[CurrentPlayer].Integer1 of
1: TreeT2:='Tree';
2: TreeT2:='Oak';
3: TreeT2:='Willow';
4: TreeT2:='Maple';
5: TreeT2:='Yew';
6: TreeT2:='Magic';
end;
end;
Procedure ConvertTree3;
Begin
WriteLn('Converting Tree Name')
Case Players[CurrentPlayer].Integer1 of
1:Begin
ObjTree1:='Tree';
ObjTree2:='ree';
ObjTree3:='ee';
End;
2:Begin
ObjTree1:='Oak';
ObjTree2:='Oak';
ObjTree3:='ak';
End;
3:Begin
ObjTree1:='Willow';
ObjTree2:='illow';
ObjTree3:='llow';
End;
4:Begin
ObjTree1:='Maple';
ObjTree2:='aple';
ObjTree3:='ple';
End;
5:Begin
ObjTree1:='Yew';
ObjTree2:='Yew';
ObjTree3:='ew';
End;
6:Begin
ObjTree1:='Magic';
ObjTree2:='agic';
ObjTree3:='gic';
End;
end;
end;
Function GetTreeXp:extended;
begin
WriteLn('Converting Xp');
case Players[CurrentPlayer].Integer1 of
1: Result := 25;
2: Result := 37.5;
3: Result := 67.5;
4: Result := 100;
5: Result := 175;
6: Result := 250;
end;
end;
Procedure ConvertWaitTime;
Begin
WriteLn('Converting Player Wait Times');
WaitTawime:=( (Players[CurrentPlayer].WaitTime) * 1000);
Writeln('Wait time set to ' +IntToStr(WaitTawime))
end;
Procedure ConvertTreeColor;
Begin
WriteLn('Converting Tree Color');
TreeRef:=(Players[CurrentPlayer].Integer3);
end;
Procedure Convertall;
Begin
ConvertTree;
ConvertTree2;
GetTreeXp;
ConvertWaitTime;
ConvertTreeColor;
end;
//----------------------------------------------------------------------------//
//---> Ent Handleing Procedures
//----------------------------------------------------------------------------//
Procedure EntTalk;
Begin
Case Random(40) of
0:TypeSend('damn ent');
1:TypeSend('angry tree');
2:TypeSend('nobody chop that! it will break your axe');
3:TypeSend('the tree is spazzing');
4:TypeSend('ahhhhhhhhhhh! an ent...');
end;
end;
Function EntThere:Boolean;
begin
if IsUpTextMulti(ObjTree1,ObjTree2,ObjTree3)and
FindDTM(Ent,x,y,MSX1,MSY1,249, 21) or
FindColorSpiralTolerance(x,y,383705,MSX1,MSY1,233, 24,10) Then
Begin
Result:=True;
WriteLn('Ent Found')
end else
WriteLn('Ent Not Found')
end;
Procedure StandStill;
Begin
WriteLn('Ent Found, Standing Still');
MouseFindFlag(648,83,5,5);
Wait(15000+Random(5000));
end;
Procedure WaitForit;
var w:integer;
Begin
WriteLn('Waiting For Ent');
Repeat
FTWait(7000+Random(1000));
W:=W+1;
Until (W>7) or EntThere=False
end;
Procedure HandleEnt;
Begin
WriteLn('Handeling Ent');
StandStill;
Case Random (5) of
0:EntTalk;
end;
FindTree(False);
WaitForit;
end;
Function OnTree:Boolean;
Begin
If IsUpText(ObjTree1)or
IsUpText(ObjTree2)or
IsUpText(ObjTree3)Then
Begin
Result:=True;
WriteLn('On Tree Results True')
End Else
Writeln('On Tree Results False')
end;
Procedure CheckForEnt;
Begin
WriteLn('Looking for Ents');
If (Not(OnTree)) Then FindTree(False);
If (EntThere=True) Then
HandleEnt;
end;
//WhiteShadow's Function
Function ShortenArray(theArray : TPointArray; valueSelects : Integer) : TPointArray;
var
Size, i : Integer;
begin
Size:= getarraylength(theArray);
setarraylength(Result, valueSelects);
if(valueSelects > Size)then
begin
valueSelects:= Size;
setarraylength(Result, valueSelects);
end;
for i:= 0 to valueSelects - 1 do
begin
Result[i].x:= theArray[i].x;
Result[i].y:= theArray[i].y;
end;
end;
Function FindTree(Click:Boolean) : Boolean;
var
t : TPoint;
TempTreeArray : TPointArray;
treePoints, i: Integer;
begin
if(not(LoggedIn))then Exit;
t.x:= MSCX;
t.y:= MSCY;
Tolerance:=2;
FindColorsSpiralTolerance(t.x, t.y, TreeArray, RandomTreeColor, Msx1, Msy1, Msx2, Msy2, tolerance);
treePoints := getarraylength(treeArray);
TempTreeArray:= ShortenArray(TreeArray, 25);
for i:= 0 to getarraylength(TempTreeArray) - 1 do
begin
WriteLn('Try '+IntToStr(Tolerance/2) + 'Out of '+ IntToStr((getarraylength(TempTreeArray))-1) + 'to Find Tree')
MMouse(TempTreeArray[i].x, TempTreeArray[i].y, 5, 5);
Wait(350 + random(200));
if(IsUpTextMulti(ObjTree1,ObjTree2,ObjTree3))then
begin
Result:= true;
getmousepos(currentPosX, currentPosY);
If Click Then
Mouse(currentPosX,currentPosY,3,3,True)
Break;
end else
Begin
Tolerance:=Tolerance+2;
//Adding More Later;
end;
end;
end;
//----------------------------------------------------------------------------//
//---> Tree Fidning Procedure and Some autocolor
//----------------------------------------------------------------------------//
Procedure GetTreeColors;
var Times:Integer;
Begin
X:=MSCX;
Y:=MSCY;
Repeat
If FindColorSpiralTolerance(x,y,TreeRef,MSX1,MSY1,MSX2,MSY2,10) then
MMouse(x,y,5,5);
X:=X+15;
Y:=Y+15;
Times:=Times+1;
Wait(1000+RandoM(500));
WriteLn('Try '+(Inttostr(Times))+ ' to find tree out of 20');
Until(IsUpTextMulti(ObjTree1,ObjTree2,ObjTree3)) or (Times>20)
If (IsUpTextMulti(ObjTree1,ObjTree2,ObjTree3)) then
Begin
GetMousePos(x,y);
TreeColor[0]:=TreeRef;
TreeColor[1]:=GetColor(x,y);
TreeColor[2]:=GetColor(x+3,y+3);
TreeColor[3]:=GetColor(x-6,y-6);
WriteLn('Tree colors are ' + inttostr(TreeColor1) + ' ' + inttostr(TreeColor2) + ' ' + inttostr(TreeColor3));
end;
If (Times>20) then
begin
Logout;
Writeln('Cant Find The Tree');
end;
end;
Function RandomTreeColor:Integer;
Begin
Result:=TreeColor[Random(4)]
End;
Procedure ChopLoop;
Begin
FindTree(True);
Flag;
MarkTime(Chop)
QT:=0
Repeat
QT:=QT+1
CheckForEnt;
FindNormalRandoms;
AnteeBan;
CheckAndFix;
Until (TimeFromMark(Chop) > (WaitTawime)) or (QT>10);
end;
//----------------------------------------------------------------------------//
//---> Log Dropping Procedure
//----------------------------------------------------------------------------//
procedure DropLogs;
Begin
GameTab(4);
If InventoryFull then
Repeat
If(findDTM(dtmlogs,x,y,MIX1, MIY1,MIX2, MIY2))then
cut:=cut+1;
mouse(x,y,5,5,false);
Wait(200+Random(50));
if(FindBitmapToleranceIn(Drop,x,y,MIX1, MIY1,MIX2, MIY2,10))then
Mouse(x,y,5,3,true);
Wait(400+Random(100));
FindRandoms(True,'N');
FindNormalRandoms;
until(not(findDTM(dtmlogs,x,y,MIX1, MIY1,MIX2, MIY2))) or (Cut>28)
Loads:=Loads+1;
end;
//----------------------------------------------------------------------------//
//---> Progress Report
//----------------------------------------------------------------------------//
procedure ProgressReport;
begin
writeln('Yohojos Any Tree Anywhere Powercutter Progress Report');
if (cut>0)then writeln('You have cut ' +inttostr(cut)+' logs');
WriteLn(FloatToStr(GetTreeXp * cut));
writeln('You have worked for ' +ScriptTime2(2));
end;
//----------------------------------------------------------------------------//
//---> Loop
//----------------------------------------------------------------------------//
Procedure GetReady;
Begin
ActivateClient;
SetupSRL;
DeclarePlayers
BenMouse:=True;
Load;
Convertall;
AxeCheckAndFix;
GetTreeColors;
end;
Begin
GetReady
Repeat
ChopLoop;
DropLogs;
Until(False)
end.
YoHoJo sending me his old Woodcutter. I hardly remember him sending me this…
It hurts my eyes to read! Lol.