SRL Archive - RS3 Outdated / Broken Scripts

[Simba] Forest Exterminator


Bobzilla69

2010-09-26 15:14:40

Hi guys/girls,

make a woodcutting script for you all.

The script is made to work with Simba and S.M.A.R.T.

Its a full color script that is designed to cut Trees/Oaks/Willows and Yews at Draynor and bank the logs, it will auto detect tree to cut depending on your woodcutting level (i know willows give better exp)

it can also be used at just a specific tree type cutter if needed to.

Please post reports and problems

To-Do:
Axe upgrading based on woodcutting level or attack level.
Improve waitwhilechopping
Improve walking
any suggestions please post?

Bobzilla69

2010-09-26 15:16:39

Reserved for Reports

TomTuff

2010-09-26 15:26:49

From: bobzilla69
Reserved for Reports


1st =) can't wait to try this out, setting up 3 players at draynor!

Bobzilla69

2010-09-26 15:29:42

From: TomTuff
1st =) can't wait to try this out, setting up 3 players at draynor!


:) hope you like it, you should check out the auto detecting, i made a new account to test it all ready can cut willows only ran it for a few hours, 6 loads with re running enabled = win

TomTuff

2010-09-26 15:42:02

yeah the accs i'm about to run it with have 1 wc, so i just leave Strings[0] and Strings[1] blank correct?

Bobzilla69

2010-09-26 15:50:04

From: TomTuff
yeah the accs i'm about to run it with have 1 wc, so i just leave Strings[0] and Strings[1] blank correct?


just leave

Integers[2] := 0; // tahts the woodcutting level so 0 will mean it auto detects, if you put 10 it will only cut tree's
Strings[0] := ''; // that it tree type for the TPA to get colors

TomTuff

2010-09-26 15:51:59

ok an one thing, your 'function' fastclicker() should be a procedure, as because it doesn't return a result =)

Bobzilla69

2010-09-26 15:53:17

From: TomTuff
ok an one thing, your 'function' fastclicker() should be a procedure, as because it doesn't return a result =)


oh that, its not really suppose to be in here, its function i am working on :)

will remove and re-upload script

dhandley12

2010-09-26 16:38:01

Just wondering is there anywhere to input your bank pin in the script? thats the only thing I cant seem to find other than that your script worked great for me.

Bobzilla69

2010-09-26 16:48:50

From: dhandley12
Just wondering is there anywhere to input your bank pin in the script? thats the only thing I cant seem to find other than that your script worked great for me.


oh yeh, hehehe, forgot to add pin support.

thanks will add that to my list of things to do.

dhandley12

2010-09-26 17:16:32

no problem. Question can I just imput the pin code from a different script into this for it to work or is it more complex than that? I am not a scripter so I have no clue here.

Camaro'

2010-09-26 17:58:21

From: dhandley12
no problem. Question can I just imput the pin code from a different script into this for it to work or is it more complex than that? I am not a scripter so I have no clue here.


In the Bank function, right before it says
 if (BankScreen) then 

add this

 
if (PinScreen) then
InPin(Players[CurrentPlayers].Pin);

and in the declare players add this


Players[0].Pin := 5555;

Take note , I did not even download this script, nor open up simba so I am not sure if it compiles.

dhandley12

2010-09-26 18:11:05

I couldn't get it to work but i am not a scripter so it is probably my fault not yours. Thank you anyway.

dhandley12

2010-09-26 18:29:09

I couldn't get it to work but I am not a scripter so its probably my fault not yours. Thanks for trying to help ill just wait on bobzilla to finish it. :)

i luffs yeww

2010-09-26 21:37:29

[QUOTE=Camaro';739390]In the Bank function, right before it says
[scar] if (BankScreen) then [/scar]

add this

[scar]
if (PinScreen) then
InPin(Players[CurrentPlayers].Pin);
[/scar]

and in the declare players add this

[scar]
Players[0].Pin := 5555;
[/scar]

Take note , I did not even download this script, nor open up simba so I am not sure if it compiles.[/QUOTE]

You don't need to do most of that.. I don't know why everyone always adds so much for pin support..

All you need to do is add Players[xxx].Pin := '1234'; in DeclarePlayers (where xxx is the player number).

Camaro'

2010-09-26 22:12:48

I didn't know that, thanks.

Bobzilla69

2010-09-27 06:19:35

New version available V1.10

Improvements:

Improved walking
Added Pin support

From: i luffs yeww


All you need to do is add Players[xxx].Pin := '1234'; in DeclarePlayers (where xxx is the player number).


that might work for OpenBank(); srl versions, but i made my own open bank procedure so i need to add checking for pin screen and enter pin like Camaro said.

[QUOTE=Camaro';739390]In the Bank function, right before it says
[scar] if (BankScreen) then [/scar]

add this

[scar]
if (PinScreen) then
InPin(Players[CurrentPlayers].Pin);
[/scar]

and in the declare players add this

[scar]
Players[0].Pin := 5555;
[/scar]

Take note , I did not even download this script, nor open up simba so I am not sure if it compiles.[/QUOTE]

yes that basically what was needed, thanks for trying to help.

Camaro'

2010-09-27 20:39:54

Testing over night

dhandley12

2010-09-27 21:12:33

Script is running pretty nice for me right now except for the occasional error:
Error: Exception: The given DTM Index[0] doesn't exist at line 331
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Simba\Includes\SRL/logs/SRL log 27-09-10 3.txt] has not been freed in the script, freeing it now.
[Error] (54:3): Unknown identifier 'AddToReport' at line 53
Compiling failed.
[Hint] (788:3): Variable 'MARKT' never used at line 787

This error kills the script though and makes me have to restart it.:(

Bobzilla69

2010-09-28 03:40:46

From: dhandley12
Script is running pretty nice for me right now except for the occasional error:
Error: Exception: The given DTM Index[0] doesn't exist at line 331
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Simba\Includes\SRL/logs/SRL log 27-09-10 3.txt] has not been freed in the script, freeing it now.
[Error] (54:3): Unknown identifier 'AddToReport' at line 53
Compiling failed.
[Hint] (788:3): Variable 'MARKT' never used at line 787

This error kills the script though and makes me have to restart it.:(


thats interesting.

the only dtm i use is in line 720 (there abouts) for my banking, and it does get freed.

the AddToReport is in SRL so must be a problem in there, will have to look into that.

have you managed to get a load done or does it produce the error quickly?

edit: small update, adding FreeSRLBitmaps after doing findnormalrandom, i looked through the code and it didnt seem to free them after use. hopefully will help with script problem (i have yet to experiences the error)

BraK

2010-09-28 05:40:05

You still need those try adding it to terminate script instead. As it only loads them once. and is supposed to free them upon exiting the script.

E: Found the tut on it by Naum Here.

Bobzilla69

2010-09-28 05:51:35

From: BraK
You still need those try adding it to terminate script instead. As it only loads them once. and is supposed to free them upon exiting the script.


i am not sure i understand what you mean.

do i need terminate script at the end of the script once its completed?

BraK

2010-09-28 05:53:33

Terminate script basically is what you want it to do just before it terminates. See above post for link to tutorial by naum

Bobzilla69

2010-09-28 05:59:57

From: BraK
Terminate script basically is what you want it to do just before it terminates. See above post for link to tutorial by naum


ok i think i understand it now, something like


Procedure ScriptTerminate;
Begin
FreeSRLBitmaps; //makes sure bitmaps are freed before exiting
ProgressReport //post the last proggy
End;

BraK

2010-09-28 06:02:25

Exactly. I haven't really used it that much but that looks right.

Bobzilla69

2010-09-28 06:03:08

Ok, thanks for the information and link, will update script in a bit with it

Edit: New version is up.

Now includes Breaking
Waking tweaks
Added TerminateScript Procedure

dhandley12

2010-09-28 20:10:09

From: bobzilla69
thats interesting.

the only dtm i use is in line 720 (there abouts) for my banking, and it does get freed.

the AddToReport is in SRL so must be a problem in there, will have to look into that.

have you managed to get a load done or does it produce the error quickly?

edit: small update, adding FreeSRLBitmaps after doing findnormalrandom, i looked through the code and it didnt seem to free them after use. hopefully will help with script problem (i have yet to experiences the error)


I have gotten up to 12 loads done before and it randomly displays that error other times I only get halfway through a load. Could this be a problem with my computer not the script?

Also I have not tried the latest updates I will probably try them later tonight I just don't have time right down. I will give an update later for you and Bobzilla. Thank you for the help.

Edit: The actual problem causing the script to stop is that occasional it takes more than 4 attempts to find that bank. Thats what logs me out then I get the error I posted earlier afterwards.

eg:
Finding bank took longer that 4 attempts, logging out
Player not logged in Switching to next
Choosing Next Player

[============================================]
[ Forest Exterminator 1.20 ]
[ by Bobzilla69 ]
[============================================]
[ TimeRunning : 44 Minutes And 14 Seconds ]
[ Active Players : 0 ]
[============================================]
[ Forest Exterminator 1.20 ]
[============================================]
[=========================================================]
[ Nick | Active | Worked | Banked | Rand | Tree Cutting ]
[=========================================================]
[ tyr3 | False | 01:26:18 | 7 | | Willow ]
[=========================================================]

Please post bugs and report at http://villavu.com/forum/showthread.php?p=739347

Exception in Script: The given DTM Index[0] doesn't exist
File[C:\Simba\Includes\SRL/logs/SRL log 28-09-10 3.txt] has not been freed in the script, freeing it now.

Bobzilla69

2010-09-29 04:38:08

From: dhandley12
I have gotten up to 12 loads done before and it randomly displays that error other times I only get halfway through a load. Could this be a problem with my computer not the script?

Also I have not tried the latest updates I will probably try them later tonight I just don't have time right down. I will give an update later for you and Bobzilla. Thank you for the help.

Edit: The actual problem causing the script to stop is that occasional it takes more than 4 attempts to find that bank. Thats what logs me out then I get the error I posted earlier afterwards.

eg:
Finding bank took longer that 4 attempts, logging out
Player not logged in Switching to next
Choosing Next Player

[============================================]
[ Forest Exterminator 1.20 ]
[ by Bobzilla69 ]
[============================================]
[ TimeRunning : 44 Minutes And 14 Seconds ]
[ Active Players : 0 ]
[============================================]
[ Forest Exterminator 1.20 ]
[============================================]
[=========================================================]
[ Nick | Active | Worked | Banked | Rand | Tree Cutting ]
[=========================================================]
[ tyr3 | False | 01:26:18 | 7 | | Willow ]
[=========================================================]

Please post bugs and report at http://villavu.com/forum/showthread.php?p=739347

Exception in Script: The given DTM Index[0] doesn't exist
File[C:\Simba\Includes\SRL/logs/SRL log 28-09-10 3.txt] has not been freed in the script, freeing it now.


ok, thanks for all that.

i will check the banking and make some changes to it.

where you in the bank when it was looking for the bank booths?

Edit: New version out.

Increases bank searching to 5 attempts
Added SRL Banking Fail-safe (if my banking fails 5 times tries SRL OpenBank();

doublex8

2010-10-01 01:13:18

When you say yews in draynor are they the ones between draynor and lumby or the one thats west above port sarim?

Bobzilla69

2010-10-01 03:35:27

From: doublex8
When you say yews in draynor are they the ones between draynor and lumby or the one thats west above port sarim?


Its the single yew west, just pass the fence above the 4 willows

Dgby714

2010-10-01 09:16:07

Fixed Standards and Some Changes
program ForestExterminator;
{$DEFINE SMART}
{$I SRL\SRL.scar}
{$I SRL\SRL\misc\Reports.scar}
{$I SRL\SRL\misc\Debug.scar}

{=========================================================================]
[ ]
[ ]
[ NAME : Forest Exterminator ]
[ WRITER : Bobzilla69 ]
[ CATEGORY : Woodcutting ]
[ DESCRIPTION : Cuts Trees/Oaks/Willows and Yews ]
[ USAGE : Start in Draynor Bank, ]
[ with axe in inventory or equiped ]
[ NOTES : There can be a problem with all trees being ]
[ cut so it will log out due to not finding tree ]
[ CONTACT : PM me on SRL-Forums or post in thread ]
[ THANKS : I would like to Thank R!ch!e for exsplaining ]
[ his MineOre procedure from M!ne used in my ]
[ FindTreeTPA and CutTreeprocedure and ]
[ all other help R!ch!e provided. ]
[ Thanks to NCDS for helping me by suggesting ]
[ a TPA walking method ]
[ Thanks to BobboHobbo for giving me an idea ]
[ from your Draynor Willow cutter banker, used ]
[ Changed ischopping to suite me. ]
[ ]
[=========================================================================]
[ Instructions ]
[=========================================================================]
[ 1. Have character in Draynor bank with axe equiped or in inventory ]
[ 2. Fill out DeclarePlayers. ]
[ (For further instructions on how to fill it out, visit this thread: ]
[ [url]http://www.villavu.com/forum/showthread.php?t=5410[/url]) ]
[ 3. Designed to be used with SMART and Simba ]
[ 4. Start script and enjoy, dont forget to post a proggy! ]
[=========================================================================}

var
DebugTheTPA, DebugReport: boolean;


procedure DeclarePlayers;
var
I: integer;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

DebugTheTPA := False; //True if you want to see TPA debug
DebugReport := False; //This will include Debugs taken from script and incldude into proggress report(extending report alot) not recommended for long runs, only for 1-3 loads

with Players[0] do
begin
Name := ''; //Username
Pass := ''; //Password
Nick := ''; //3-4 non uppercase, number, or space characters on your username
Pin := ''; //Bank Pin (Blank if none)
Active := True; //Player Active?
Strings[0] := ''; //Tree that will be chopped (If blank will be AutoDetected)
Integers[0] := 1; //Loads to do
Booleans[0] := False; //Do Breaks?
Booleans[1] := False; //Rerun after Loads?
Integers[1] := 0; //Woodcutting Level (Use this if autodetection doesn't work!)
end;

{with Players[1] do
begin
Name := ''; //Username
Pass := ''; //Password
Nick := ''; //3-4 non uppercase, number, or space characters on your username
Pin := ''; //Bank Pin (Blank if none)
Active := True; //Player Active?
Strings[0] := ''; //Tree that will be chopped (If blank will be AutoDetected)
Integers[0] := 1; //Loads to do
Booleans[0] := False; //Do Breaks?
Booleans[1] := False; //Rerun after Loads?
Integers[1] := 0; //Woodcutting Level (Use this if autodetection doesn't work!)
end;}

for I := 0 to HowManyPlayers - 1 do
with Players[I] do
begin
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
Strings[1] := '';
Banked := 0;
Worked := 0;
end;
end;

{------------------------------------end of setup------------------------------}

type
TTree = record
Col, Tol, Cut, Light: Integer;
HMod, SMod: Extended;
UpText: TStringArray;
Tree: string;
end;

var
Working: integer;
x, y: integer;
LoadsDone: boolean;

//auto colors a selection of items
function MyFindColor(What: string; Where:boolean): integer; //on minimap(true) or main screen (false)
var
I, J, TheColor, Red, Green, Blue, color,
bL, bH, gL, gH, rL, rH, colTol: integer;
colorArray: TPointArray;
begin
case lowercase(What) of
'bank': begin
color := 5533565;
bL := 77;
bH := 91;
gL := 104;
gH := 117;
rL := 118;
rH := 131;
colTol:= 11; //use to alter tollerance
end;
'stall': begin
color := 6184290;
bL := 89;
bH := 98;
gL := 89;
gH := 97;
rL := 93;
rH := 102;
colTol:= 7; //use to alter tollerance
end;
'water': begin
color := 10983825;
bL := 162;
bH := 171;
gL := 148;
gH := 158;
rL := 140;
rH := 149;
colTol:= 7; //use to alter tollerance
end;
'road': begin
color := 7237234;
bL := 105;
bH := 115;
gL := 106;
gH := 113;
rL := 109;
rH := 118;
colTol:= 7;
end;
'rock': begin
color := 5855833;
bL := 85;
bH := 93;
gL := 86;
gH := 94;
rL := 85;
rH := 93;
colTol:= 6;
end;
end;
Result := 0;

if Where then
FindColorsTolerance(colorArray, color, MMX1, MMY1, MMX2, MMY2, colTol)
else
FindColorsTolerance(colorArray, color, MSX1, MSY1, MSX2, MSY2, colTol);

J := High(colorArray);
for I := 0 to J do
if ((rs_OnMinimap(colorArray[I].x, colorArray[I].y)) or (not (Where))) then
begin
TheColor := GetColor(colorArray[i].x, colorArray[i].y);
ColorToRGB(TheColor, Red, Green, Blue);
if (InRange(Blue, bL, bH) and InRange(Green, gL, gH) and InRange(Red, rL, rH)) then
begin
Result := TheColor;
WriteLn(What + ' Colour Found: ' + IntToStr(TheColor));
Exit;
end;
end;
end;

procedure Write(WhatsHappening: string); //idea from M!ne by R!ch!e
begin
Writeln(WhatsHappening);
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + WhatsHappening + #13#10;
end;

procedure LogoutWhy(Why: string); //idea from BobboHobbo script
begin
Write(Why);
//Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + Why + #13#10;
Players[CurrentPlayer].Active := False; //Set player inactive
Logout;
end;

function SetupTree: TTree;
begin
case Lowercase(Players[CurrentPlayer].Strings[0]) of
'tree': begin
with Result do //Loads tree into Result: TTree;
begin
Col := 4025442; //Colour
Tol := 5; //Tolerance
Cut := 8000; //Cut Time (This should not be here.... Use a function to detect cutting)
Light := 8000; //Light Time (Nether should this... Same as above)
HMod := 0.04; //Hue
SMod := 1.57; //Saturation
UpText := ['hop down Tree', 'own Tree', 'ree']; //Uptext
Tree := 'Tree'; //Name of Tree
end;
end;
'oak': begin
with Result do
begin
Col := 6202005;
Tol := 5;
Cut := 15000;
Light := 8000;
HMod := 0.10;
SMod := 1.58;
UpText := ['hop down Oak', 'own Oak', 'ak'];
Tree := 'Oak';
end;
end;
'willow': begin
with Result do
begin
Col := 4088154;
Tol := 4;
Cut := 20000;
Light := 8000;
HMod := 0.25;
SMod := 1.57;
UpText := ['hop down Willow', 'own Willow', 'illow'];
Tree := 'Willow';
end;
end;
'yew': begin
with Result do
begin
Col := 6070418;
Tol := 10;
Cut := 30000;
Light := 8000;
HMod := 0.13;
SMod := 0.12;
UpText := ['hop down Yew', 'own Yew', 'ew'];
Tree := 'Yew';
end;
end;
end;
end;

function LoadDTM(What: string): string;
begin
case LowerCase(What) of
'log': Result := 'mggAAAHicY2NgYBCEYhkglgBiNijmhdIcQCwOleMB4gQPLSDJhIFTGLADRhwYAgCmhgIF'; //logs (max tolerance)
'braxe': Result := 'mbQAAAHicY2VgYNBkYWBQBmIDINYFYnUgnsPIwDAbiOcB8SIgng/E9gYyQNVMKJiLARMwYsFgAABuXQSn'; //bronze axe
'iaxe': Result := 'mggAAAHicY2NgYLBjYmBwAGIXIHYGYmsgNgfit0C5V0D8Bog/APF7IH4NxJbm5kCSCQOzMmAHjDgwBAAA6D8H0w=='; //iron axe
'blaxe': Result := 'mggAAAHicdcrbCgAQFETRQy6hk1Lk/7/ULt6wa83TBBFpKOiYGKgI8HCI55Ogqqy9ZHlnPnYLVU8A4Q=='; //black axe
'saxe': Result := 'mggAAAHicY2NgYNAGYl0gNgRiPSBWB2IVII4F4igonQTE8UAcDcThIcFAkgkDczFgB4w4MAQAAJOfBFE='; //steel axe
'maxe': Result := 'mggAAAHicY2NgYFgOxAuAeBUQr4XSS4CYDYhZgZgFiNmBmAeIOYHY0NATSDJhYC4G7IARB4YAABIJBOM='; //mithril axe
'aaxe': Result := 'mggAAAHicY2NgYDABYh0gNgdiSyhtAMRsQMwKxCxAzA7E3EDMCZK3B6lgwsAgtdgAIw4MAQDXOwIq'; //adamant axe
'raxe': Result := 'mggAAAHicY2NgYDgFxIeB+BwQXwDis0B8HIjZgJgViFmAmAOIeYCYE4itPfyAJBMG5mLADhhxYAgAAH10Bd0='; //rune axe
end;
end;

procedure ProgressReport;
var
I :integer;
begin
Writeln(#13#10);
SRLProgressReport(ResultDebugBox, 'Forest Exterminator', 'Bobzilla69', '1.25',
['TimeRunning', 'Active Players'],
[TimeRunning, PlayersActive]);
SRLPlayerReport(ResultDebugBox, 0, false, [True, True, false, false, false, true], ['Tree Cutting'], [], [], [0], [] );
Writeln(#13#10'Please post bugs and report at [url]http://villavu.com/forum/showthread.php?p=739347'#13#10);[/url]
if (DebugReport) then
begin
for I := 0 to (HowManyPlayers - 1) do
begin
if (not (Players[I].Strings[1] = '')) then
begin
WriteLn(Players[I].Nick + #13#10'Debug of what happened'#13#10);
WriteLn(Players[I].Strings[1]);
end;
end;
end
end;

procedure ScriptTerminate;
begin
FreeSRLBitmaps;
ProgressReport;
end;

procedure CheckLevels;
begin
Wait(200);
if (not (LoggedIn)) then
Exit;

if (Players[CurrentPlayer].Integers[1] = 0) then
Players[CurrentPlayer].Integers[1] := GetSkillInfo('woodcutting', True);

case (Players[CurrentPlayer].Integers[1]) of
1..14: Players[CurrentPlayer].Strings[0] := 'Tree';
15..29: Players[CurrentPlayer].Strings[0] := 'Oak';
30..59: Players[CurrentPlayer].Strings[0] := 'Willow';
60..99: Players[CurrentPlayer].Strings[0] := 'Yew';
end;
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + Players[CurrentPlayer].Strings[0] +' was auto detected to be trained on.'#13#10;
end;

procedure CheckLogged;
var
breakFor: integer;
begin
if (PlayersActive >= 1) then
begin
if (Players[CurrentPlayer].Integers[1] = 0) then
Exit;
Logout;
if (Players[CurrentPlayer].Booleans[0]) then
begin
breakFor := 240000 + RandomRange(90000, 150000);
Write('Taking Break for: ' + MsToTime(breakFor, Time_Short));
Wait(breakFor);
end;
end;

if (LoadsDone) then
begin
LoadsDone := False;
Exit;
end;

if (not (LoggedIn)) then
begin
Write('Player not logged in Switching to next');
Write('Choosing Next Player');
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + 'Player Failed, Please Post Proggress report and location logged out'#13#10;
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(working);
Players[CurrentPlayer].Active := False;
Logout;
end;
end;

procedure AntiBan;
var
MousePos: TPoint;
begin
FindNormalRandoms;
GetMousePos(MousePos.x, MousePos.y);

case random(100) of //30% chance something will happen
0..5: PickupMouse;
10..15: HoverSkill('random', False);
20..25: GameTab(RandomRange(tab_Combat, tab_Notes));
30..35: Wait(500 + Random(1500));
40..45: RandomAngle(1);
50..55: BoredHuman;
end;

GameTab(Tab_Inv);
MMouse(MousePos.x, MousePos.y, 2, 2);
end;

procedure WalkToBank;
var
MiddleOfTPA: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
TreeSetup: TTree;
begin
if (not (LoggedIn)) then
Exit;
TreeSetup := SetupTree;
Write('Walking to Bank from: ' + TreeSetup.Tree + '.');
case LowerCase(TreeSetup.Tree) of
'tree': begin
//at trees, loking for rock at top right hand side. shoudl walk to above pen
if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 360, 5, 45, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
if (DebugTheTPA) then
DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x - 10 , MiddleOfTPA.y + 55, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//try to use stalls to place you near bank
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 140, 240, 40, 70, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
begin
MiddleOfTPA := MiddleTPA(TPA);
if (DebugTheTPA) then
DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 210, 35, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
if (DebugTheTPA) then
DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -3, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
FFlag(5);
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;
end;
'oak': begin
MakeCompass('N');
//use rocks and offsetting to end up near pen
if FindColorsTolerance(TPA, MyFindColor('rock', True), MMCX, MMY1, MMX2, MMCY, 15)then
begin
ATPA := SplitTPAEx(TPA, 8, 8);
SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
MiddleTPAEx(ATPA[0], x , y);
Mouse(x + 30, y + 46, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
Wait(3000);
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//Stalls Middle to bank
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 90, 230, 5, 55, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 210, 40, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -5, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
FFlag(5);
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;
end;
'willow': begin
MakeCompass('N');
if FindColorsPie(TPA, 1179390, 15, 0, 60, 30, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -3, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
FFlag(5);
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;
end;
'yew': begin
MakeCompass('N');
if FindColorsPie(TPA, MyFindColor('rock', True), 15, 60, 180, 30, 60, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 15, MiddleOfTPA.y , 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//use rocks and offsetting to end up near pen
if FindColorsTolerance(TPA, MyFindColor('rock', True), mmcx, mmy1, mmx2, mmcy, 15)then
begin
ATPA := SplitTPAEx(TPA, 8, 8);
SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
MiddleTPAEx(ATPA[0], x , y);
Mouse(x + 30, y + 46, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
Wait(3000); //in case flag go off map
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//Stalls Middle to bank
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 90, 230, 5, 55, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;

//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 210, 40, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -5, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 4 Complete');
FFlag(5);
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 4, Logging out...');
Exit;
end;
end;
end;
Wait(500 + Random(500)); //screen settle
Write('Walking to bank from: ' + TreeSetup.Tree + ' Complete.');
end;

procedure WalkToTrees;
var
MiddleOfTPA: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
TreeSetup: TTree;
begin
if (not (LoggedIn)) then
Exit;

TreeSetup := SetupTree;
Write('Walking to tree: ' + TreeSetup.Tree);
case Lowercase(TreeSetup.Tree) of
'tree': begin
MakeCompass('N');
//from bank to middle of stalls
if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//at stalls uses middle of stalls and offset to walk behind to pen
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;
end;
'oak': begin
MakeCompass('N');
//from bank to middle of stalls
if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//at stalls uses middle of stalls and offset to walk behind to pen
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//rock near oak's to walk to oak's
if FindColorsTolerance(TPA, MyFindColor('rock', True), MMX1, MMY1, MMCX, MMCY, 15)then
begin
ATPA := SplitTPAEx(TPA, 8, 8);
SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
MiddleTPAEx(ATPA[0], x , y);
Mouse(x - 22, y + 24, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 3 Complete');
Wait(3000); //in case flag go off map
Flag;
Write('Walking Complete');
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;
end;
'willow': begin
MakeCompass('S');
if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 60, 50, 80, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 25, MiddleOfTPA.y + 15, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;
end;
'yew': begin
MakeCompass('N');
//from bank to middle of stalls
if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//at stalls uses middle of stalls and offset to walk behind to pen
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//rock near oak's to walk to oak's
if FindColorsTolerance(TPA, MyFindColor('rock', True), MMX1, MMY1, MMCX, MMCY, 15)then
begin
ATPA := SplitTPAEx(TPA, 8, 8);
SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
MiddleTPAEx(ATPA[0], x , y);
Mouse(x - 22, y + 24, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 3 Complete');
Wait(3000); //in case flag go off map
Flag;
Write('Walking Complete');
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;
end;
end;
Wait(500 + Random(500));
Write('Walking to tree: ' + TreeSetup.Tree + ' Complete.');
end;

Function MyOpenBank: boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, J: integer;
begin
Result := BankScreen;
if (Result) then
Exit;
MakeCompass('W');
Wait(300);
FindColorsTolerance(TPA, MyFindColor('bank', False), MSX1, MSY1, MSX2, MSCY, 5);
ATPA := SplitTPAEx(TPA, 10, 10);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
J := High(ATPA);
for I := 0 to J do //from 0 first entry in array to highest entry in ATPA
begin
MiddleTPAEx(ATPA[I], x, y); //find middle of array entry
MMouse(x, y, 2, 2);
if WaitUpTextMulti(['ooth', 'ank booth'], 400) then
begin
Mouse(x, y, 0, 0, False);
Wait(200);
WaitOption('uickl', 400);
Flag;
Wait(2000 + Random(800));

if (PinScreen) then
begin
InPin(Players[CurrentPlayer].Pin);
Wait(100);
end;

Result := BankScreen;
end;
end;
end;

procedure BankIt;
var
BankLoop, DTM: integer;
begin
if (not (LoggedIn)) then
Exit;

BankLoop := 0;
repeat
Wait(300);
Inc(BankLoop);
until((BankLoop > 5) or (MyOpenBank))

if (not (BankScreen)) then
OpenBank('db', True, False);

if ((BankLoop >= 5) or (not (BankScreen))) then
begin
LogoutWhy('Finding bank took more that 5 attempts, logging out');
Exit;
end;

DTM := DTMFromString(LoadDTM('log'));
try
if FindDTM(DTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, False);
ChooseOption('All'); //ChooseOption('All '+TreeSetup.Tree);
Wait(1500 + Random(500)); //incase of lagg
end else
LogoutWhy('Logs not found in inventory logging out');
finally
FreeDTM(DTM);
end;

Inc(Players[CurrentPlayer].Banked);
CloseBank;
MakeCompass('N');
SetAngle(True);
end;

procedure WeStillChopping; //idea from BH - Draynor Willow Cutter
var
T, CutTime, ChopX, ChopY: integer;
TreeSetup: TTree;
begin
Flag;
Wait(200 +Random(200)); //allows player more time to reach tree after flag disapears
GetMousePos(ChopX, ChopY);

if ((not (LoggedIn)) or (Invfull)) then
Exit;

TreeSetup := SetupTree;
T := GetSystemTime;
CutTime := TreeSetup.Cut + Random(10000); //how long to cut for
MMouse(ChopX, ChopY, 2, 2);
Write('Chopping Tree started');
repeat
if (not (FindBlackChatMessage('swing your hatchet'))) then //if not this the w cut logs, so we do uptext check
if (not (IsUpTextMultiCustom(TreeSetup.UpText))) then //if no uptext then we might have cut tree
Break;

Wait(500 + random(200));

if (Invfull) then
Break;

Antiban;
until ((GetSystemTime - T > CutTime) or (not LoggedIn)) //exit repeat if we reach cut time

FindNormalRandoms;

if (GetSystemTime - T > CutTime) then
Writeln('Took longer then ' + IntToStr(CutTime) + ' to chop down the tree.');

if (not (LoggedIn)) then
Writeln('Player not logged in');

if (Invfull) then
WriteLn('Invfull starting banking');
end;

function CutTreesTPA: Boolean; //Thanks to R!ch!e for explaining this. This is a mix of R!ch!e's M!ne MineOre Procedure and BH Draynor Willow Cutter FindWillowTPA
var
I, J: Integer;
TreeTPA: TPointArray;
TreeATPA: T2dPointArray;
TreeSetup: TTree;
begin
if (not (LoggedIn)) then
Exit;

TreeSetup := SetupTree;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(TreeSetup.HMod, TreeSetup.SMod);

try
Write('Attempting to Find ' + TreeSetup.Tree);
FindColorsSpiralTolerance(MSCX, MSCY, TreeTPA, TreeSetup.Col, MSX1, MSY1, MSX2, MSY2, TreeSetup.Tol);
TreeATPA := SplitTPAEx(TreeTPA, 12, 12); //TPAtoATPAex( 20, 20)
if (DebugTheTPA) then
begin
DebugATPABounds(TreeATPA);
Wait(2000);
end;

if (Length(TreeATPA) = 0) then
Exit;

SortATPAFromFirstPoint(TreeATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point

if (DebugTheTPA) then
begin
Write('ATPA After Sort');
DebugATPA(TreeATPA, '');
end;

J := High(TreeATPA);
for I := 0 to J do //from 0 first entry in array to J highest entry
begin
MiddleTPAEx(TreeATPA[I], x, y);//find middle of array entry
MMouse(x, y, 3, 3);
Wait(300);
if WaitUpTextMulti(TreeSetup.UpText, 400) then
begin
Mouse(x, y, 0, 0, True);
Flag;
Result := True;
Exit;
Wait(500 + Random(1500));
end;
end;
FindNormalRandoms;
finally
SetColorSpeed2Modifiers(0.2, 0.2); // Sets the modifiers back to default, (0.2, 0.2).
ColorToleranceSpeed(1); // Sets the CTS back to the default, 1.
end;
end;

procedure CutTrees; //Thanks to R!ch!e for explaining procedure.
var
Fail: Integer;
TreeSetup: TTree;
begin
if (not (LoggedIn)) then
Exit;
TreeSetup := SetupTree;
Write('Attempting to Cut ' + TreeSetup.Tree);
repeat
if (not (CutTreesTPA)) then
begin
Write('Could not find tree Trying Failsafe Finder');
if FindObj(x, y, TreeSetup.Tree, TreeSetup.Col, TreeSetup.Tol) then //use normal find object function as failsafe
begin
Write('Found ' + TreeSetup.Tree + ' using FindObj');
Mouse(x, y, 0, 0, True);
end else
begin
Write('Could not find ' + TreeSetup.Tree + ' using Colour or FindObj ');
Inc(Fail); //failsafe so ther is no infinate loop, after 15 fails script terminates
Wait(1500 + Random(500)) //incase all trees are cut down ,otherwise its instant failsafe activation (increase if hight population of cutters)
if (Fail > 15) then
begin
Write('Script failed to find ' + TreeSetup.Tree);
Write('Even after 15 attempts');
Fail := 0; //Resetting for next player
LogoutWhy('Could not find tree');
end;
end;
end;
WeStillChopping;
until((InvFull) or (not LoggedIn));

if InvFull then
Write('Inventory Full Banking');
end;

procedure TreeCutting;
begin
if (not (LoggedIn)) then
Exit;

repeat
WalkToTrees;
CutTrees;
WalkToBank;
BankIt;
until (Players[CurrentPlayer].Banked >= (Players[CurrentPlayer].Integers[0])) or (not (LoggedIn));

if (Players[CurrentPlayer].Banked >= Players[CurrentPlayer].Integers[0]) then
begin
LoadsDone := True;
Write(Players[CurrentPlayer].Name + ' has finished: ' + IntToStr(Players[CurrentPlayer].Integers[0]) + ' Loads');
end;
end;

procedure PlayerDone;
begin
if (not (LoggedIn)) then
Exit;

if (LoadsDone) then
begin
Write('All Logs have been cut Switching Players.');
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(Working);
//ProgressReport;
if (not (Players[CurrentPlayer].Booleans[1])) then
begin
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + 'Player not set to attempt a re-run logging out'#13#10;
Players[CurrentPlayer].Active := False;
Logout;
end else
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1]+'Re-Run set to true, will attempt another run'#13#10;
Write('Progress Report');
ProgressReport;
end;
end;

procedure Main;
begin
repeat
LoginPlayer;
Wait(500);
MarkTime(Working);
CheckLevels;
WriteLn('Woodcutting Level: ' + IntToStr(Players[CurrentPlayer].Integers[1]));
WriteLn('Recommended training is ' + Players[CurrentPlayer].Strings[0]);
SetupTree;
Wait(500);
SetAngle(True);
TreeCutting;
PlayerDone;
CheckLogged;
until(AllPlayersInactive)
end;

procedure Setup;
begin
SetUpSRL;
DeclarePlayers;
end;

begin
Setup;
Wait(1000);
Main;
ProgressReport;
end.

doublex8

2010-10-01 09:47:58

From: bobzilla69
Its the single yew west, just pass the fence above the 4 willows


Is it a big no-no to use the ones to the east? I can't seem to find a WC script that supports those.

Bobzilla69

2010-10-01 10:58:38

From: Dgby714
Fixed Standards and Some Changes
program ForestExterminator;
{$DEFINE SMART}
{$I SRL\SRL.scar}
{$I SRL\SRL\misc\Reports.scar}
{$I SRL\SRL\misc\Debug.scar}

{=========================================================================]
[ ]
[ ]
[ NAME : Forest Exterminator ]
[ WRITER : Bobzilla69 ]
[ CATEGORY : Woodcutting ]
[ DESCRIPTION : Cuts Trees/Oaks/Willows and Yews ]
[ USAGE : Start in Draynor Bank, ]
[ with axe in inventory or equiped ]
[ NOTES : There can be a problem with all trees being ]
[ cut so it will log out due to not finding tree ]
[ CONTACT : PM me on SRL-Forums or post in thread ]
[ THANKS : I would like to Thank R!ch!e for exsplaining ]
[ his MineOre procedure from M!ne used in my ]
[ FindTreeTPA and CutTreeprocedure and ]
[ all other help R!ch!e provided. ]
[ Thanks to NCDS for helping me by suggesting ]
[ a TPA walking method ]
[ Thanks to BobboHobbo for giving me an idea ]
[ from your Draynor Willow cutter banker, used ]
[ Changed ischopping to suite me. ]
[ ]
[=========================================================================]
[ Instructions ]
[=========================================================================]
[ 1. Have character in Draynor bank with axe equiped or in inventory ]
[ 2. Fill out DeclarePlayers. ]
[ (For further instructions on how to fill it out, visit this thread: ]
[ [url]http://www.villavu.com/forum/showthread.php?t=5410[/url]) ]
[ 3. Designed to be used with SMART and Simba ]
[ 4. Start script and enjoy, dont forget to post a proggy! ]
[=========================================================================}

var
DebugTheTPA, DebugReport: boolean;


procedure DeclarePlayers;
var
I: integer;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

DebugTheTPA := False; //True if you want to see TPA debug
DebugReport := False; //This will include Debugs taken from script and incldude into proggress report(extending report alot) not recommended for long runs, only for 1-3 loads

with Players[0] do
begin
Name := ''; //Username
Pass := ''; //Password
Nick := ''; //3-4 non uppercase, number, or space characters on your username
Pin := ''; //Bank Pin (Blank if none)
Active := True; //Player Active?
Strings[0] := ''; //Tree that will be chopped (If blank will be AutoDetected)
Integers[0] := 1; //Loads to do
Booleans[0] := False; //Do Breaks?
Booleans[1] := False; //Rerun after Loads?
Integers[1] := 0; //Woodcutting Level (Use this if autodetection doesn't work!)
end;

{with Players[1] do
begin
Name := ''; //Username
Pass := ''; //Password
Nick := ''; //3-4 non uppercase, number, or space characters on your username
Pin := ''; //Bank Pin (Blank if none)
Active := True; //Player Active?
Strings[0] := ''; //Tree that will be chopped (If blank will be AutoDetected)
Integers[0] := 1; //Loads to do
Booleans[0] := False; //Do Breaks?
Booleans[1] := False; //Rerun after Loads?
Integers[1] := 0; //Woodcutting Level (Use this if autodetection doesn't work!)
end;}

for I := 0 to HowManyPlayers - 1 do
with Players[I] do
begin
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
Strings[1] := '';
Banked := 0;
Worked := 0;
end;
end;

{------------------------------------end of setup------------------------------}

type
TTree = record
Col, Tol, Cut, Light: Integer;
HMod, SMod: Extended;
UpText: TStringArray;
Tree: string;
end;

var
Working: integer;
x, y: integer;
LoadsDone: boolean;

//auto colors a selection of items
function MyFindColor(What: string; Where:boolean): integer; //on minimap(true) or main screen (false)
var
I, J, TheColor, Red, Green, Blue, color,
bL, bH, gL, gH, rL, rH, colTol: integer;
colorArray: TPointArray;
begin
case lowercase(What) of
'bank': begin
color := 5533565;
bL := 77;
bH := 91;
gL := 104;
gH := 117;
rL := 118;
rH := 131;
colTol:= 11; //use to alter tollerance
end;
'stall': begin
color := 6184290;
bL := 89;
bH := 98;
gL := 89;
gH := 97;
rL := 93;
rH := 102;
colTol:= 7; //use to alter tollerance
end;
'water': begin
color := 10983825;
bL := 162;
bH := 171;
gL := 148;
gH := 158;
rL := 140;
rH := 149;
colTol:= 7; //use to alter tollerance
end;
'road': begin
color := 7237234;
bL := 105;
bH := 115;
gL := 106;
gH := 113;
rL := 109;
rH := 118;
colTol:= 7;
end;
'rock': begin
color := 5855833;
bL := 85;
bH := 93;
gL := 86;
gH := 94;
rL := 85;
rH := 93;
colTol:= 6;
end;
end;
Result := 0;

if Where then
FindColorsTolerance(colorArray, color, MMX1, MMY1, MMX2, MMY2, colTol)
else
FindColorsTolerance(colorArray, color, MSX1, MSY1, MSX2, MSY2, colTol);

J := High(colorArray);
for I := 0 to J do
if ((rs_OnMinimap(colorArray[I].x, colorArray[I].y)) or (not (Where))) then
begin
TheColor := GetColor(colorArray[i].x, colorArray[i].y);
ColorToRGB(TheColor, Red, Green, Blue);
if (InRange(Blue, bL, bH) and InRange(Green, gL, gH) and InRange(Red, rL, rH)) then
begin
Result := TheColor;
WriteLn(What + ' Colour Found: ' + IntToStr(TheColor));
Exit;
end;
end;
end;

procedure Write(WhatsHappening: string); //idea from M!ne by R!ch!e
begin
Writeln(WhatsHappening);
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + WhatsHappening + #13#10;
end;

procedure LogoutWhy(Why: string); //idea from BobboHobbo script
begin
Write(Why);
//Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + Why + #13#10;
Players[CurrentPlayer].Active := False; //Set player inactive
Logout;
end;

function SetupTree: TTree;
begin
case Lowercase(Players[CurrentPlayer].Strings[0]) of
'tree': begin
with Result do //Loads tree into Result: TTree;
begin
Col := 4025442; //Colour
Tol := 5; //Tolerance
Cut := 8000; //Cut Time (This should not be here.... Use a function to detect cutting)
Light := 8000; //Light Time (Nether should this... Same as above)
HMod := 0.04; //Hue
SMod := 1.57; //Saturation
UpText := ['hop down Tree', 'own Tree', 'ree']; //Uptext
Tree := 'Tree'; //Name of Tree
end;
end;
'oak': begin
with Result do
begin
Col := 6202005;
Tol := 5;
Cut := 15000;
Light := 8000;
HMod := 0.10;
SMod := 1.58;
UpText := ['hop down Oak', 'own Oak', 'ak'];
Tree := 'Oak';
end;
end;
'willow': begin
with Result do
begin
Col := 4088154;
Tol := 4;
Cut := 20000;
Light := 8000;
HMod := 0.25;
SMod := 1.57;
UpText := ['hop down Willow', 'own Willow', 'illow'];
Tree := 'Willow';
end;
end;
'yew': begin
with Result do
begin
Col := 6070418;
Tol := 10;
Cut := 30000;
Light := 8000;
HMod := 0.13;
SMod := 0.12;
UpText := ['hop down Yew', 'own Yew', 'ew'];
Tree := 'Yew';
end;
end;
end;
end;

function LoadDTM(What: string): string;
begin
case LowerCase(What) of
'log': Result := 'mggAAAHicY2NgYBCEYhkglgBiNijmhdIcQCwOleMB4gQPLSDJhIFTGLADRhwYAgCmhgIF'; //logs (max tolerance)
'braxe': Result := 'mbQAAAHicY2VgYNBkYWBQBmIDINYFYnUgnsPIwDAbiOcB8SIgng/E9gYyQNVMKJiLARMwYsFgAABuXQSn'; //bronze axe
'iaxe': Result := 'mggAAAHicY2NgYLBjYmBwAGIXIHYGYmsgNgfit0C5V0D8Bog/APF7IH4NxJbm5kCSCQOzMmAHjDgwBAAA6D8H0w=='; //iron axe
'blaxe': Result := 'mggAAAHicdcrbCgAQFETRQy6hk1Lk/7/ULt6wa83TBBFpKOiYGKgI8HCI55Ogqqy9ZHlnPnYLVU8A4Q=='; //black axe
'saxe': Result := 'mggAAAHicY2NgYNAGYl0gNgRiPSBWB2IVII4F4igonQTE8UAcDcThIcFAkgkDczFgB4w4MAQAAJOfBFE='; //steel axe
'maxe': Result := 'mggAAAHicY2NgYFgOxAuAeBUQr4XSS4CYDYhZgZgFiNmBmAeIOYHY0NATSDJhYC4G7IARB4YAABIJBOM='; //mithril axe
'aaxe': Result := 'mggAAAHicY2NgYDABYh0gNgdiSyhtAMRsQMwKxCxAzA7E3EDMCZK3B6lgwsAgtdgAIw4MAQDXOwIq'; //adamant axe
'raxe': Result := 'mggAAAHicY2NgYDgFxIeB+BwQXwDis0B8HIjZgJgViFmAmAOIeYCYE4itPfyAJBMG5mLADhhxYAgAAH10Bd0='; //rune axe
end;
end;

procedure ProgressReport;
var
I :integer;
begin
Writeln(#13#10);
SRLProgressReport(ResultDebugBox, 'Forest Exterminator', 'Bobzilla69', '1.25',
['TimeRunning', 'Active Players'],
[TimeRunning, PlayersActive]);
SRLPlayerReport(ResultDebugBox, 0, false, [True, True, false, false, false, true], ['Tree Cutting'], [], [], [0], [] );
Writeln(#13#10'Please post bugs and report at [url]http://villavu.com/forum/showthread.php?p=739347'#13#10);[/url]
if (DebugReport) then
begin
for I := 0 to (HowManyPlayers - 1) do
begin
if (not (Players[I].Strings[1] = '')) then
begin
WriteLn(Players[I].Nick + #13#10'Debug of what happened'#13#10);
WriteLn(Players[I].Strings[1]);
end;
end;
end
end;

procedure ScriptTerminate;
begin
FreeSRLBitmaps;
ProgressReport;
end;

procedure CheckLevels;
begin
Wait(200);
if (not (LoggedIn)) then
Exit;

if (Players[CurrentPlayer].Integers[1] = 0) then
Players[CurrentPlayer].Integers[1] := GetSkillInfo('woodcutting', True);

case (Players[CurrentPlayer].Integers[1]) of
1..14: Players[CurrentPlayer].Strings[0] := 'Tree';
15..29: Players[CurrentPlayer].Strings[0] := 'Oak';
30..59: Players[CurrentPlayer].Strings[0] := 'Willow';
60..99: Players[CurrentPlayer].Strings[0] := 'Yew';
end;
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + Players[CurrentPlayer].Strings[0] +' was auto detected to be trained on.'#13#10;
end;

procedure CheckLogged;
var
breakFor: integer;
begin
if (PlayersActive >= 1) then
begin
if (Players[CurrentPlayer].Integers[1] = 0) then
Exit;
Logout;
if (Players[CurrentPlayer].Booleans[0]) then
begin
breakFor := 240000 + RandomRange(90000, 150000);
Write('Taking Break for: ' + MsToTime(breakFor, Time_Short));
Wait(breakFor);
end;
end;

if (LoadsDone) then
begin
LoadsDone := False;
Exit;
end;

if (not (LoggedIn)) then
begin
Write('Player not logged in Switching to next');
Write('Choosing Next Player');
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + 'Player Failed, Please Post Proggress report and location logged out'#13#10;
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(working);
Players[CurrentPlayer].Active := False;
Logout;
end;
end;

procedure AntiBan;
var
MousePos: TPoint;
begin
FindNormalRandoms;
GetMousePos(MousePos.x, MousePos.y);

case random(100) of //30% chance something will happen
0..5: PickupMouse;
10..15: HoverSkill('random', False);
20..25: GameTab(RandomRange(tab_Combat, tab_Notes));
30..35: Wait(500 + Random(1500));
40..45: RandomAngle(1);
50..55: BoredHuman;
end;

GameTab(Tab_Inv);
MMouse(MousePos.x, MousePos.y, 2, 2);
end;

procedure WalkToBank;
var
MiddleOfTPA: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
TreeSetup: TTree;
begin
if (not (LoggedIn)) then
Exit;
TreeSetup := SetupTree;
Write('Walking to Bank from: ' + TreeSetup.Tree + '.');
case LowerCase(TreeSetup.Tree) of
'tree': begin
//at trees, loking for rock at top right hand side. shoudl walk to above pen
if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 360, 5, 45, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
if (DebugTheTPA) then
DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x - 10 , MiddleOfTPA.y + 55, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//try to use stalls to place you near bank
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 140, 240, 40, 70, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
begin
MiddleOfTPA := MiddleTPA(TPA);
if (DebugTheTPA) then
DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 210, 35, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
if (DebugTheTPA) then
DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -3, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
FFlag(5);
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;
end;
'oak': begin
MakeCompass('N');
//use rocks and offsetting to end up near pen
if FindColorsTolerance(TPA, MyFindColor('rock', True), MMCX, MMY1, MMX2, MMCY, 15)then
begin
ATPA := SplitTPAEx(TPA, 8, 8);
SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
MiddleTPAEx(ATPA[0], x , y);
Mouse(x + 30, y + 46, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
Wait(3000);
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//Stalls Middle to bank
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 90, 230, 5, 55, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 210, 40, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -5, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
FFlag(5);
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;
end;
'willow': begin
MakeCompass('N');
if FindColorsPie(TPA, 1179390, 15, 0, 60, 30, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -3, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
FFlag(5);
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;
end;
'yew': begin
MakeCompass('N');
if FindColorsPie(TPA, MyFindColor('rock', True), 15, 60, 180, 30, 60, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 15, MiddleOfTPA.y , 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//use rocks and offsetting to end up near pen
if FindColorsTolerance(TPA, MyFindColor('rock', True), mmcx, mmy1, mmx2, mmcy, 15)then
begin
ATPA := SplitTPAEx(TPA, 8, 8);
SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
MiddleTPAEx(ATPA[0], x , y);
Mouse(x + 30, y + 46, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
Wait(3000); //in case flag go off map
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//Stalls Middle to bank
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 90, 230, 5, 55, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
Flag;
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;

//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 210, 40, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -5, 5, 5, True);
Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 4 Complete');
FFlag(5);
end else
begin
LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 4, Logging out...');
Exit;
end;
end;
end;
Wait(500 + Random(500)); //screen settle
Write('Walking to bank from: ' + TreeSetup.Tree + ' Complete.');
end;

procedure WalkToTrees;
var
MiddleOfTPA: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
TreeSetup: TTree;
begin
if (not (LoggedIn)) then
Exit;

TreeSetup := SetupTree;
Write('Walking to tree: ' + TreeSetup.Tree);
case Lowercase(TreeSetup.Tree) of
'tree': begin
MakeCompass('N');
//from bank to middle of stalls
if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//at stalls uses middle of stalls and offset to walk behind to pen
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;
end;
'oak': begin
MakeCompass('N');
//from bank to middle of stalls
if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//at stalls uses middle of stalls and offset to walk behind to pen
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//rock near oak's to walk to oak's
if FindColorsTolerance(TPA, MyFindColor('rock', True), MMX1, MMY1, MMCX, MMCY, 15)then
begin
ATPA := SplitTPAEx(TPA, 8, 8);
SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
MiddleTPAEx(ATPA[0], x , y);
Mouse(x - 22, y + 24, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 3 Complete');
Wait(3000); //in case flag go off map
Flag;
Write('Walking Complete');
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;
end;
'willow': begin
MakeCompass('S');
if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 60, 50, 80, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 25, MiddleOfTPA.y + 15, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;
end;
'yew': begin
MakeCompass('N');
//from bank to middle of stalls
if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
begin
MiddleOfTPA := MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1, Logging out...');
Exit;
end;

//at stalls uses middle of stalls and offset to walk behind to pen
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
Flag;
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2, Logging out...');
Exit;
end;

//rock near oak's to walk to oak's
if FindColorsTolerance(TPA, MyFindColor('rock', True), MMX1, MMY1, MMCX, MMCY, 15)then
begin
ATPA := SplitTPAEx(TPA, 8, 8);
SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
MiddleTPAEx(ATPA[0], x , y);
Mouse(x - 22, y + 24, 5, 5, True);
Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 3 Complete');
Wait(3000); //in case flag go off map
Flag;
Write('Walking Complete');
end else
begin
LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 3, Logging out...');
Exit;
end;
end;
end;
Wait(500 + Random(500));
Write('Walking to tree: ' + TreeSetup.Tree + ' Complete.');
end;

Function MyOpenBank: boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, J: integer;
begin
Result := BankScreen;
if (Result) then
Exit;
MakeCompass('W');
Wait(300);
FindColorsTolerance(TPA, MyFindColor('bank', False), MSX1, MSY1, MSX2, MSCY, 5);
ATPA := SplitTPAEx(TPA, 10, 10);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
J := High(ATPA);
for I := 0 to J do //from 0 first entry in array to highest entry in ATPA
begin
MiddleTPAEx(ATPA[I], x, y); //find middle of array entry
MMouse(x, y, 2, 2);
if WaitUpTextMulti(['ooth', 'ank booth'], 400) then
begin
Mouse(x, y, 0, 0, False);
Wait(200);
WaitOption('uickl', 400);
Flag;
Wait(2000 + Random(800));

if (PinScreen) then
begin
InPin(Players[CurrentPlayer].Pin);
Wait(100);
end;

Result := BankScreen;
end;
end;
end;

procedure BankIt;
var
BankLoop, DTM: integer;
begin
if (not (LoggedIn)) then
Exit;

BankLoop := 0;
repeat
Wait(300);
Inc(BankLoop);
until((BankLoop > 5) or (MyOpenBank))

if (not (BankScreen)) then
OpenBank('db', True, False);

if ((BankLoop >= 5) or (not (BankScreen))) then
begin
LogoutWhy('Finding bank took more that 5 attempts, logging out');
Exit;
end;

DTM := DTMFromString(LoadDTM('log'));
try
if FindDTM(DTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, False);
ChooseOption('All'); //ChooseOption('All '+TreeSetup.Tree);
Wait(1500 + Random(500)); //incase of lagg
end else
LogoutWhy('Logs not found in inventory logging out');
finally
FreeDTM(DTM);
end;

Inc(Players[CurrentPlayer].Banked);
CloseBank;
MakeCompass('N');
SetAngle(True);
end;

procedure WeStillChopping; //idea from BH - Draynor Willow Cutter
var
T, CutTime, ChopX, ChopY: integer;
TreeSetup: TTree;
begin
Flag;
Wait(200 +Random(200)); //allows player more time to reach tree after flag disapears
GetMousePos(ChopX, ChopY);

if ((not (LoggedIn)) or (Invfull)) then
Exit;

TreeSetup := SetupTree;
T := GetSystemTime;
CutTime := TreeSetup.Cut + Random(10000); //how long to cut for
MMouse(ChopX, ChopY, 2, 2);
Write('Chopping Tree started');
repeat
if (not (FindBlackChatMessage('swing your hatchet'))) then //if not this the w cut logs, so we do uptext check
if (not (IsUpTextMultiCustom(TreeSetup.UpText))) then //if no uptext then we might have cut tree
Break;

Wait(500 + random(200));

if (Invfull) then
Break;

Antiban;
until ((GetSystemTime - T > CutTime) or (not LoggedIn)) //exit repeat if we reach cut time

FindNormalRandoms;

if (GetSystemTime - T > CutTime) then
Writeln('Took longer then ' + IntToStr(CutTime) + ' to chop down the tree.');

if (not (LoggedIn)) then
Writeln('Player not logged in');

if (Invfull) then
WriteLn('Invfull starting banking');
end;

function CutTreesTPA: Boolean; //Thanks to R!ch!e for explaining this. This is a mix of R!ch!e's M!ne MineOre Procedure and BH Draynor Willow Cutter FindWillowTPA
var
I, J: Integer;
TreeTPA: TPointArray;
TreeATPA: T2dPointArray;
TreeSetup: TTree;
begin
if (not (LoggedIn)) then
Exit;

TreeSetup := SetupTree;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(TreeSetup.HMod, TreeSetup.SMod);

try
Write('Attempting to Find ' + TreeSetup.Tree);
FindColorsSpiralTolerance(MSCX, MSCY, TreeTPA, TreeSetup.Col, MSX1, MSY1, MSX2, MSY2, TreeSetup.Tol);
TreeATPA := SplitTPAEx(TreeTPA, 12, 12); //TPAtoATPAex( 20, 20)
if (DebugTheTPA) then
begin
DebugATPABounds(TreeATPA);
Wait(2000);
end;

if (Length(TreeATPA) = 0) then
Exit;

SortATPAFromFirstPoint(TreeATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point

if (DebugTheTPA) then
begin
Write('ATPA After Sort');
DebugATPA(TreeATPA, '');
end;

J := High(TreeATPA);
for I := 0 to J do //from 0 first entry in array to J highest entry
begin
MiddleTPAEx(TreeATPA[I], x, y);//find middle of array entry
MMouse(x, y, 3, 3);
Wait(300);
if WaitUpTextMulti(TreeSetup.UpText, 400) then
begin
Mouse(x, y, 0, 0, True);
Flag;
Result := True;
Exit;
Wait(500 + Random(1500));
end;
end;
FindNormalRandoms;
finally
SetColorSpeed2Modifiers(0.2, 0.2); // Sets the modifiers back to default, (0.2, 0.2).
ColorToleranceSpeed(1); // Sets the CTS back to the default, 1.
end;
end;

procedure CutTrees; //Thanks to R!ch!e for explaining procedure.
var
Fail: Integer;
TreeSetup: TTree;
begin
if (not (LoggedIn)) then
Exit;
TreeSetup := SetupTree;
Write('Attempting to Cut ' + TreeSetup.Tree);
repeat
if (not (CutTreesTPA)) then
begin
Write('Could not find tree Trying Failsafe Finder');
if FindObj(x, y, TreeSetup.Tree, TreeSetup.Col, TreeSetup.Tol) then //use normal find object function as failsafe
begin
Write('Found ' + TreeSetup.Tree + ' using FindObj');
Mouse(x, y, 0, 0, True);
end else
begin
Write('Could not find ' + TreeSetup.Tree + ' using Colour or FindObj ');
Inc(Fail); //failsafe so ther is no infinate loop, after 15 fails script terminates
Wait(1500 + Random(500)) //incase all trees are cut down ,otherwise its instant failsafe activation (increase if hight population of cutters)
if (Fail > 15) then
begin
Write('Script failed to find ' + TreeSetup.Tree);
Write('Even after 15 attempts');
Fail := 0; //Resetting for next player
LogoutWhy('Could not find tree');
end;
end;
end;
WeStillChopping;
until((InvFull) or (not LoggedIn));

if InvFull then
Write('Inventory Full Banking');
end;

procedure TreeCutting;
begin
if (not (LoggedIn)) then
Exit;

repeat
WalkToTrees;
CutTrees;
WalkToBank;
BankIt;
until (Players[CurrentPlayer].Banked >= (Players[CurrentPlayer].Integers[0])) or (not (LoggedIn));

if (Players[CurrentPlayer].Banked >= Players[CurrentPlayer].Integers[0]) then
begin
LoadsDone := True;
Write(Players[CurrentPlayer].Name + ' has finished: ' + IntToStr(Players[CurrentPlayer].Integers[0]) + ' Loads');
end;
end;

procedure PlayerDone;
begin
if (not (LoggedIn)) then
Exit;

if (LoadsDone) then
begin
Write('All Logs have been cut Switching Players.');
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(Working);
//ProgressReport;
if (not (Players[CurrentPlayer].Booleans[1])) then
begin
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + 'Player not set to attempt a re-run logging out'#13#10;
Players[CurrentPlayer].Active := False;
Logout;
end else
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1]+'Re-Run set to true, will attempt another run'#13#10;
Write('Progress Report');
ProgressReport;
end;
end;

procedure Main;
begin
repeat
LoginPlayer;
Wait(500);
MarkTime(Working);
CheckLevels;
WriteLn('Woodcutting Level: ' + IntToStr(Players[CurrentPlayer].Integers[1]));
WriteLn('Recommended training is ' + Players[CurrentPlayer].Strings[0]);
SetupTree;
Wait(500);
SetAngle(True);
TreeCutting;
PlayerDone;
CheckLogged;
until(AllPlayersInactive)
end;

procedure Setup;
begin
SetUpSRL;
DeclarePlayers;
end;

begin
Setup;
Wait(1000);
Main;
ProgressReport;
end.


Cheers for that, it looks nice.

as for the
Cut := 8000;         //Cut Time (This should not be here.... Use a function to detect cutting)

that is used as a timer so that it has a added failsafe.

i have kinda stopped working on this seeing as there are no progress reports and not many downloads.

i will take what you have done in here though as extra training.

and again thanks for taking your time to read through and make changes

Edit: Also blame Minecraft for my lack of doing anything productive

dhandley12

2010-10-01 11:40:31

Lol minecraft is very very addicting and sorry I haven't been on lately to test the script I have been trying to get over the flu and haven't had much energy to do anything other than my schoolwork.

Peek XD

2010-10-01 17:16:24

Whenever I use this it will randomly stop and a new tab will open up in simba that says antirandom. I just close that tab and start it again but it happens like every 20 minutes. How can i fix this??

dhandley12

2010-10-01 19:58:37

From: Peek XD
Whenever I use this it will randomly stop and a new tab will open up in simba that says antirandom. I just close that tab and start it again but it happens like every 20 minutes. How can i fix this??


This is the same problem I have been having lately just to let you know bobzilla.

Bobzilla69

2010-10-02 04:20:56

From: Peek XD
Whenever I use this it will randomly stop and a new tab will open up in simba that says antirandom. I just close that tab and start it again but it happens like every 20 minutes. How can i fix this??


From: dhandley12
This is the same problem I have been having lately just to let you know bobzilla.


when it opens the new tab, it will stop the script and also write an error, this would be helpful to have so see whats wrong.

i sounds like there is a problem with antirandoms, but need more info

Peek XD

2010-10-02 13:13:17

This is the error message that comes up.

Error: Exception: The given DTM Index[0] doesn't exist at line 330
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Simba\Includes\SRL/logs/SRL log 02-10-10 15.txt] has not been freed in the script, freeing it now.

realrocker00

2010-10-02 14:42:48

such an amazing script. using now with SMART :) love it, will post proggie!

dhandley12

2010-10-02 17:41:57

It says:

Error: Exception: The given DTM Index[0] doesn't exist at line 330
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Simba\Includes\SRL/logs/SRL log 02-10-10 0.txt] has not been freed in the script, freeing it now.

It also highlights line 330 of the Anti randoms tab.

ballerz

2010-10-10 22:04:22

hey i dont get this i tried downloading but it says i have to find it first but i hit find and nothing happend so if u can help plz do i need a wc bot

ballerz

2010-10-10 22:09:57

:bart: hi well im new and i need help plz help me :):spongebob:

blulightning

2010-10-27 14:42:41

From: ballerz
hey i dont get this i tried downloading but it says i have to find it first but i hit find and nothing happend so if u can help plz do i need a wc bot


It's not really clear what your asking, so I'm just going to assume that you probably haven't set up simba/srl/reflection properly, why don't you check out some other threads on proper set up

If you're still having trouble again later!

Kehmist

2010-11-06 04:50:03

Nice script! :D
Testing it out now. Will post soon.

Edit: A couple banks into the script I got the same error as dhandley. :\

uzbon

2010-11-07 07:44:49

Geting error , its cuting about 300-400 logs and geting error

holic

2010-11-07 16:04:37

Walking to Yews is messed up, it falls short. Walks to just above the pigs and doesn't find the rocks. I've been messing with it to get it walk a little better and it works most times now but not always. Also, it logs out because yews take so long to re-spawn. Other than that, pretty good script. I've been tweaking it, but you managed to take me from level 10 to level 67 in a fairly short period of time.

Script failed to find Yew
Even after 15 attempts
Could not find tree
Player not logged in Switching to next
Choosing Next Player


[==========================================]
[ Forest Exterminator 1.25 ]
[ by Bobzilla69 ]
[==========================================]
[ TimeRunning : 6 Minutes And 4 Seconds ]
[ Active Players : 0 ]
[==========================================]
[ Forest Exterminator 1.25 ]
[==========================================]
[=========================================================]
[ Nick | Active | Worked | Banked | Rand | Tree Cutting ]
[=========================================================]
[ ake | False | 00:12:05 | 0 | | Yew ]
[=========================================================]