SRL Archive - Archive

bobzilla69 - SRL Member Application


Bobzilla69

2010-09-24 16:17:07

How Long have You Played Runescape?
10 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
C++, C#, Java, HTML, PHP, Pascal.


Are you a member of any other communities?
No


Tell us about yourself…
From: bobzilla69
I am a casual photographer, i recently graduated from university and is currently looking for a job.

i like to program in my spare time, and try to be helpful where i can.

i have recently come back to runescape after almost a year break, due to school work, from playing/autoing and remembered how much fun i had autoing.

i started to create this script just before i took a break from autoing, i decided i might as well finish it, its originally a chopper and burner but i had trouble burning so i removed that part for now.

i just firstly want to thank everyone that gave me advice and help me with the script.

hope you enjoy



Please show us one (or multiple) of your scripts.
program ForestExterminator; //name needs a bit for work i think
{$i SRL\SRL\misc\smart.scar}
{$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;
working:integer; //used to set working time


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

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
BoxRewards := ['Coins'];// Box Reward
Active := True; // Active ?
Booleans[1] := False; //if player completed all load, attempt a re-run
Integers[0] := 1; // Loads to do
Integers[2] := 0; //Skill level, will be auto detected, can be set manually by changing to relevant tree skill level //woodcutting
Strings[0] := ''; // Tree that will be chopped will be autodetected
Strings[1] := ''; //progress report
Banked := 0; //insures players start with clean variables DO NOT CHANGE
Worked := 0; //insures players start with clean variables DO NOT CHANGE


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

end;
{
with Players[1] do
begin
Name := '';
Pass := '';
Nick := '';
BoxRewards := ['Coins'];// Box Reward
Active := True; // Active ?
Booleans[1] := False; //if player completed all load, attempt a re-run
Integers[0] := 1; // Loads to do
Integers[2] := 0; //Skill level, will be auto detected, can be set manually by changing to relevant tree skill level //woodcutting
Strings[0] := ''; // Tree that will be chopped will be autodetected
Strings[1] := ''; //progress report
Banked := 0; //insures players start with clean variables DO NOT CHANGE
Worked := 0; //insures players start with clean variables DO NOT CHANGE


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

end;
}
end;

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

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

var
TreeSetup : Tree; //allows to set specific colors for trees
AntiBanTime : LongInt;
x, y:Integer;
LoadsDone:Boolean;

Const
split = #13#10; //used to create a new line for debugging

//auto colors a selection of items
Function MyFindColor(what:String; Where:Boolean):Integer; //on minimap(true) or main screen (false)
var
i, ii, Tcolor, Red, Green, Blue, color,
bL, bH, gL, gH, rL, rH, colTol:integer;
colorArray : Tpointarray;
begin
case what of
'bank': begin
color := 5664638;
bL := 82;
bH := 89;
gL := 108;
gH := 114;
rL := 123;
rH := 128;
colTol:= 5; //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
begin
FindColorsTolerance(colorArray, color, MMX1, MMY1, MMX2, MMY2, colTol);
end else FindColorsTolerance(colorArray, color, MSX1, MSY1, MSX2, MSY2, colTol);
ii := High(colorArray);
for i := 0 to ii do
if rs_OnMinimap(colorArray[i].x,colorArray[i].y)or not Where then
begin
TColor := GetColor(colorArray[i].x,colorArray[i].y);
colortoRGB(Tcolor, Red, Green, Blue);
if (Blue>=bL) and (Blue<=bH) then
if (Green>=gL) and (Green<=gH) then
if (Red>=rL) and (Red<=rH) then
begin
Result := Tcolor
Writeln(what +' Color Found :'+ IntToStr(Tcolor));
Exit;
end;
end;
end;

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

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

procedure SetupTree;
begin
case Lowercase(Players[CurrentPlayer].Strings[0]) of
'tree': begin
with TreeSetup do //loads recoard to store tree specific infomation for script
begin
Col := 4025442; //color of what we cutting
Tol := 5; // tolerance for finding tree
Cut := 8000; //how long to wait after cutting started to switch trees
Light := 8000; //how long to wait for lighting
HMod := 0.04; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 1.57; //30
UpText := [ 'hop down Tree', 'own Tree', 'ree'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Tree := 'Tree'; //tree name
end;
end;
'oak': begin
with TreeSetup do //loads recoard to store tree specific infomation for script
begin
Col := 6202005;
Tol := 5;
Cut := 15000;
Light := 8000;
HMod := 0.10;
SMod := 0.58;
UpText := [ 'hop down Oak', 'own Oak', 'ak']
Tree := 'Oak';
end;
end;
'willow': begin
with TreeSetup do //loads recoard to store tree specific infomation for script
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 TreeSetup do //loads recoard to store tree specific infomation for script
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):Integer;
begin
case LowerCase(what) of
'log' : Result := DTMFromString('mggAAAHicY2NgYBCEYhkglgBiNijmhdIcQCwOleMB4gQPLSDJhIFTGLADRhwYAgCmhgIF'); // to bank any logs max tolerance
'braxe' : Result := DTMFromString('mbQAAAHicY2VgYNBkYWBQBmIDINYFYnUgnsPIwDAbiOcB8SIgng/E9gYyQNVMKJiLARMwYsFgAABuXQSn'); //bronze axe
'iaxe' : Result := DTMFromString('mggAAAHicY2NgYLBjYmBwAGIXIHYGYmsgNgfit0C5V0D8Bog/APF7IH4NxJbm5kCSCQOzMmAHjDgwBAAA6D8H0w=='); //iron axe
'blaxe' : Result := DTMFromString('mggAAAHicdcrbCgAQFETRQy6hk1Lk/7/ULt6wa83TBBFpKOiYGKgI8HCI55Ogqqy9ZHlnPnYLVU8A4Q=='); //black axe
'saxe' : Result := DTMFromString('mggAAAHicY2NgYNAGYl0gNgRiPSBWB2IVII4F4igonQTE8UAcDcThIcFAkgkDczFgB4w4MAQAAJOfBFE='); //steel axe axe
'maxe' : Result := DTMFromString('mggAAAHicY2NgYFgOxAuAeBUQr4XSS4CYDYhZgZgFiNmBmAeIOYHY0NATSDJhYC4G7IARB4YAABIJBOM='); //mithril axe
'aaxe' : Result := DTMFromString('mggAAAHicY2NgYDABYh0gNgdiSyhtAMRsQMwKxCxAzA7E3EDMCZK3B6lgwsAgtdgAIw4MAQDXOwIq'); //adamant axe
'raxe' : Result := DTMFromString('mggAAAHicY2NgYDgFxIeB+BwQXwDis0B8HIjZgJgViFmAmAOIeYCYE4itPfyAJBMG5mLADhhxYAgAAH10Bd0='); //rune axe
end;
end;

procedure ProgressReport;
var
i:integer;
begin
Writeln('');
SRLProgressReport(ResultDebugBox, 'Forest Exterminator', 'Bobzilla69', '1.00',
['TimeRunning', 'Active Players'],
[TimeRunning, PlayersActive ]);
SRLPlayerReport( ResultDebugBox, 0, false, [True, True, false, false, false, true], ['Tree Cutting'], [], [], [0], [] );
Writeln('');
Writeln('');
if DebugReport then
begin
for i := 0 to (HowManyPlayers -1) do
begin
WriteLn(Players[i].Name);
WriteLn('Debug of what happened');
WriteLn(Players[i].Strings[1]);
Writeln('');
inc(i);
end;

end
end;

procedure CheckLevels;
var
WoodCuttingLevel, MaxLevel:Integer;

begin
wait(200);
if not LoggedIn then exit;

if not (Players[CurrentPlayer].Integers[2] = 0) then //allows for setting which tree to cut manualy
begin
WoodCuttingLevel:= Players[CurrentPlayer].Integers[2];
end else
WoodCuttingLevel:= GetSkillInfo('woodcutting', True); //gets current woodcutting level

MaxLevel:= 14; //tree 14
if (WoodCuttingLevel<=MaxLevel) then
begin
Players[CurrentPlayer].Integers[2]:= WoodCuttingLevel; //woodcutting
Players[CurrentPlayer].Strings[0] := 'Tree';
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] +Players[CurrentPlayer].Strings[0] +'was auto detected to be trained on ' +split;
Exit;
end;

MaxLevel:= 29; //oak
if (WoodCuttingLevel<=MaxLevel) then
begin
Players[CurrentPlayer].Integers[2]:= WoodCuttingLevel; //woodcutting
Players[CurrentPlayer].Strings[0] := 'Oak';
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] +Players[CurrentPlayer].Strings[0] +'was auto detected to be trained on'+split;
Exit;
end;


MaxLevel:= 59; //willow
if (WoodCuttingLevel<=MaxLevel) then
begin
Players[CurrentPlayer].Integers[2]:= WoodCuttingLevel; //woodcutting
Players[CurrentPlayer].Strings[0] := 'Willow';
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] +Players[CurrentPlayer].Strings[0] +' was auto detected to be trained on'+split;
Exit;
end;


MaxLevel:= 99; //yew
if (WoodCuttingLevel<=MaxLevel) then
begin
Players[CurrentPlayer].Integers[2]:= WoodCuttingLevel; //woodcutting
Players[CurrentPlayer].Strings[0] := 'Yew';
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] +Players[CurrentPlayer].Strings[0] +' was auto detected to be trained on'+split;
Exit;
end;

end;

procedure CheckLogged; forward; //allows me to call functions below

procedure AntiBan;
var
Ax, Ay, I: integer;
begin
FindNormalRandoms;
if not (IsUpTextMultiCustom(TreeSetup.UpText)) or (Invfull) or not (TimeFromMark(AntiBanTime) >= 15000 + Random(8000)) then
Exit
else
Getmousepos(Ax, Ay); //gets mouse position where tree still is
case random(200) of
2..29: PickupMouse;
42..49: HoverSkill('random', false);
54..69: PickUpMouse;
73..88:
begin
for I := 0 to Random(2) do
GameTab(21 + RandomRange(0, 16)); //random game tab
end;
95..122: wait(50);
140..157: RandomAngle(1);
179..189: BoredHuman;
else
exit; //if none of the numbers exit
end;
GameTab(Tab_Inv); //makes tab to inventory
MarkTime(AntiBanTime); //mark time since last antiban/ dont want to happen to often
MMouse(Ax, Ay, 2, 2); //moves mouse to last place tree was at with a bit of random
end;

procedure WalkToBank;
var
MiddleOfTPA: TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;

begin
if not LoggedIn then Exit;
case LowerCase(TreeSetup.Tree) of
'tree': begin
Write('Walking to Bank from : '+TreeSetup.Tree);
//at trees, loking for rock at top right hand side. shoudl walk to above pen
if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 60, 5, 45, mmx1, mmy1, mmx2, mmy2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 15, MiddleOfTPA.y + 50, 5, 5, true);
Write('Walking to Bank from : '+TreeSetup.Tree+' step 1 complete');
Flag;
end
else
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 1)');

//try to use stalls to place you near bank
if FindColorsPie(TPA, MyFindColor('stall', True), 15, 120, 240, 40, 60, mmx1, mmy1, mmx2, mmy2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x +10 , MiddleOfTPA.y + 15, 5, 5, true);
Write('Walking to Bank from : '+TreeSetup.Tree+' step 2 complete');
Flag;
end
else
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 2)');

//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 180, 40, 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 3 complete');
FFlag(5);
end
else
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 3)');

Wait(500+Random(500)); //screen settle
Write('Walking to bank from : ' +TreeSetup.Tree+' Complete');
end;
'oak': begin
Write('Walking to Bank from : '+TreeSetup.Tree);
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); //in case flag go off map
Flag;
end
else
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 1)');


//Stalls Middel 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
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 2)');


//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 180, 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
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 3)');

Wait(500+Random(500)); //screen settle
Write('Walking to bank from : ' +TreeSetup.Tree+' Complete');
end;
'willow': begin
Write('Walking to Bank from : '+TreeSetup.Tree);
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
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 1)');

Wait(500+Random(500)); //screen settle
Write('Walking to bank from : ' +TreeSetup.Tree+' Complete');
end;
'yew': begin
Write('Walking to Bank from : '+TreeSetup.Tree);
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
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 1)');

//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
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 2)');


//Stalls Middel 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
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 3)');


//should place in bank, using bankers as refrence
if FindColorsPie(TPA, 1179390, 15, 90, 180, 40, 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 4 complete');
FFlag(5);
end
else
LogoutWhy('Walking to bank from' +TreeSetup.Tree+' Failed Logging out (step 4)');

Wait(500+Random(500)); //screen settle
Write('Walking to bank from : ' +TreeSetup.Tree+' Complete');
end;
end;
end;

procedure WalkToTrees;
var
MiddleOfTPA: TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;

begin
if not LoggedIn then Exit;
case Lowercase(TreeSetup.Tree) of
'tree': begin
MakeCompass('N');
Write('Walking to tree : '+TreeSetup.Tree);
//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
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 1)');


//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
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 2)');

Wait(500 +Random(500)); //small wait to settle screen
Write('Walking to trees: ' +TreeSetup.Tree+' Complete');
end;
'oak': begin
MakeCompass('N');
Write('Walking to trees: ' +TreeSetup.Tree);
//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
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 1)');


//at stalls uses middle of stalls and offset to walk next 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 - 35, MiddleOfTPA.y - 35, 5, 5, True);
Write('Walking to tree : '+TreeSetup.Tree+' Step 2 Complete');
Flag;
end
else
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 2)');


//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
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 3)');

Wait(500 + Random(500)); //screen settle
Write('Walking to tree : '+TreeSetup.Tree+' Complete')
end;
'willow': begin
Write('Walking to trees: ' +TreeSetup.Tree);
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
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 1)');

Write('Walking to trees: ' +TreeSetup.Tree+' Complete');
Wait(500 +Random(500)); //small wait to settle screen
end;
'yew': begin
Write('Walking to trees: ' +TreeSetup.Tree);
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
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 1)');


//at stalls uses middle of stalls and offset to walk next 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 - 35, MiddleOfTPA.y - 45, 5, 5, True);
Write('Walking to tree : '+TreeSetup.Tree+' Step 2 Complete');
Flag;
end
else
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 2)');


//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 - 28, y + 6, 5, 5, True);
Write('Walking to tree : '+TreeSetup.Tree+' Step 3 Complete');
Wait(3000); //in case flag go off map
Flag;
end
else
LogoutWhy('Walking to ' +TreeSetup.Tree+' Failed Logging out (step 3)');

Write('Walking to trees: ' +TreeSetup.Tree+' Complete');
end;
end;
end;

Function MyOpenBank:Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
x, y, i, ii:Integer;
begin
Result:= False;
if BankScreen then
begin
Result:= True;
Writeln('Bank already open');
Exit;
end;
MakeCompass('W');
Wait(300); //screen settel
FindColorsTolerance(TPA, MyFindColor('bank', False), MSX1, MSY1, MSX2, MSCY, 5);
ATPA := SplitTPAEx(TPA, 10, 10);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
ii := High(ATPA);
for i := 0 to ii 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 BankScreen then
begin
Result:= True;
Writeln('Bank has been opened');
Exit;
end;
end;
end;
end;

procedure BankIt;
var
BankLoop, DTM:integer;

begin
try Wait(5); //chacks for runtime error //also allows finnally to free DTM's
if not LoggedIn then Exit;
BankLoop:= 0;
repeat
Wait(300);
inc(BankLoop);
until((BankLoop >4)or(MyOpenBank))
if((BankLoop >=4)or not BankScreen) then
begin
LogoutWhy('Finding bank took longer that 4 attempts, logging out');
Exit;
end;
DTM:= LoadDTM('log');
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');
inc(Players[CurrentPlayer].Banked); //how many times a player has banked
CloseBank;
MakeCompass('N');
SetAngle(True);
finally
FreeDTM(DTM);
end;
end;

function WeStillChopping: boolean; //idea from BH - Draynor Willow Cutter
var
T, CutTime, ChopX, ChopY: integer;

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;
T := GetSystemTime; //used to get cut time for logs
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
begin
if not IsUpTextMultiCustom(TreeSetup.UpText) then break; //if no uptext then we might have cut tree
end;
Wait(500 + random(200));
if Invfull then Break;
Antiban;
Result := True; //true if we are still chopping
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');
Result := False; //stopped chopping, inventory could be full or took to long to chop tree
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
x, y, i, ii: Integer;
TreeTPA: TPointArray;
TreeATPA: T2dPointArray;
begin
if not LoggedIn then Exit; //if not logged in exit
try Wait(1);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(TreeSetup.HMod, TreeSetup.SMod);
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; //if the split returns nothing TreeATPA will be empty so
SortATPAFromFirstPoint(TreeATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point
if DebugTheTPA then
begin
Write('ATPA After Sort');
DebugATPA(TreeATPA, '');
end;
ii := High(TreeATPA);
for i := 0 to ii do //from 0 first entry in array to ii 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 //Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + '//Failed to Find Tree to make TPA Logging Out//\';
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
x, y, fail: Integer;
begin
if not LoggedIn then Exit; //if not logged in exit
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');
Write('Script will Terminate');
Fail := 0; //Resetting for next player
LogoutWhy('Could not find tree');
end;
end;
end;
if not WeStillChopping then
begin
Continue; //restarts procedure
end;
AntiBan;
until((InvFull) or (not LoggedIn)); //if inventory is full
if InvFull then
Write('Inventory Full Banking');
end;

procedure CheckLogged;
begin
if LoadsDone then //means player just finished loads
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'+split;
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(working);
Players[CurrentPlayer].Active := False;
Logout; //set current player to false
end;
end;

procedure TreeCutting;
begin
if not LoggedIn then Exit; //if not logged in 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');
Write('Player will now start lighting logs if choosen to');

end;
end;

procedure PlayerDone;
begin
if not LoggedIn then Exit; //if not logged in exit
If LoadsDone then
begin
Write('All Logs have been cut Switching Player');
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'+split;
Players[CurrentPlayer].Active := False;
Logout; //if set to true player that completes load can reset//will need axe withdraw procedure
end else
Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1]+'Re-Run set to true, will attempt another run'+split;
Write('Switching to next player');
end;
end;

procedure Main;
begin
repeat
LoginPlayer;
Wait(500);
MarkTime(working);
CheckLevels;
WriteLn('Woodcutting level : '+inttostr(Players[CurrentPlayer].Integers[2]));
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.

Edit: Changed silly extra 0 in my wait for willow walking, instead of wait(500) it was wait(5000)

Rich

2010-09-24 16:37:21

DTMs - yes
TPAs - yes
Antiban - yes
Failsafes - yes
Multiplayer - yes
Knowledge of SRL - yes

Very easy yes from me.

Bobzilla69

2010-09-24 16:39:02

From: Rich
DTMs - yes
TPAs - yes
Antiban - yes
Failsafes - yes
Multiplayer - yes
Knowledge of SRL - yes

Very easy yes from me.


:) its been a long time coming this script, glad you liked it

weequ

2010-09-24 16:41:13

Code looks very professional. I voted for yes.

Bobzilla69

2010-09-24 17:08:12

From: antti mies
Code looks very professional. I voted for yes.


thanks :)

as you can see i have improved alot over my years here, its shocking looking at my earlier applications.

anyways i will not be to active over the weekend, having a games night with some mates (come on 24h gaming), but when i get back i will check and improve any area you guys/girls feel are lacking.

Cstrike

2010-09-24 18:54:58

See… why can't all our member [edit–>] applications be like this? Here is a script that really shows the authors knowledge. I haven't tested it (don't have an account to do so ATM), but this is very well done and compiles.
You know all the basics and the "advanced" techniques. Very well done.

My only criticism is if you were hell bent on shortening code, you could take all the times this is repeated:
                  MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 25, MiddleOfTPA.y + 15, 5, 5, True);
Write('Walking to tree : '+TreeSetup.Tree+' Step 1 Complete');
Flag;

Since it is repeated so many times, you could probably make a function out of it and take the Mouse variables and have yourself input them through the function bracket input.

But really, other than that– wow.

One question I have for you is, when (or if) you get SRL members, what would you like to do? What is your favorite area?

Awkwardsaw

2010-09-24 19:17:06

yes :)

Kyle Undefined

2010-09-25 00:39:02

Yes. I personally haven't scripted in who knows when, but the code looks clean and easy to read. Also very nice methods, and showing you know how to script.

Bobzilla69

2010-09-25 03:04:10

From: cstrike
See… why can't all our members be like this? Here is a script that really shows the authors knowledge. I haven't tested it (don't have an account to do so ATM), but this is very well done and compiles.
You know all the basics and the "advanced" techniques. Very well done.

My only criticism is if you were hell bent on shortening code, you could take all the times this is repeated:
                  MiddleOfTPA:= MiddleTPA(TPA);
Mouse(MiddleOfTPA.x - 25, MiddleOfTPA.y + 15, 5, 5, True);
Write('Walking to tree : '+TreeSetup.Tree+' Step 1 Complete');
Flag;

Since it is repeated so many times, you could probably make a function out of it and take the Mouse variables and have yourself input them through the function bracket input.

But really, other than that– wow.

One question I have for you is, when (or if) you get SRL members, what would you like to do? What is your favorite area?


Hi,

thanks for the great comments, about shortening the code, the example you gave is from the walking.
it could be done but then i would need to pass my TPA to it each time to get the correct point to use in the walking, not all my walking uses the FindColorsPie, this might impact on the scripts performance? but still nice idea, will look into it.

when/if i get SRL Members i would like to try doing everything, maybe not members scripts, but i want to try all scripts, i have no favorite yet, variate is the spice of life.
i have previously done a fisher (did not release due to lack of knowledge), woodcutters (did not release due to lack of knowledge), AutoTalker (release but no real use), ChickenKiller (did not release due to lack of knowledge) but as i have now advanced greatly i might try and resurrect old scripts, might even try my Multiskiller again.

Edit: in case it isn't clear in the script by changing Integers[2]:= 0 to the needed woodcutting level it cut the tree at the set level instead of auto detecting

BraK

2010-09-25 03:32:43

Yes From me a well wrote script. You have a positive attitude and help others when needed. I feel that you'll be an active part of the community.

Bobzilla69

2010-09-25 03:50:24

just a small proggy, i kinda messed this one up by not telling 2nd player to chop tree's, chopping willows with a bronze axe and level 3 is not good. will edit with another one after it runs correctly.

[===========================================]
[ Forest Exterminator 1.00 ]
[ by Bobzilla69 ]
[===========================================]
[ TimeRunning : 25 Minutes And 6 Seconds ]
[ Active Players : 0 ]
[===========================================]
[ Forest Exterminator 1.00 ]
[===========================================]
[=========================================================]
[ Nick | Active | Worked | Banked | Rand | Tree Cutting ]
[=========================================================]
[ obz | False | 00:42:04 | 3 | | Willow ]
[ asd | False | 00:05:33 | 2 | | Willow ]
[=========================================================]

[============================================]
[ Forest Exterminator 1.00 ]
[ by Bobzilla69 ]
[============================================]
[ TimeRunning : 28 Minutes And 25 Seconds ]
[ Active Players : 0 ]
[============================================]
[ Forest Exterminator 1.00 ]
[============================================]
[=========================================================]
[ Nick | Active | Worked | Banked | Rand | Tree Cutting ]
[=========================================================]
[ obz | False | 00:32:27 | 2 | | Willow ]
[ asd | False | 00:21:54 | 2 | | Tree ]
[=========================================================]

Cstrike

2010-09-25 09:27:35

Voted yes, not that I would have voted no ;)
Now it's just a matter of time before you become SRL members. Looking forward to seeing you around

WT-Fakawi

2010-09-25 10:03:39

In?

In! Welcome.