SRL Archive - Outdated / Broken

Script Taster


Bobzilla69

2011-04-28 17:47:53

Hey all,

if you to know what my next script release is (if you even care :P ) then the wait is over.

say hello to Ernie The UrnCrafter { Ernie the fastest UrnCrafter in the west }

Ernie will mine clay, wet it and craft urn for you all in one neat (i hope) script.

you can even ask Ernie to simply only mine or to mine and only wet the clay is you so please.

Ernie also like to only do things by colour, so he may be a bit clumsy at times but when he works he sure is a thing of beauty.


Please note this script is a work in progress, the only section i have not done is urn crafting, the rest is done but needs testing
:)


program ErnieUrnCrafter;

//{$i SRL\SRL\misc\smart.scar} //smart dont play well on computer
{$i SRL\SRL.scar}
{$i SRL\SRL\misc\Debug.scar}

{ Ernie the fastest UrnCrafter in the west }
var
DebugTheTPA:Boolean;

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

DebugTheTPA := False; //True if you want to see TPA debug (color only)

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) not currently used, but might be later
Active := True; //Player Active?
WorldInfo := [False, -1, False]; //members, world (-1 is random), pvp

Booleans[10] := True; //want to mine clay
Booleans[11] := True; //want to wet clay
Booleans[12] := True; //want to make urns

Integers[10] := 1; //trips to mine
Integers[11] := 1; //trips to well
Integers[12] := 1; //trips to pottery shed

end;

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

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

var
ColourSetup : Colour; //allows to set specific colors for trees

procedure SetupColour(what:string);
begin
case Lowercase(what) of
'clayrock': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 8570605; //color of what we cutting
Tol := 6; // tolerance for finding tree
HMod := 0.02; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 3.11; //30
UpText := [ 'ine Rock', 'ine'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Clay Rock'; //tree name
end;
end;
'furnace': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 1524090; //color of what we cutting
Tol := 3; // tolerance for finding tree
HMod := 0.15; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.56; //30
UpText := [ 'Pottery Oven', 'Oven', 'ven'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Pottery Oven'; //tree name
end;
end;
'potterwheel': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 3101036; //color of what we cutting
Tol := 1; // tolerance for finding tree
HMod := 0.13; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.40; //30
UpText := [ 'Potter', 'Wheel', 'heel', 'otter'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Pottery Wheel'; //tree name
end;
end;
'potteryhouse': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 1984857; //color of what we cutting
Tol := 0; // tolerance for finding tree
HMod := 0.00; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.00; //30
UpText := [ 'alk here', 'alk' ] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Pottery House'; //tree name
end;
end;
'door': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 2449020; //color of what we cutting
Tol := 1; // tolerance for finding tree
HMod := 0.07; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.67; //30
UpText := [ 'pen Door', 'pen'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Door'; //tree name
end;
end;
'well': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 3032403; //color of what we cutting
Tol := 3; // tolerance for finding tree
HMod := 0.15; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.21; //30
UpText := [ 'Well', 'ell'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Well'; //tree name
end;
end;
end;
try wait(5);
SetColorSpeed2Modifiers(ColourSetup.HMod, ColourSetup.SMod);
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;

Function MyFindColor(what:String; MM: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
'bankbooth': begin
color := 4018267;
bL := 58;
bH := 63;
gL := 77;
gH := 82;
rL := 88;
rH := 94;
colTol:= 4; //use to alter tollerance
end;
'bank': begin
color := 988754;
bL := 11;
bH := 19;
gL := 17;
gH := 26;
rL := 71;
rH := 92;
colTol:= 12; //use to alter tollerance
end;
'road': begin
color := 4219502;
bL := 59;
bH := 68;
gL := 93;
gH := 103;
rL := 103;
rH := 116;
colTol:= 9;
end;
end;
Result := 0;
if MM 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 MM 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 LogoutWhy(Why:string); //idea from BobboHobbo script
begin
WriteLn(Why);
Players[CurrentPlayer].Active := False; //stes player to inactive
Logout;
end;

procedure AntiBan;
var
MousePos: TPoint;
begin
if (not (LoggedIn)) then Exit;
GetMousePos(MousePos.x, MousePos.y);

case random(100) of
0..4: PickupMouse;
20..24: Wait(200+Random(2500));
40..42: GameTab(RandomRange(tab_Combat, tab_Notes));
60..64: Wait(500 + Random(1500));
80..82: RandomAngle(1);
95..97: MakeCompass(RandomRange(0, 340));
end;

MakeCompass('n');
GameTab(Tab_Inv);
MMouse(MousePos.x, MousePos.y, 0, 0);
end;

procedure WalkToMine;
var
MiddleOfTPA: TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;
fern1, fern2, threeferns, ferncluster, lastfern, minespot, x, y:Integer;

begin
if not LoggedIn then Exit;
try wait(5)
MakeCompass('n');
Wait(200);

fern1 := DTMFromString('mQwAAAHicY2ZgYBABYnEoFgJiPiAWBuIsJwEGn2IzMOYH8mGYCQkDAQB3igNS');
fern2 := DTMFromString('mLgAAAHicY2JgYKhkYmCoBWEguwKIW335GHyLrRj4gWwQZoZiBgYAczQD8A==');
threeferns := DTMFromString('mbQAAAHicY2VgYBABYg4glgFiOSBmB2IpIOYDYl4oHyTf4ssFxz7FZmDMDxRHx0xImBmKwQAAQesFeQ==');
ferncluster := DTMFromString('mbQAAAHicY2VgYOADYlYg5oXSXEAsDOWzQ8WYgDjLSYChxZcLTIOwT7EZAz9QHB0zoWFmBigAAA/GBL0=');
lastFern := DTMFromString('mWAAAAHicY2FgYChkYmAoheIcIO4BijUDcTkQZwJxgzcXg72eCEOagwCDR6EZAz9QDBmzADEzEgYBAJWhBwc=');//DTMFromString('mggAAAHicY2NgYChgYmAoBeISKM4G4nog7gXKtQNxAxBXAHEmEFcBcbqDAEOovTSDQrgQmO1ZaAbG/EA5bJgJB4YAAI+RCqU=');
minespot:= DTMFromString('mQwAAAHicY2ZgYKhlYmBoBeKJQDwTyJ8AxP1AbKrJCcf8QD4MMyNhIAAA3eUEwA==');

if FindDTM(fern1, x, y, MMX1, MMCY, MMCX, MMY2) then
begin
Mouse(x , y , 0, 0, true);
Writeln('Walking to Mine from : Bank step 1 complete');
Flag;
end else
LogoutWhy('Walking failed Mine from : Bank step 1 complete');

if FindDTM(fern2, x, y, MMCX - 20, MMCY + 20, MMX2, MMY2) then
begin
Mouse(x + 12, y + 25, 2, 2, true);
Writeln('Walking to Mine from : Bank step 2 complete');
Flag;
end else
LogoutWhy('Walking failed Mine from : Bank step 2 complete');

if FindDTM(threeferns, x, y, MMCX , MMCY , MMX2, MMY2) then
begin
Mouse(x - 8, y + 10, 2, 2, true);
Writeln('Walking to Mine from : Bank step 3 complete');
Flag;
end else
LogoutWhy('Walking failed Mine from : Bank step 3 complete');

if FindDTM(ferncluster, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 18, y , 2, 2, true);
Writeln('Walking to Mine from : Bank step 4 complete');
Flag;
end else
LogoutWhy('Walking failed Mine from : Bank step 4 complete');

if FindDTM(lastfern, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 5, y , 2, 2, true);
Writeln('Walking to Mine from : Bank step 5 complete');
Flag;
end else
LogoutWhy('Walking failed Mine from : Bank step 5 complete');

if FindColorsPie(TPA, MyFindColor('road', True), 15, 190, 210, 40, 70,MMX1, MMCY, MMCX, MMY2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x - 5 , MiddleOfTPA.y + 14, 2, 2, true);
Flag;
Writeln('Walking to Mine from : Bank step 6 complete');
end else
LogoutWhy('walking failed Mine from : Bank step 6 complete');

if FindDTM(minespot, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 18, y , 2, 2, true);
Writeln('Walking to Mine from : Bank step 7 complete');
Flag;
end else
LogoutWhy('Walking failed Mine from : Bank step 7 complete');


finally
FreeDTM(fern1);
FreeDTM(fern2);
FreeDTM(threeferns);
FreeDTM(ferncluster);
FreeDTM(lastfern);
FreeDTM(minespot);
end;
end;

procedure WalkToBankFromMine;
var
MiddleOfTPA: TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;
Tree, Tree2, Tree3, Tree4, TreeSpin, x, y:Integer;

begin
if not LoggedIn then Exit;
try wait(5)
MakeCompass('n');
Wait(200);
Tree:= DTMFromString('mbQAAAHicY2VgYGhhYmDogeIOIK4HYkuguDMQ+wNxOBDrAnGzOztDpg0vg1IwP5j2zjVm4AeKo2NmLBgMAEN/CAA=');
Tree2:= DTMFromString('mWAAAAHicY2FgYChgYmBIAeISIM4AYj2gmA4QuwGxIxCn2Qgx2GuJgWmPXAsGfqAYMgZqYWBGwiAAAEO4Bbk=');
Tree3 := DTMFromString('mLgAAAHicY2JgYAhmYmAIB2IlIFseiJt9uRi8i80Y+IFsEAZKMbAwgAAAT7wC5A==');
Tree4:= DTMFromString('mQwAAAHicY2ZgYKhlYmBoAOIqIDYG8nWAWA+Im325GLyLzcCYH8iHYaAyBmYoBgIA1TYFBQ==');
TreeSpin:= DTMFromString('mQwAAAHicY2ZgYOhhYmCYCMS9QKwM5EsBsQQQp9kIMdhriTHIB4sw8AP5MAxUxsAMxUAAALSKA/c=');

Writeln('Walking to Bank from : Mine');
if FindColorsPie(TPA, MyFindColor('road', True), 15, 390, 350, 40, 72,MMCX - 20, MMY1, MMX2, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y - 10, 5, 5, true);
Writeln('Walking to Bank from : Mine step 1 complete');
Flag;
end else
LogoutWhy('walking failed Bank from : Mine step 1 complete');

if FindDTM(TreeSpin, x, y, MMCX, MMY1, MMX2, MMY2) or
FindSymbol(x, y, 'spin') then
begin
Mouse(x - 5, y , 2, 2, true);
Writeln('Walking to Bank from : Mine step 2 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Mine step 2 complete');

if FindDTM(Tree, x, y, MMCX, MMY1, MMX2, MMY2) then
begin
Mouse(x + 5, y - 15, 2, 2, true);
Writeln('Walking to Bank from : Mine step 3 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Mine step 3 complete');

if FindDTM(Tree2, x, y, MMCX - 25, MMY1, MMX2, MMY2) then
begin
Mouse(x - 5, y - 8, 2, 2, true);
Writeln('Walking to Bank from : Mine step 4 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Mine step 4 complete');

if FindDTM(Tree3, x, y, MMX1, MMY1, MMCX, MMCY) then
begin
Mouse(x - 8, y + 8, 2, 2, true);
Writeln('Walking to Bank from : Mine step 5 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Mine step 5 complete');

if FindDTM(Tree4, x, y, MMCX - 15 , MMY1, MMX2, MMY2) then
begin
Mouse(x - 6, y - 8, 2, 2, true);
Writeln('Walking to Bank from : Mine step 6 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Mine step 6 complete');

if FindColorsPie(TPA, MyFindColor('bank', True), 15, 30, 90, 40, 72,MMCX , MMY1, MMX2, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y , 2, 2, true);
Writeln('Walking to Bank from : Mine step 7 complete');
Flag;
end else
LogoutWhy('walking failed Bank from : Mine step 7 complete');


finally
FreeDTM(Tree);
FreeDTM(Tree2);
FreeDTM(Tree3);
FreeDTM(Tree4);
FreeDTM(TreeSpin);
end;
end;

Procedure WalkToPottery;
var
MiddleOfTPA: TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;
fern1, fern2, threeferns, ferncluster, lastfern, minespot, x, y:Integer;

begin
if not LoggedIn then Exit;
try wait(5)
MakeCompass('n');
Wait(200);

fern1 := DTMFromString('mQwAAAHicY2ZgYBABYnEoFgJiPiAWBuIsJwEGn2IzMOYH8mGYCQkDAQB3igNS');
fern2 := DTMFromString('mLgAAAHicY2JgYKhkYmCoBWEguwKIW335GHyLrRj4gWwQZoZiBgYAczQD8A==');
threeferns := DTMFromString('mbQAAAHicY2VgYBABYg4glgFiOSBmB2IpIOYDYl4oHyTf4ssFxz7FZmDMDxRHx0xImBmKwQAAQesFeQ==');
ferncluster := DTMFromString('mbQAAAHicY2VgYOADYlYg5oXSXEAsDOWzQ8WYgDjLSYChxZcLTIOwT7EZAz9QHB0zoWFmBigAAA/GBL0=');
lastFern := DTMFromString('mWAAAAHicY2FgYChkYmAoheIcIO4BijUDcTkQZwJxgzcXg72eCEOagwCDR6EZAz9QDBmzADEzEgYBAJWhBwc=');//DTMFromString('mggAAAHicY2NgYChgYmAoBeISKM4G4nog7gXKtQNxAxBXAHEmEFcBcbqDAEOovTSDQrgQmO1ZaAbG/EA5bJgJB4YAAI+RCqU=');
minespot:= DTMFromString('mQwAAAHicY2ZgYKhlYmBoBeKJQDwTyJ8AxP1AbKrJCcf8QD4MMyNhIAAA3eUEwA==');

if FindDTM(fern1, x, y, MMX1, MMCY, MMCX, MMY2) then
begin
Mouse(x , y , 0, 0, true);
Writeln('Walking to Pottery from : Bank step 1 complete');
Flag;
end else
LogoutWhy('Walking failed Pottery from : Bank step 1 complete');

if FindDTM(fern2, x, y, MMCX - 15, MMCY + 20, MMX2, MMY2) then
begin
Mouse(x + 12, y + 25, 2, 2, true);
Writeln('Walking to Pottery from : Bank step 2 complete');
Flag;
end else
LogoutWhy('Walking failed Pottery from : Bank step 2 complete');

if FindDTM(threeferns, x, y, MMCX , MMCY , MMX2, MMY2) then
begin
Mouse(x - 8, y + 8, 2, 2, true);
Writeln('Walking to Pottery from : Bank step 3 complete');
Flag;
end else
LogoutWhy('Walking failed Pottery from : Bank step 3 complete');

if FindDTM(ferncluster, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 18, y , 2, 2, true);
Writeln('Walking to Pottery from : Bank step 4 complete');
Flag;
end else
LogoutWhy('Walking failed Pottery from : Bank step 4 complete');

if FindDTM(lastfern, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 5, y , 2, 2, true);
Writeln('Walking to Pottery from : Bank step 5 complete');
Flag;
end else
LogoutWhy('Walking failed Pottery from : Bank step 5 complete');

if FindColorsPie(TPA, MyFindColor('road', True), 15, 190, 210, 40, 70,MMX1, MMCY, MMCX, MMY2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x - 5 , MiddleOfTPA.y + 14, 2, 2, true);
Flag;
Writeln('Walking to Pottery from : Bank step 6 complete');
end else
LogoutWhy('walking failed Pottery from : Bank step 6 complete');

if FindSymbol(x, y, 'pot') then
begin
Mouse(x , y , 2, 2, true);
Writeln('Walking to Pottery from : Bank step 7 complete');
Flag;
end else
LogoutWhy('Walking failed Pottery from : Bank step 7 complete');


finally
FreeDTM(fern1);
FreeDTM(fern2);
FreeDTM(threeferns);
FreeDTM(ferncluster);
FreeDTM(lastfern);
FreeDTM(minespot);
end;
end;

Procedure WalkToBankFromPottery;
var
MiddleOfTPA: TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;
Tree, Tree2, Tree3, Tree4, TreeSpin, x, y:Integer;

begin
if not LoggedIn then Exit;
try wait(5)
MakeCompass('n');
Wait(200);
Tree:= DTMFromString('mbQAAAHicY2VgYGhhYmDogeIOIK4HYkuguDMQ+wNxOBDrAnGzOztDpg0vg1IwP5j2zjVm4AeKo2NmLBgMAEN/CAA=');
Tree2:= DTMFromString('mWAAAAHicY2FgYChgYmBIAeISIM4AYj2gmA4QuwGxIxCn2Qgx2GuJgWmPXAsGfqAYMgZqYWBGwiAAAEO4Bbk=');
Tree3 := DTMFromString('mLgAAAHicY2JgYAhmYmAIB2IlIFseiJt9uRi8i80Y+IFsEAZKMbAwgAAAT7wC5A==');
Tree4:= DTMFromString('mQwAAAHicY2ZgYKhlYmBoAOIqIDYG8nWAWA+Im325GLyLzcCYH8iHYaAyBmYoBgIA1TYFBQ==');
TreeSpin:= DTMFromString('mQwAAAHicY2ZgYOhhYmCYCMS9QKwM5EsBsQQQp9kIMdhriTHIB4sw8AP5MAxUxsAMxUAAALSKA/c=');

Writeln('Walking to Bank from : Pottery');
if FindColorsPie(TPA, MyFindColor('road', True), 15, 0, 30, 30, 60,MMCX - 5, MMY1, MMX2, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y - 10, 5, 5, true);
Writeln('Walking to Bank from : Pottery step 1 complete');
Flag;
end else
LogoutWhy('walking failed Bank from : Pottery step 1 complete');

if FindDTM(TreeSpin, x, y, MMCX, MMY1, MMX2, MMY2) or
FindSymbol(x, y, 'spin') then
begin
Mouse(x - 5, y , 2, 2, true);
Writeln('Walking to Bank from : Pottery step 2 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Pottery step 2 complete');

if FindDTM(Tree, x, y, MMCX, MMY1, MMX2, MMY2) then
begin
Mouse(x + 5, y - 15, 2, 2, true);
Writeln('Walking to Bank from : Pottery step 3 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Pottery step 3 complete');

if FindDTM(Tree2, x, y, MMCX - 25, MMY1, MMX2, MMY2) then
begin
Mouse(x - 5, y - 8, 2, 2, true);
Writeln('Walking to Bank from : Pottery step 4 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Pottery step 4 complete');

if FindDTM(Tree3, x, y, MMX1, MMY1, MMCX, MMCY) then
begin
Mouse(x - 8, y + 8, 2, 2, true);
Writeln('Walking to Bank from : Pottery step 5 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Pottery step 5 complete');

if FindDTM(Tree4, x, y, MMCX - 15 , MMY1, MMX2, MMY2) then
begin
Mouse(x - 6, y - 8, 2, 2, true);
Writeln('Walking to Bank from : Pottery step 6 complete');
Flag;
end else
LogoutWhy('Walking Failed Bank from : Pottery step 6 complete');

if FindColorsPie(TPA, MyFindColor('bank', True), 15, 30, 90, 40, 72,MMCX , MMY1, MMX2, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y , 2, 2, true);
Writeln('Walking to Bank from : Pottery step 7 complete');
Flag;
end else
LogoutWhy('walking failed Bank from : Pottery step 7 complete');

finally
FreeDTM(Tree);
FreeDTM(Tree2);
FreeDTM(Tree3);
FreeDTM(Tree4);
FreeDTM(TreeSpin);
end;
end;

Procedure WalkToWater;
var
x, y:integer;
MiddleOfTPA: TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;

begin
if not LoggedIn then Exit;

MakeCompass('n');
Wait(200);

if FindSymbolin(x, y, 'water', 564, 19, 607, 55 ) then
begin
Mouse(x + 10, y + 10, 2, 2, true);
Flag;
Writeln('Walking to Water from : Bank step 1 complete');
end else
begin
if FindColorsPie(TPA, MyFindColor('road2', True), 15, 290, 320, 50, 70,MMX1, MMCY, MMCX, MMY2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y , 2, 2, true);
Flag;
Writeln('Walking to Water from : Bank step 1 complete');
end else
LogoutWhy('walking failed Water from : Bank step 1 complete');
end;
end;

Procedure WalkToBankFromWater;
var
MiddleOfTPA: TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;

begin
if not LoggedIn then Exit;
MakeCompass('n');
Wait(200);

if FindColorsPie(TPA, MyFindColor('bank', True), 15, 120, 150, 40, 72,MMCX , MMCY, MMX2, MMY2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y + 10, 2, 2, true);
Writeln('Walking to Bank from : Mine step 7 complete');
Flag;
end else
LogoutWhy('walking failed Bank from : Mine step 7 complete');

end;

function WeStillMining: boolean;
var
T, MineTime, count: integer;
begin
count:= InvCount;
Flag;
Wait(200 +Random(200));
if not LoggedIn or (Invfull) then exit;
T := GetSystemTime; //used to get mine time
MineTime := 5000 + random(5000); //how long to mine a rock for
Writeln('Mining started');
repeat
if FindBlackChatMessage('no ore') then break;
if not (FindBlackChatMessage('swing your pick')) then
begin
if FindBlackChatMessage('manage') then break;
end;
if InvCount > count then break;
Wait(500 + random(200));
if Invfull then Break;
Antiban;
Result := True; //true if we are still chopping
until ((GetSystemTime - T > MineTime) or (not LoggedIn)) //exit repeat if we reach mine time
FindNormalRandoms;
if (GetSystemTime - T > MineTime) then
Writeln('Took longer then ' + IntToStr(MineTime) + ' to Mine the clay.');
if not LoggedIn then
Writeln('Player not logged in');
if Invfull then
writeln('Invfull starting banking');
Result := False;
end;

function FindObjectTPA(what:String):Boolean;
var
x, y, i, ii: Integer;
ObjectTPA: TPointArray;
ObjectATPA: T2dPointArray;
begin
if not LoggedIn then Exit; //if not logged in exit
try Wait(1);
ColorToleranceSpeed(2);
SetupColour(what);
SetColorSpeed2Modifiers(ColourSetup.HMod, ColourSetup.SMod);
Writeln('Attempting to Find ' +ColourSetup.Colour );
FindColorsSpiralTolerance(MSCX, MSCY, ObjectTPA, ColourSetup.Col, MSX1, MSY1, MSX2, MSY2, ColourSetup.Tol);
ObjectATPA := SplitTPAEx(ObjectTPA, 12, 12); //TPAtoATPAex( 20, 20)
if DebugTheTPA then
begin
DebugATPABounds(ObjectATPA);
//Wait(2000);
end;
if Length(ObjectATPA) = 0 then Exit; //if the split returns nothing TreeATPA will be empty so
SortATPAFromFirstPoint(ObjectATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point
if DebugTheTPA then
begin
Writeln('ATPA After Sort');
DebugATPA(ObjectATPA, '');
end;
ii := High(ObjectATPA);
for i := 0 to ii do //from 0 first entry in array to ii highest entry
begin
MiddleTPAEx(ObjectATPA[i], x, y);//find middle of array entry
MMouse(x, y, 3, 3);
Wait(300);
if WaitUpTextMulti(ColourSetup.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 MineIt;
var
x, y, Fail: Integer;
begin
if not LoggedIn then Exit; //if not logged in exit
Writeln('Attempting to Mine Clay ');
repeat
if not FindObjectTPA('clayrock') then
begin
Writeln('Could not find tree Trying Failsafe Finder');
if FindObj(x, y, 'ine', ColourSetup.Col, ColourSetup.Tol) then //use normal find object function as failsafe
begin
Writeln('Found Clay using FindObj');
Mouse(x, y, 0, 0, True);
end else
begin
Writeln('Could not find Clay 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
Writeln('Script failed to find Clay');
Writeln('Even after 15 attempts');
Writeln('Script will Terminate');
Fail := 0; //Resetting for next player
Writeln('loging out');
end;
end;
end;
Flag;
Wait(500+Random(500))
if not WeStillMining then
begin
Continue; //restarts procedure
end;
AntiBan;
until((InvFull) or (not LoggedIn)); //if inventory is full
if InvFull then
Writeln('Inventory Full Banking');
Writeln('Mined '+inttostr(CountItemsBlackLine(62, 1)));
end;

Procedure WetClay;
var
i, b, bb, x, y:integer;
Clay, SoftClay:TBox;
begin
for i:=1 to 28 do
begin
Clay:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Clay.X1, Clay.Y1, Clay.X2, Clay.Y2 ) = 62 then
begin
Writeln('Clay Found, Clicking it to be wetted');
MouseBox(Clay.X1 + 5, Clay.Y1 + 5, Clay.X2 - 5, Clay.Y2 - 5, 1)
Flag;
Wait(500+Random(800));
if FindObjectTPA('well')then
begin
Flag;
Wait(1500+Random(800));
if FindText(x, y, 'Soft clay', 'StatChars', 235, 433, 283, 452 ) then
begin
Mouse(x, y, 2, 2, true);
Writeln('Clay and Water mixing');
repeat
Wait(500+Random(500));
bb:=0;
for b:=1 to 28 do
begin
SoftClay:= InvBox(b)
if (CountColor(SRL_OUTLINE_BLACK, SoftClay.X1, SoftClay.Y1, SoftClay.X2, SoftClay.Y2 ) = 67) or (CountColor(SRL_OUTLINE_BLACK, SoftClay.X1, SoftClay.Y1, SoftClay.X2, SoftClay.Y2 ) = 0 ) then
begin
inc(bb);
Writeln('Total Soft Clay so far is including spaces:'+inttostr(bb));
Wait(100+Random(100));
end;
end;
until(bb = 28)
end;
end else
begin
LogoutWhy('Could not find well Loging out');
end;
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('e');
Wait(300); //screen settel
FindColorsSpiralTolerance(x, y, TPA, MyFindColor('bankbooth', 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 PinScreen then //if it fins pin screen, enter pin
begin
InPin(Players[CurrentPlayer].Pin);
end;
if BankScreen then
begin
Result:= True;
Writeln('Bank has been opened');
Wait(500+Random(500));
Exit;
end;
end;
end;
end;

Procedure BankIt(BL:integer);
var
i:integer;
Clay:TBox;
begin
if MyOpenBank then
begin
if Players[CurrentPlayer].Booleans[1] then
begin
DepositAll;
Wait(500+random(800));
Writeln('Banking Done');
CloseBank;
end else
begin
for i:=1 to 28 do
begin
Clay:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Clay.X1, Clay.Y1, Clay.X2, Clay.Y2 ) = BL then
begin
Writeln('Clay Found, Banking it');
MouseBox(Clay.X1 + 5, Clay.Y1 + 5, Clay.X2 - 5, Clay.Y2 - 5, 2)
ChooseOptionMulti(['All', 'll', 'Al']);
Wait(500+Random(800));
end;
end;
Writeln('Banking Done');
CloseBank;
end;
end else
begin
Writeln('Failed to open Bank, logging out');
LogoutWhy('Failed to bank items');
end;
MakeCompass('n');
end;

Procedure EquipmentCheck;
var
i:integer;
item:TPoint;
Items:TBox;
begin
if (not (LoggedIn)) then Exit;
Gametab(tab_Equip)
if CountColor(SRL_OUTLINE_BLACK, 568, 288, 604, 322 ) = 98 then //takes off weapon/pic
begin
Writeln('Pic Found equiped');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := True; //true if equiped
Exit;
end else
begin
Gametab(tab_Inv)
Wait(500);
for i:=1 to 28 do
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Pic Found in Inventory');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := False;
Exit;
end;
end;
end;
If (not Players[CurrentPlayer].Booleans[0]) then
begin
Writeln('No Pic found, checking bank');
MakeCompass('W');
if MyOpenBank then
begin
FixBankTab;
FixBank;
DepositAll; //clears inventory
for i:=1 to 40 do
begin
Items:= BankIndexToMSBox(i);
item:= BankIndexToMSPoint(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1 - 5, Items.Y1 + 11, Items.X2 + 2, Items.Y2 + 5 ) = 49 then
begin
Writeln('possible match for pic');
MouseBox(Items.X1, Items.Y1, Items.X2, Items.Y2, 3);
Wait(500);
If IsUpTextMultiCustom(['pickaxe', 'ckaxe', 'pick'])then
begin
Writeln('Pic Found, withdrawing it');
Mouse(item.x + 15, item.y + 15, 0, 0, True);
Wait(500+Random(500));
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
CloseBank;
for i:=1 to 28 do
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Trying to equipit');
MouseBox(Items.X1, Items.Y1, Items.X2, Items.Y2, 1);
Wait(600+random(800));
for i:=1 to 28 do //might seem redundent but works
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Pic Found in Inventory');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := False;
Exit;
end else
begin
Writeln('Pic has been equiped');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := True;
Exit;
end;
end;
end;
end;
Exit;
end;
end;
end;
end else
begin
Writeln('Bank not found loging out');
end;
end;
Gametab(tab_Inv); // black count for pic 98 49 in bank stacked
MakeCompass('n');
end;

Procedure Main;
begin
LoginPlayer;
Wait(500+Random(800));
EquipmentCheck;
repeat
if Players[CurrentPlayer].Booleans[10] then
begin
for i:=0 to Players[CurrentPlayer].Integers[10] do
begin
WalkToMine;
MineIt;
WalkToBankFromMine;
BankIt(62);
end;
end;
if Players[CurrentPlayer].Booleans[11] then
begin
for i:=0 to Players[CurrentPlayer].Integers[11] do
begin
WalkToWater;
WetClay;
WalkToBankFromWater;
BankIt(67);
end;
end;
if Players[CurrentPlayer].Booleans[12] then
begin
for i:=0 to Players[CurrentPlayer].Integers[12] do
begin
WalkToPottery;
MineIt;
WalkToBankFromPottery;
BankIt(85);
end;
end;
//BankIt(62); //mined clay 62 soft clay 67 cracked mining 85 same afetr fired
until(not(LoggedIn))
end;
procedure ProgressReport;
begin
end;

begin //62 mined clay black count
SetUpSRL;
ActivateClient;
DeclarePlayers;
AddOnTerminate('ProgressReport'); //on script terminate do progress report
Main;

//EquipmentCheck;
//WalkToMine;
//MineIt;
//WalkToBankFromMine;
//MyOpenBank;
//WalkToWater;
//wetclay;
//WalkToBankFromWater;
//WalkToPottery;
//WalkToBankFromPottery;

end.

Camaro'

2011-04-28 19:30:20

I haven't looked at the script but the thread made me laugh :)

Echo_

2011-04-28 20:27:35

I can't wait for this to come out, I need teh craftin levels!

KingKong

2011-04-28 20:44:46

Sup Ernie, how ya doin mate?

E: I was gonna make meself one of these and you just made it for me :D

Floor66

2011-04-29 01:57:13

Look cool! But I suppose your walking could use some more backups :p

Bobzilla69

2011-04-29 03:07:24

yes the walking is the only problem, it can walks brilliantly but not all ways, but thats like any colour script walking is the hardest, well i think.

good to hear the thread made you laugh :) that was my goal ( Ernie the UrnCrafter sounds good and also )

NCDS

2011-04-29 07:58:09

Just briefly took a glance at the code and I just really have to ask; why not use a loop instead of repeating the same exact FindDTM code ~50 times :confused:

Bobzilla69

2011-04-29 08:01:47

because i use small tweaks on each one, sure i can make a function where is simply use the tweaks as a variable but it wont save that much time would it?

NCDS

2011-04-29 08:06:23

Just gets tedious reading a script that over half is the same thing repeated, not saying it doesn't work.

WT-Fakawi

2011-04-29 08:12:53

From: NCDS
Just gets tedious reading a script that over half is the same thing repeated, not saying it doesn't work.


But that is what you get when you have many posibilites from one color position. As you can see every FindDTM has different coords, different actions for each variable. I wouldn't know how to truncate this. I you do, please help :)

Bobzilla69

2011-04-29 08:17:31

From: NCDS
Just gets tedious reading a script that over half is the same thing repeated, not saying it doesn't work.


I know what you mean, but if i changed it it would be the same, just a smaller function to read over and over.

but thanks for taking your time to go through it :)

buzy working on it atm so will hopefully have it ready for testing today

NCDS

2011-04-29 08:36:19

From: WT-Fakawi
But that is what you get when you have many posibilites from one color position. As you can see every FindDTM has different coords, different actions for each variable. I wouldn't know how to truncate this. I you do, please help :)


From: Bobzilla69
I know what you mean, but if i changed it it would be the same, just a smaller function to read over and over.

but thanks for taking your time to go through it :)

buzy working on it atm so will hopefully have it ready for testing today


If you did want to save space I would suggest making a sort of record for each point which would hold the DTM, and the search box, and the point your searching from (if it changes), then loop the FindDTM function like so:

for i := 0 to High(WalkPointRecords) do
if FindDTM(WalkPoint[i].DTM, WalkPoint[i].SearchBox.x1, WalkPoint[i].SearchBox.y1, etc..) then
begin
//Clicking code here
end;

That way all your walking is done within just a few lines (other than declaring the WalkPoint record of course).

If you really wanted to save space, you could make the record a 2dArray instead of just an array and that way have WalkPoint[0] be to the destination, and WalkPoint[1] be from the destination. Then you would ofcourse just need an extra loop to accommodate for the extra array.

Rich

2011-04-29 08:56:26

You could have a couple of integer arrays with the co-ord differences, then call it as a loop?

NCDS

2011-04-29 09:55:51

From: Rich
You could have a couple of integer arrays with the co-ord differences, then call it as a loop?


Same thing I just explained, only using Records maintains a nice user readability. ;)

Bobzilla69

2011-04-29 10:26:11

Ernie V2

so this is how far i have gotten today.

I have got the mining and wetting clay down and am working on making the urns, which i am currently testing and fine tuning :)

Now Using SPS as Backup Walking

Please excuse all my commented stuff its a work in progress :)

program ErnieUrnCrafter;

{$DEFINE SMART}
{$i SRL\SRL.scar}
{$i SRL\SRL\core\SPS\SPS.simba}
{$i SRL\SRL\Misc\stats.simba}
{$i SRL\SRL\misc\Debug.scar}

{ Ernie the fastest UrnCrafter in the west }

const
World = 23; //world to load ( 0 will load random)
Signed = True; //signed client(true) or unsigned (false)
SRLStats_UserID = ''; // Your SRL Stats Username (ID didnt work for me)
SRLStats_Password = ''; // Your SRL Stats Password


var
DebugTheTPA:Boolean;

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

DebugTheTPA := True; //True if you want to see TPA debug (color only)

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) not currently used, but might be later
Active := True; //Player Active?
WorldInfo := [False, -1, False]; //members, world (-1 is random), pvp

Booleans[10] := True; //want to mine clay
Booleans[11] := True; //want to wet clay
Booleans[12] := True; //want to make urns

Integers[10] := 1; //trips to mine
Integers[11] := 1; //trips to well
Integers[12] := 1; //trips to pottery shed

Strings[0] := ''; //if you want a specific urn, else leave blank

end;

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

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

var
ColourSetup : Colour; //allows to set specific colors for trees

procedure SetupColour(what:string);
begin
case Lowercase(what) of
'clayrock': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 8570605; //color of what we cutting
Tol := 6; // tolerance for finding tree
HMod := 0.02; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 3.11; //30
UpText := [ 'ine Rock', 'ine'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Clay Rock'; //tree name
end;
end;
'furnace': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 2447024; //color of what we cutting
Tol := 13; // tolerance for finding tree
HMod := 0.06; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 1.91; //30
UpText := [ 'Pottery Oven', 'Oven', 'ven'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Pottery Oven'; //tree name
end;
end;
'potterwheel': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 3101036; //color of what we cutting
Tol := 1; // tolerance for finding tree
HMod := 0.16; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 1.00; //30
UpText := [ 'Potter', 'Wheel', 'heel', 'otter'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Pottery Wheel'; //tree name
end;
end;
'potteryhouse': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 1984857; //color of what we cutting
Tol := 0; // tolerance for finding tree
HMod := 0.00; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.00; //30
UpText := [ 'alk here', 'alk' ] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Pottery House'; //tree name
end;
end;
'door': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 2449020; //color of what we cutting
Tol := 1; // tolerance for finding tree
HMod := 0.07; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.67; //30
UpText := [ 'pen Door', 'pen'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Door'; //tree name
end;
end;
'well': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 3032403; //color of what we cutting
Tol := 3; // tolerance for finding tree
HMod := 0.15; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.21; //30
UpText := [ 'Well', 'ell'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Well'; //tree name
end;
end;
end;
try wait(5);
SetColorSpeed2Modifiers(ColourSetup.HMod, ColourSetup.SMod);
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;

Function MyFindColor(what:String; MM: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
'bankbooth': begin
color := 4018267;
bL := 58;
bH := 63;
gL := 77;
gH := 82;
rL := 88;
rH := 94;
colTol:= 4; //use to alter tollerance
end;
'bank': begin
color := 988754;
bL := 11;
bH := 19;
gL := 17;
gH := 26;
rL := 71;
rH := 92;
colTol:= 12; //use to alter tollerance
end;
'road': begin
color := 4219502;
bL := 59;
bH := 68;
gL := 93;
gH := 103;
rL := 103;
rH := 116;
colTol:= 9;
end;
'road2': begin
color := 8948367;
bL := 134;
bH := 137;
gL := 135;
gH := 140;
rL := 139;
rH := 146;
colTol:= 4;
end;
end;
Result := 0;
if MM 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 MM 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 LogoutWhy(Why:string); //idea from BobboHobbo script
begin
WriteLn(Why);
Players[CurrentPlayer].Active := False; //stes player to inactive
Logout;
end;
{
Point(37, 390), Point(142, 459) cooking
Point(144, 393), Point(247, 457) fishing
Point(248, 392), Point(355, 457) mining
Point(356, 391), Point(461, 458) smelting
Point(270, 391), Point(376, 457) woodcutting only when scrolled to the right
Point(377, 392), Point(479, 458) prayer

Point(91, 393), Point(201, 460) cracked
Point(204, 392), Point(314, 459) fragile
Point(319, 392), Point(425, 458) Mining urn
Point(175, 394), Point(256, 456) impious
Point(262, 395), Point(341, 457) accursed

Point(497, 423) scrol right 497, 423
Point(21, 413) scroll left 21, 413
}
Function HighestUrn:TVariantArray; //not good looking but it workes
var //urns of same level will only have first one made from list
Level:integer;
What:String;
begin
Level:= Players[CurrentPlayer].Integers[20];
What:= lowercase(Players[CurrentPlayer].Strings[0]);
if Level = 0 then LogoutWhy('Crafting Level not found');
if InRange(Level, 1, 1) or (What = 'cracked mining') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [248, 392, 355, 457, 92, 393,
200, 456, 'racked', 'ining'];
exit;
end; //Cracked mining urn 1

if InRange(Level, 2, 3) or (What = 'cracked cooking') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [37, 390, 142, 459, 84, 392,
196, 455, 'racked', 'ooking'];
exit;
end;//Cracked cooking urn2

if InRange(Level, 2, 3) or (What = 'cracked fishing') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [144, 393, 247, 457, 86, 393,
198, 458,'racked', 'ishing'];
exit;
end;//Cracked fishing urn 2

if InRange(Level, 2, 3) or (What = 'impious') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [377, 392, 479, 458, 174, 394,
256, 454, 496, 421, 'mpious', 'rayer'];
exit;
end;//Impious urn 2

if InRange(Level, 4, 11) or (What = 'cracked woodcutting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [270, 391, 376, 457, 51, 395,
186, 457, 498, 414, 'racked', 'oodcutting'];
exit;
end;//Cracked woodcutting urn 4

if InRange(Level, 4, 11) or (What = 'cracked smelting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [356, 391, 461, 458, 77, 394,
194, 456, 'racked', 'melting'];
exit;
end;//Cracked smelting urn 4

if InRange(Level, 12, 14) or (What = 'fragile cooking') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [37, 390, 142, 459, 204, 394,
317, 459, 'ragile', 'ooking'];
exit;
end;//Fragile cooking urn 12

if InRange(Level, 15, 16) or (What = 'fragile fishing') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [144, 393, 247, 457, 205, 394,
314, 456, 'fragile', 'fishing'];
exit;
end;//Fragile fishing urn 15

if InRange(Level, 15, 16) or (What = 'fragile woodcutting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [270, 391, 376, 457, 190, 393,
328, 456, 498, 414, 'ragile', 'oodcutting'];
exit;
end;//Fragile woodcutting urn 15

if InRange(Level, 17, 25) or (What = 'fragile mining') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [248, 392, 355, 457, 206, 393 ,
312, 457, 'ragile', 'ining'];
exit;
end;//Fragile mining urn 17

if InRange(Level, 17, 25) or (What = 'fragile smelting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [356, 391, 461, 458, 204, 394,
315, 456, 'ragile', 'melting'];
exit;
end;//Fragile smelting urn 17

if InRange(Level, 26, 31) or (What = 'accursed') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [377, 392, 479, 458, 259, 395,
341, 454, 496, 421, 'ccursed', 'rayer'];
exit;
end;//Accursed urn 26

if InRange(Level, 32, 34) or (What = 'mining') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [248, 392, 355, 457, 321, 395,
425, 456, 'ining', 'ining'];
exit;
end;//Mining urn 32

if InRange(Level, 35, 35) or (What = 'smelting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [356, 391, 461, 458, 327, 395,
442, 452, 'melting', 'melting'];
exit;
end;//Smelting urn 35

if InRange(Level, 36, 40) or (What = 'cooking') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [37, 390, 142, 459, 325, 394,
429, 454, 'ooking', 'ooking'];
exit;
end;//Cooking urn 36

if InRange(Level, 41, 43) or (What = 'fishing') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [144, 393, 247, 457, 323, 393,
431, 457, 'ishing', 'ishing'];
exit;
end;//Fishing urn 41

if InRange(Level, 44, 99) or (What = 'woodcutting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [270, 391, 376, 457 , 336, 395,
463, 454, 498, 414, 'oodcutting', 'oodcutting'];
exit;
end;//Woodcutting urn 44
{
if InRange(Level, , ) or What = '' then Strong Mining Urn (m) 48
if InRange(Level, , ) or What = '' then Strong smelting urn (m) 49
if InRange(Level, , ) or What = '' then Strong cooking urn (m) 51
if InRange(Level, , ) or What = '' then Strong fishing urn (m) 53 //members only urns
if InRange(Level, , ) or What = '' then Decorated mining urn (m) 59
if InRange(Level, , ) or What = '' then Strong woodcutting urn (m) 61
if InRange(Level, , ) or What = '' then Infernal urn (m) 62
if InRange(Level, , ) or What = '' then Decorated fishing urn (m) 76
if InRange(Level, , ) or What = '' then Decorated cooking urn (m) 81 }
end;

procedure AntiBan;
var
MousePos: TPoint;
begin
if (not (LoggedIn)) then Exit;
GetMousePos(MousePos.x, MousePos.y);

case random(100) of
0..4: PickupMouse;
20..24: Wait(200+Random(2500));
40..42: GameTab(RandomRange(tab_Combat, tab_Notes));
60..64: Wait(500 + Random(1500));
80..82: RandomAngle(1);
95..97: MakeCompass(RandomRange(0, 340));
end;

MakeCompass('n');
GameTab(Tab_Inv);
MMouse(MousePos.x, MousePos.y, 0, 0);
end;

Procedure WalkBackup(TPA:TPointArray);
begin
Writeln('Main Walking Failed using backup SPS');
if SPS_WalkPath(TPA) then
begin
Writeln('Walking to Mine from : Bank complete');
end else
LogoutWhy('Main and Backup walking failed Logging out');
end;

procedure WalkToMine;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk: TPointArray;
ATPA : T2DPointArray;
fern1, fern2, threeferns, ferncluster, lastfern, minespot, x, y:Integer;

begin
if not LoggedIn then Exit;
try wait(5)
MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145), point(3957, 1164), point(3945, 1202),
point(3961, 1241), point(3987, 1280), point(3991, 1330), point(3981, 1380),
point(3962, 1431), point(3967, 1479), point(3957, 1497)];

fern1 := DTMFromString('mQwAAAHicY2ZgYBABYnEoFgJiPiAWBuIsJwEGn2IzMOYH8mGYCQkDAQB3igNS');
fern2 := DTMFromString('mLgAAAHicY2JgYKhkYmCoBWEguwKIW335GHyLrRj4gWwQZoZiBgYAczQD8A==');
threeferns := DTMFromString('mbQAAAHicY2VgYBABYg4glgFiOSBmB2IpIOYDYl4oHyTf4ssFxz7FZmDMDxRHx0xImBmKwQAAQesFeQ==');
ferncluster := DTMFromString('mbQAAAHicY2VgYOADYlYg5oXSXEAsDOWzQ8WYgDjLSYChxZcLTIOwT7EZAz9QHB0zoWFmBigAAA/GBL0=');
lastFern := DTMFromString('mWAAAAHicY2FgYChkYmAoheIcIO4BijUDcTkQZwJxgzcXg72eCEOagwCDR6EZAz9QDBmzADEzEgYBAJWhBwc=');//DTMFromString('mggAAAHicY2NgYChgYmAoBeISKM4G4nog7gXKtQNxAxBXAHEmEFcBcbqDAEOovTSDQrgQmO1ZaAbG/EA5bJgJB4YAAI+RCqU=');
minespot:= DTMFromString('mQwAAAHicY2ZgYKhlYmBoBeKJQDwTyJ8AxP1AbKrJCcf8QD4MMyNhIAAA3eUEwA==');

if FindDTM(fern1, x, y, MMX1, MMCY, MMCX, MMY2) then
begin
Mouse(x , y , 0, 0, true);
Writeln('Walking to Mine from : Bank step 1 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
WriteLn('Walking failed Mine from : Bank step 1 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(fern2, x, y, MMCX - 20, MMCY + 20, MMX2, MMY2) then
begin
Mouse(x + 15, y + 25, 2, 2, true);
Writeln('Walking to Mine from : Bank step 2 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
WriteLn('Walking failed Mine from : Bank step 2 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(threeferns, x, y, MMCX , MMCY , MMX2, MMY2) then
begin
Mouse(x - 8, y + 10, 2, 2, true);
Writeln('Walking to Mine from : Bank step 3 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
WriteLn('Walking failed Mine from : Bank step 3 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(ferncluster, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 18, y , 2, 2, true);
Writeln('Walking to Mine from : Bank step 4 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
WriteLn('Walking failed Mine from : Bank step 4 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(lastfern, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 5, y , 2, 2, true);
Writeln('Walking to Mine from : Bank step 5 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
WriteLn('Walking failed Mine from : Bank step 5 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindColorsPie(TPA, MyFindColor('road', True), 15, 190, 210, 40, 70,MMX1, MMCY, MMCX, MMY2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x - 5 , MiddleOfTPA.y + 14, 2, 2, true);
Wait(3000+Random(1000));
Flag;
Writeln('Walking to Mine from : Bank step 6 complete');
end else
begin
WriteLn('walking failed Mine from : Bank step 6 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(minespot, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 25, y , 2, 2, true);
Writeln('Walking to Mine from : Bank step 7 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
WriteLn('Walking failed Mine from : Bank step 7 complete');
WalkBackup(SPSWalk);
end;

finally
FreeDTM(fern1);
FreeDTM(fern2);
FreeDTM(threeferns);
FreeDTM(ferncluster);
FreeDTM(lastfern);
FreeDTM(minespot);
end;
end;

procedure WalkToBankFromMine;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;
Tree, Tree2, Tree3, Tree4, TreeSpin, x, y:Integer;

begin
if not LoggedIn then Exit;
try wait(5)
MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145), point(3957, 1164), point(3945, 1202),
point(3961, 1241), point(3987, 1280), point(3991, 1330), point(3981, 1380),
point(3962, 1431), point(3967, 1479), point(3957, 1497)];

InvertTPA(SPSWalk);

Tree:= DTMFromString('mbQAAAHicY2VgYGhhYmDogeIOIK4HYkuguDMQ+wNxOBDrAnGzOztDpg0vg1IwP5j2zjVm4AeKo2NmLBgMAEN/CAA=');
Tree2:= DTMFromString('mWAAAAHicY2FgYChgYmBIAeISIM4AYj2gmA4QuwGxIxCn2Qgx2GuJgWmPXAsGfqAYMgZqYWBGwiAAAEO4Bbk=');
Tree3 := DTMFromString('mLgAAAHicY2JgYAhmYmAIB2IlIFseiJt9uRi8i80Y+IFsEAZKMbAwgAAAT7wC5A==');
Tree4:= DTMFromString('mQwAAAHicY2ZgYKhlYmBoAOIqIDYG8nWAWA+Im325GLyLzcCYH8iHYaAyBmYoBgIA1TYFBQ==');
TreeSpin:= DTMFromString('mQwAAAHicY2ZgYOhhYmCYCMS9QKwM5EsBsQQQp9kIMdhriTHIB4sw8AP5MAxUxsAMxUAAALSKA/c=');

Writeln('Walking to Bank from : Mine');
if FindColorsPie(TPA, MyFindColor('road', True), 15, 390, 350, 40, 72,MMCX - 20, MMY1, MMX2, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y - 10, 5, 5, true);
Writeln('Walking to Bank from : Mine step 1 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('walking failed Bank from : Mine step 1 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(TreeSpin, x, y, MMCX, MMY1, MMX2, MMY2) or
FindSymbol(x, y, 'spin') then
begin
Mouse(x - 5, y , 2, 2, true);
Writeln('Walking to Bank from : Mine step 2 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Mine step 2 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(Tree, x, y, MMCX, MMY1, MMX2, MMY2) then
begin
Mouse(x + 5, y - 15, 2, 2, true);
Writeln('Walking to Bank from : Mine step 3 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Mine step 3 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(Tree2, x, y, MMCX - 25, MMY1, MMX2, MMY2) then
begin
Mouse(x - 20, y - 10, 2, 2, true);
Writeln('Walking to Bank from : Mine step 4 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Mine step 4 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(Tree3, x, y, MMX1, MMY1, MMCX, MMCY) then
begin
Mouse(x - 8, y + 8, 2, 2, true);
Writeln('Walking to Bank from : Mine step 5 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Mine step 5 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(Tree4, x, y, MMCX - 15 , MMY1, MMX2, MMY2) then
begin
Mouse(x - 6, y - 8, 2, 2, true);
Writeln('Walking to Bank from : Mine step 6 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Mine step 6 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindColorsPie(TPA, MyFindColor('bank', True), 15, 30, 90, 40, 72,MMCX , MMY1, MMX2, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y , 2, 2, true);
Writeln('Walking to Bank from : Mine step 7 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('walking failed Bank from : Mine step 7 complete');
WalkBackup(SPSWalk);
end;

finally
FreeDTM(Tree);
FreeDTM(Tree2);
FreeDTM(Tree3);
FreeDTM(Tree4);
FreeDTM(TreeSpin);
end;
end;

Procedure WalkToPottery;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;
fern1, fern2, threeferns, ferncluster, lastfern, minespot, x, y:Integer;

begin
if not LoggedIn then Exit;
try wait(5)
MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145), point(3957, 1164), point(3945, 1202),
point(3961, 1241), point(3987, 1280), point(3991, 1330), point(3981, 1380),
point(3963, 1430), point(3963, 1464)];

fern1 := DTMFromString('mQwAAAHicY2ZgYBABYnEoFgJiPiAWBuIsJwEGn2IzMOYH8mGYCQkDAQB3igNS');
fern2 := DTMFromString('mLgAAAHicY2JgYKhkYmCoBWEguwKIW335GHyLrRj4gWwQZoZiBgYAczQD8A==');
threeferns := DTMFromString('mbQAAAHicY2VgYBABYg4glgFiOSBmB2IpIOYDYl4oHyTf4ssFxz7FZmDMDxRHx0xImBmKwQAAQesFeQ==');
ferncluster := DTMFromString('mbQAAAHicY2VgYOADYlYg5oXSXEAsDOWzQ8WYgDjLSYChxZcLTIOwT7EZAz9QHB0zoWFmBigAAA/GBL0=');
lastFern := DTMFromString('mWAAAAHicY2FgYChkYmAoheIcIO4BijUDcTkQZwJxgzcXg72eCEOagwCDR6EZAz9QDBmzADEzEgYBAJWhBwc=');//DTMFromString('mggAAAHicY2NgYChgYmAoBeISKM4G4nog7gXKtQNxAxBXAHEmEFcBcbqDAEOovTSDQrgQmO1ZaAbG/EA5bJgJB4YAAI+RCqU=');
minespot:= DTMFromString('mQwAAAHicY2ZgYKhlYmBoBeKJQDwTyJ8AxP1AbKrJCcf8QD4MMyNhIAAA3eUEwA==');

if FindDTM(fern1, x, y, MMX1, MMCY, MMCX, MMY2) then
begin
Mouse(x , y , 0, 0, true);
Writeln('Walking to Pottery from : Bank step 1 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking failed Pottery from : Bank step 1 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(fern2, x, y, MMCX - 15, MMCY + 20, MMX2, MMY2) then
begin
Mouse(x + 12, y + 25, 2, 2, true);
Writeln('Walking to Pottery from : Bank step 2 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking failed Pottery from : Bank step 2 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(threeferns, x, y, MMCX , MMCY , MMX2, MMY2) then
begin
Mouse(x - 8, y + 8, 2, 2, true);
Writeln('Walking to Pottery from : Bank step 3 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking failed Pottery from : Bank step 3 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(ferncluster, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 18, y , 2, 2, true);
Writeln('Walking to Pottery from : Bank step 4 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking failed Pottery from : Bank step 4 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(lastfern, x, y, MMX1, MMCY , MMX2, MMY2) then
begin
Mouse(x - 5, y , 2, 2, true);
Writeln('Walking to Pottery from : Bank step 5 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking failed Pottery from : Bank step 5 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindColorsPie(TPA, MyFindColor('road', True), 15, 190, 210, 40, 70,MMX1, MMCY, MMCX, MMY2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x - 5 , MiddleOfTPA.y + 14, 2, 2, true);
Wait(3000+Random(1000));
Flag;
Writeln('Walking to Pottery from : Bank step 6 complete');
end else
begin
Writeln('walking failed Pottery from : Bank step 6 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindSymbol(x, y, 'pot') then
begin
Mouse(x , y , 2, 2, true);
Writeln('Walking to Pottery from : Bank step 7 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking failed Pottery from : Bank step 7 complete');
WalkBackup(SPSWalk);
end;

Players[CurrentPlayer].Integers[20]:= GetSkillLevel(skill_Crafting); //get crafting level once at pottery
GameTab(Tab_Inv);

finally
FreeDTM(fern1);
FreeDTM(fern2);
FreeDTM(threeferns);
FreeDTM(ferncluster);
FreeDTM(lastfern);
FreeDTM(minespot);
end;
end;

Procedure WalkToBankFromPottery;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;
Tree, Tree2, Tree3, Tree4, TreeSpin, x, y:Integer;

begin
if not LoggedIn then Exit;
try wait(5)
MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145), point(3957, 1164), point(3945, 1202),
point(3961, 1241), point(3987, 1280), point(3991, 1330), point(3981, 1380),
point(3963, 1430), point(3963, 1464)];

InvertTPA(SPSWalk);

Tree:= DTMFromString('mbQAAAHicY2VgYGhhYmDogeIOIK4HYkuguDMQ+wNxOBDrAnGzOztDpg0vg1IwP5j2zjVm4AeKo2NmLBgMAEN/CAA=');
Tree2:= DTMFromString('mWAAAAHicY2FgYChgYmBIAeISIM4AYj2gmA4QuwGxIxCn2Qgx2GuJgWmPXAsGfqAYMgZqYWBGwiAAAEO4Bbk=');
Tree3 := DTMFromString('mLgAAAHicY2JgYAhmYmAIB2IlIFseiJt9uRi8i80Y+IFsEAZKMbAwgAAAT7wC5A==');
Tree4:= DTMFromString('mQwAAAHicY2ZgYKhlYmBoAOIqIDYG8nWAWA+Im325GLyLzcCYH8iHYaAyBmYoBgIA1TYFBQ==');
TreeSpin:= DTMFromString('mQwAAAHicY2ZgYOhhYmCYCMS9QKwM5EsBsQQQp9kIMdhriTHIB4sw8AP5MAxUxsAMxUAAALSKA/c=');

Writeln('Walking to Bank from : Pottery');
if FindColorsPie(TPA, MyFindColor('road', True), 15, 0, 30, 30, 60,MMCX - 5, MMY1, MMX2, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y - 10, 5, 5, true);
Writeln('Walking to Bank from : Pottery step 1 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('walking failed Bank from : Pottery step 1 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(TreeSpin, x, y, MMCX, MMY1, MMX2, MMY2) or
FindSymbol(x, y, 'spin') then
begin
Mouse(x - 5, y , 2, 2, true);
Writeln('Walking to Bank from : Pottery step 2 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Pottery step 2 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(Tree, x, y, MMCX, MMY1, MMX2, MMY2) then
begin
Mouse(x + 5, y - 15, 2, 2, true);
Writeln('Walking to Bank from : Pottery step 3 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Pottery step 3 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(Tree2, x, y, MMCX - 25, MMY1, MMX2, MMY2) then
begin
Mouse(x - 5, y - 8, 2, 2, true);
Writeln('Walking to Bank from : Pottery step 4 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Pottery step 4 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(Tree3, x, y, MMX1, MMY1, MMCX, MMCY) then
begin
Mouse(x - 8, y + 8, 2, 2, true);
Writeln('Walking to Bank from : Pottery step 5 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Pottery step 5 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindDTM(Tree4, x, y, MMCX - 15 , MMY1, MMX2, MMY2) then
begin
Mouse(x - 6, y - 8, 2, 2, true);
Writeln('Walking to Bank from : Pottery step 6 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('Walking Failed Bank from : Pottery step 6 complete');
WalkBackup(SPSWalk);
Exit;
end;

if FindColorsPie(TPA, MyFindColor('bank', True), 15, 30, 90, 40, 72,MMCX , MMY1, MMX2, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y , 2, 2, true);
Writeln('Walking to Bank from : Pottery step 7 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('walking failed Bank from : Pottery step 7 complete');
WalkBackup(SPSWalk);
end;

finally
FreeDTM(Tree);
FreeDTM(Tree2);
FreeDTM(Tree3);
FreeDTM(Tree4);
FreeDTM(TreeSpin);
end;
end;

Procedure WalkToWater;
var
x, y:integer;
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;

begin
if not LoggedIn then Exit;

MakeCompass('n');
Wait(200);
SPSWalk:= [point(3966, 1104)];

if FindSymbolin(x, y, 'water', 564, 19, 607, 55 ) then
begin
Mouse(x + 10, y + 10, 2, 2, true);
Wait(3000+Random(1000));
Flag;
Writeln('Walking to Water from : Bank step 1 complete');
end else
begin
if FindColorsPie(TPA, MyFindColor('road2', True), 15, 300, 320, 50, 60,MMX1, MMY1, MMCX, MMCY, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y , 2, 2, true);
Flag;
Writeln('Walking to Water from : Bank step 1 complete');
end else
begin
Writeln('walking failed Water from : Bank step 1 complete');
WalkBackup(SPSWalk);
end;
end;
end;

Procedure WalkToBankFromWater;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;

begin
if not LoggedIn then Exit;
MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145)];

if FindColorsPie(TPA, MyFindColor('bank', True), 15, 120, 150, 40, 72,MMCX , MMCY, MMX2, MMY2, mmcx, mmcy)then
begin
MiddleOfTPA:= MiddleTPA(TPA);
if DebugTheTPA then DebugTPA(TPA, '');
Mouse(MiddleOfTPA.x , MiddleOfTPA.y + 10, 2, 2, true);
Writeln('Walking to Bank from : Mine step 7 complete');
Wait(3000+Random(1000));
Flag;
end else
begin
Writeln('walking failed Bank from : Mine step 7 complete');
WalkBackup(SPSWalk);
end;
end;

function WeStillMining: boolean;
var
T, MineTime, count, x, y, ColCount: integer;
Search:TBox;
begin
GetMousePos(x, y);
Search.X1 := x - 10;
Search.Y1 := y - 10;
Search.X2 := x + 10;
Search.Y2 := y + 10;
SetupColour('clayrock');
ColCount := CountColorTolerance(ColourSetup.Col, Search.X1, Search.Y1, Search.X2, Search.Y2, 15);
//Writeln('Starting Colour Count :'+inttostr(ColCount));
count:= InvCount;
Flag;
Wait(200 +Random(200));
if not LoggedIn or (Invfull) then exit;
T := GetSystemTime; //used to get mine time
MineTime := 5000 + random(5000); //how long to mine a rock for
Writeln('Mining started');
repeat
//Writeln('In Loop Colour Count :'+inttostr(CountColorTolerance(ColourSetup.Col, Search.X1, Search.Y1, Search.X2, Search.Y2, ColourSetup.Tol )));
if (not CountColorTolerance(ColourSetup.Col, Search.X1, Search.Y1, Search.X2, Search.Y2, 15 ) = ColCount) then Exit;
if FindBlackChatMessage('no ore') then break;
if not (FindBlackChatMessage('swing your pick')) then
begin
if FindBlackChatMessage('manage') then break;
end;
if InvCount > count then break;
Wait(500 + random(200));
if Invfull then Break;
Antiban;
Result := True; //true if we are still chopping
until ((GetSystemTime - T > MineTime) or (not LoggedIn)) //exit repeat if we reach mine time
FindNormalRandoms;
if (GetSystemTime - T > MineTime) then
Writeln('Took longer then ' + IntToStr(MineTime) + ' to Mine the clay.');
if not LoggedIn then
Writeln('Player not logged in');
if Invfull then
writeln('Invfull starting banking');
Result := False;
end;

function FindObjectTPA(what:String):Boolean;
var
x, y, i, ii: Integer;
ObjectTPA: TPointArray;
ObjectATPA: T2dPointArray;
begin
if not LoggedIn then Exit; //if not logged in exit
try Wait(1);
ColorToleranceSpeed(2);
SetupColour(what);
SetColorSpeed2Modifiers(ColourSetup.HMod, ColourSetup.SMod);
Writeln('Attempting to Find ' +ColourSetup.Colour );
FindColorsSpiralTolerance(MSCX, MSCY, ObjectTPA, ColourSetup.Col, MSX1, MSY1, MSX2, MSY2, ColourSetup.Tol);
ObjectATPA := SplitTPAEx(ObjectTPA, 12, 12); //TPAtoATPAex( 20, 20)
if DebugTheTPA then
begin
DebugATPABounds(ObjectATPA);
//Wait(2000);
end;
if Length(ObjectATPA) = 0 then Exit; //if the split returns nothing TreeATPA will be empty so
SortATPAFromFirstPoint(ObjectATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point
if DebugTheTPA then
begin
Writeln('ATPA After Sort');
DebugATPA(ObjectATPA, '');
end;
ii := High(ObjectATPA);
for i := 0 to ii do //from 0 first entry in array to ii highest entry
begin
MiddleTPAEx(ObjectATPA[i], x, y);//find middle of array entry
MMouse(x, y, 3, 3);
Wait(100);
if WaitUpTextMulti(ColourSetup.UpText , 200) 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 MineIt;
var
x, y, Fail: Integer;
begin
if not LoggedIn then Exit; //if not logged in exit
Writeln('Attempting to Mine Clay ');
repeat
if not FindObjectTPA('clayrock') then
begin
Writeln('Could not find tree Trying Failsafe Finder');
if FindObj(x, y, 'ine', ColourSetup.Col, ColourSetup.Tol) then //use normal find object function as failsafe
begin
Writeln('Found Clay using FindObj');
Mouse(x, y, 0, 0, True);
end else
begin
Writeln('Could not find Clay 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
Writeln('Script failed to find Clay');
Writeln('Even after 15 attempts');
Writeln('Script will Terminate');
Fail := 0; //Resetting for next player
Writeln('loging out');
end;
end;
end;
Flag;
Wait(500+Random(500))
if not WeStillMining then
begin
Continue; //restarts procedure
end;
AntiBan;
until((InvFull) or (not LoggedIn)); //if inventory is full
if InvFull then
Writeln('Inventory Full Banking');
Writeln('Mined '+inttostr(CountItemsBlackLine(62, 1)));
end;

Procedure WetClay;
var
i, b, bb, x, y:integer;
Clay, SoftClay:TBox;
begin
for i:=1 to 28 do
begin
Clay:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Clay.X1, Clay.Y1, Clay.X2, Clay.Y2 ) = 62 then
begin
Writeln('Clay Found, Clicking it to be wetted');
MouseBox(Clay.X1 + 5, Clay.Y1 + 5, Clay.X2 - 5, Clay.Y2 - 5, 1)
Flag;
Wait(500+Random(800));
if FindObjectTPA('well')then
begin
Flag;
Wait(1500+Random(800));
if FindText(x, y, 'Soft clay', 'StatChars', 235, 433, 283, 452 ) then
begin
Mouse(x, y, 2, 2, true);
Writeln('Clay and Water mixing');
repeat
Wait(500+Random(500));
bb:=0;
for b:=1 to 28 do
begin
SoftClay:= InvBox(b)
if (CountColor(SRL_OUTLINE_BLACK, SoftClay.X1, SoftClay.Y1, SoftClay.X2, SoftClay.Y2 ) = 67) or (CountColor(SRL_OUTLINE_BLACK, SoftClay.X1, SoftClay.Y1, SoftClay.X2, SoftClay.Y2 ) = 0 ) then
begin
inc(bb);
Writeln('Total Soft Clay so far is including spaces:'+inttostr(bb));
Wait(50+Random(50));
end;
end;
until(bb = 28)
end;
end else
begin
LogoutWhy('Could not find well Loging out');
end;
end;
end;
end;
{
Picked colour: 4082000 at (37, 390 ,142, 459) cooking
Picked colour: 4477273 at (144, 393 ,247, 457) fishing
Picked colour: 4477273 at (248, 392 ,355, 457) mining
Picked colour: 4345686 at (356, 391, 461, 458) smelting
Picked colour: 4345686 at (270, 391 ,376, 457) woodcutting only when scrolled to the right
Picked colour: 4477273 at (377, 392, 479, 458) prayer

Picked colour: 4477273 at (91, 393 ,201, 460) cracked
Picked colour: 4477273 at (204, 392 ,314, 459) fragile
Picked colour: 4477273 at (319, 392, 425, 458) Mining urn

//scrol right 497, 423 scroll left 21, 413
}

Procedure MakeUrns;
var
x, y, Top, b, bb:Integer;
Search:TVariantArray;
Urn:TBox;
FireUrn:TPoint;
begin
GameTab(Tab_Inv);
SetupColour('potterwheel');
if not FindObjectTPA('potterwheel') then
begin
Writeln('Could not find tree Trying Failsafe Finder');
if FindObj(x, y, 'otter', ColourSetup.Col, ColourSetup.Tol) then //use normal find object function as failsafe
begin
Writeln('Found Clay using FindObj');
Mouse(x, y, 0, 0, True);
end;
end;
Flag;
Wait(1500+Random(800));
if FindText(x, y, 'Urns', 'StatChars', 148, 433, 180, 449 ) then
begin
Mouse(x, y, 2, 2, True);
Search:= HighestUrn;
Top:= High(Search);
If Length(Search) > 10 then
begin //if scrolling is needed
Writeln('Need to scroll for woodcutting and prayer');
MMouse(Search[8], Search[9], 3, 3);
Wait(2500+Random(800));
end else
begin
Writeln('Make sure we are fully left');
MMouse(21, 414, 3, 3);
Wait(2500+Random(800));
end;
if FindText(x, y, Search[Top], 'StatChars', Search[0], Search[1], Search[2], Search[3] )then
begin
Mouse(x, y, 3, 3, True);
Wait(2500+Random(1000));
if FindText(x, y, Search[Top-1], 'StatChars', Search[4], Search[5], Search[6], Search[7] )then
begin
Mouse(x, y, 3, 3, True);
Wait(1500+random(800));
repeat
Wait(200+Random(200));
ClickToContinue;
bb:=0;
for b:=1 to 28 do
begin
Urn:= InvBox(b)
if (CountColor(SRL_OUTLINE_BLACK, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) > 75) or (CountColor(SRL_OUTLINE_BLACK, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) = 0 ) then
begin
inc(bb);
Writeln('Total Urns so far is including spaces:'+inttostr(bb));
Wait(50+Random(50));
end;
end;
until(bb = 28)
MakeCompass('s')
Wait(300);
for b:=1 to 28 do
begin
Urn:= InvBox(b);
FireUrn:= ItemCoords(b);
if (CountColor(SRL_OUTLINE_BLACK, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) > 60) then
begin
Mouse(FireUrn.x, FireUrn.y, 2, 2, true);
Wait(500+random(250));
If FindObjectTPA('furnace') then
begin
Flag;
Wait(2000+Random(800));
if FindText(x, y, 'urn', 'StatChars', 96, 388, 390, 463 )then
begin
Mouse(x, y, 2, 2, true);
repeat
Wait(300+Random(300));
ClickToContinue;
bb:=0;
for b:=1 to 28 do
begin
Urn:= InvBox(b) //second from bottom black
if (CountColor(659990, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) > 15) or (CountColor(SRL_OUTLINE_BLACK, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) = 0 ) then
begin
inc(bb);
Writeln('Total Urns Fired so far is including spaces:'+inttostr(bb));
Wait(50+Random(50));
end;
end;
until(bb = 28)
end else
begin
//Writeln('Firing urn text not found');
LogoutWhy('Firing urn text not found');
end;
end else
begin
//Writeln('Furnace not found Logging out');
LogoutWhy('Furnace not found Logging out');
end;
end;
end;
end else
begin
//Writeln('Could not Find Urn to craft (fragile, normal)');
LogoutWhy('Could not Find Urn to craft (fragile, normal)');
end;
end else
begin
//Writeln('Could not Find Urn to craft (Mining, Fishing)');
LogoutWhy('Could not Find Urn to craft (Mining, Fishing)');
end;
end else
LogoutWhy('Could not find Pottery Wheel interface, logging out');
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('e');
Wait(300); //screen settel
FindColorsSpiralTolerance(x, y, TPA, MyFindColor('bankbooth', 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 PinScreen then //if it fins pin screen, enter pin
begin
InPin(Players[CurrentPlayer].Pin);
end;
if BankScreen then
begin
Result:= True;
Writeln('Bank has been opened');
Wait(500+Random(500));
Exit;
end;
end;
end;
end;

procedure WithdrawIt(BL:integer);
var
i:integer;
Items:TBox;
begin
if MyOpenBank then //62 = soft clay
begin
DepositAll;
Wait(500+random(800));
for i:=1 to 10 do
begin
Items:= BankIndexToMSBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1 , Items.Y1 + 10, Items.X2 , Items.Y2 ) = BL then
begin
Writeln('Clay Found, Banking it');
MouseBox(Items.X1 + 5, Items.Y1 + 5, Items.X2 - 5, Items.Y2 -5, 2)
ChooseOptionMulti(['All but one', 'll but', 'one']);
Wait(500+Random(800));
end;
end;
Writeln('Withdrwaing Done');
CloseBank;
end else
begin
Writeln('Failed to open Bank, logging out');
LogoutWhy('Failed to withdraw items');
end;
MakeCompass('n');
end;

Procedure BankIt(BL:integer);
var
i:integer;
Clay:TBox;
begin
if MyOpenBank then
begin
if Players[CurrentPlayer].Booleans[1] then
begin
DepositAll;
Wait(500+random(800));
Writeln('Banking Done');
CloseBank;
end else
begin
for i:=1 to 28 do
begin
Clay:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Clay.X1, Clay.Y1, Clay.X2, Clay.Y2 ) = BL then
begin
Writeln('Clay Found, Banking it');
MouseBox(Clay.X1 + 5, Clay.Y1 + 5, Clay.X2 - 5, Clay.Y2 - 5, 2)
ChooseOptionMulti(['All', 'll', 'Al']);
Wait(500+Random(800));
end;
end;
Writeln('Banking Done');
//CloseBank;
end;
end else
begin
Writeln('Failed to open Bank, logging out');
LogoutWhy('Failed to bank items');
end;
end;

Procedure EquipmentCheck;
var
i:integer;
item:TPoint;
Items:TBox;
begin
if (not (LoggedIn)) then Exit;
Gametab(tab_Equip)
if CountColor(SRL_OUTLINE_BLACK, 568, 288, 604, 322 ) = 98 then //takes off weapon/pic
begin
Writeln('Pic Found equiped');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := True; //true if equiped
Exit;
end else
begin
Gametab(tab_Inv)
Wait(500);
for i:=1 to 28 do
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Pic Found in Inventory');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := False;
Exit;
end;
end;
end;
If (not Players[CurrentPlayer].Booleans[0]) then
begin
Writeln('No Pic found, checking bank');
MakeCompass('E');
if MyOpenBank then
begin
FixBankTab;
FixBank;
DepositAll; //clears inventory
for i:=1 to 10 do //only first line
begin
Items:= BankIndexToMSBox(i);
item:= BankIndexToMSPoint(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1 , Items.Y1 + 11, Items.X2 , Items.Y2 ) = 49 then
begin
Writeln('possible match for pic');
MouseBox(Items.X1, Items.Y1, Items.X2, Items.Y2, 3);
Wait(500);
If IsUpTextMultiCustom(['pickaxe', 'ckaxe', 'pick'])then
begin
Writeln('Pic Found, withdrawing it');
Mouse(item.x + 15, item.y + 15, 0, 0, True);
Wait(500+Random(500));
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
CloseBank;
for i:=1 to 28 do
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Trying to equipit');
MouseBox(Items.X1, Items.Y1, Items.X2, Items.Y2, 1);
Wait(1000+random(800));
for i:=1 to 28 do //might seem redundent but works
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Pic Found in Inventory');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := False;
Exit;
end else
begin
Writeln('Pic has been equiped');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := True;

end;
end;
end;
end;
Exit;
end;
end;
end;
end else
begin
Writeln('Bank not found loging out');
end;
end;
Gametab(tab_Inv); // black count for pic 98 49 in bank stacked
MakeCompass('n');

if Players[CurrentPlayer].Booleans[0] then
begin
Writeln('pickaxe in inventory');
end else
Writeln('pickaxe equiped');

end;

Procedure Main;
var
Mining, Wetting, Crafting:integer;
begin
Mining:= 0;
Wetting:= 0;
Crafting:= 0;
LoginPlayer;
Wait(500+Random(800));
SetAngle(True);
//EquipmentCheck;
GameTab(Tab_Inv);
repeat
if Players[CurrentPlayer].Booleans[10] then
begin
while Mining < Players[CurrentPlayer].Integers[10] do
begin
WalkToMine;
MineIt;
WalkToBankFromMine;
BankIt(62);
inc(Mining);
end;
CloseBank;
end;
if Players[CurrentPlayer].Booleans[11] then
begin
while Wetting < Players[CurrentPlayer].Integers[11] do
begin
WithdrawIt(62);
CloseBank;
WalkToWater;
WetClay;
WalkToBankFromWater;
BankIt(67);
inc(Wetting);
end;
CloseBank;
end;
if Players[CurrentPlayer].Booleans[12] then
begin
while Crafting < Players[CurrentPlayer].Integers[12] do
begin
WithdrawIt(67);
CloseBank;
WalkToPottery;
MakeUrns;
WalkToBankFromPottery;
BankIt(85);
inc(Crafting);
end;
CloseBank;
end;
//BankIt(62); //mined clay 62 soft clay 67 cracked mining 85 same afetr fired
until(not(LoggedIn))
end;
procedure ProgressReport;
begin
end;

procedure Setup;
begin
SetupSRLStats(108, SRLStats_UserID, SRLStats_Password);
Smart_Server := World;
Smart_Signed := Signed;
SetupSRL;
SPS_Areas := ['9_2', '9_3'];
DeclarePlayers;
AddOnTerminate('ProgressReport'); //on script terminate do progress report
end;

begin //62 mined clay black count
Setup
Main;

//EquipmentCheck;
//WalkToMine;
//MineIt;
//WalkToBankFromMine;
//MyOpenBank;
//WalkToWater;
//wetclay;
//WalkToBankFromWater;
//WalkToPottery;
//WalkToBankFromPottery;

//loginplayer
//setangle(true);
//Players[CurrentPlayer].Integers[20]:= GetSkillLevel(skill_Crafting); //get crafting level once at pottery

// wait(2000);
//MakeUrns;

end.

edit:

thinking of simply using SPS for walking, my walking can cause problems and SPS works brilliantly.

also i just got a diamond from a clay rock, lol

Edit Edit:

Finished it all now.

i will be testing it soon not sure when yet but for now i will have a break :)

if you want finished untested/tweaked version just say and i will post it up here for members only to try

Bobzilla69

2011-04-29 15:16:58

sorry for double post but just some news :)

ITS ALIVE!!!!

report is from one player doing mining once, wetting clay once and making best urn once, did not use run.

obviously i am still testing and improving but why not give it a shot :)

just a few notes:

i dont think this will work with members as you will have extra options which i havent compensated for

Watch out for level 6 mugger (not that that should be a problem)

make sure all tools needed are in first line of bank i.e. clay, soft clay and pickaxe

[============================================]
[ ErnieUrnCrafter 0.05 ]
[ by Bobzilla69 ]
[============================================]
[ TimeRunning : 13 Minutes And 20 Seconds ]
[ Active Players : 1 ]
[============================================]
[ ErnieUrnCrafter 0.05 ]
[============================================]
Status: /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
Status: | SRL Randoms Report |
Status: | [url]www.villavu.com[/url] |
Status: |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Status: \~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/


program ErnieUrnCrafter;

{$DEFINE SMART}
{$i SRL\SRL.scar}
{$i SRL\SRL\core\SPS\SPS.simba}
{$i SRL\SRL\Misc\Reports.scar}
{$i SRL\SRL\Misc\Stats.simba}
{$i SRL\SRL\misc\Debug.scar}

{ Ernie the fastest UrnCrafter in the west }
{=========================================================================]
[ ]
[ ]
[ NAME : ErnieUrnCrafter ]
[ WRITER : Bobzilla69 ]
[ CATEGORY : Combo ]
[ DESCRIPTION : Mines clay and makes urns ]
[ USAGE : Start in Edgeville Bank With Pickaxe, ]
[ it will detect Pickaxe and looking in bank ]
[ NOTES : Ernie is a good crafter and enjoys using color ]
[ to perform tasks but he can have mishaps ]
[ but when he works he is a Beauty ]
[ CONTACT : PM me on SRL-Forums or post in thread ]
[ THANKS : I would like to Thank the SRL Team for making ]
[ this great system to be utilized by us. ]
[ Thanks to anyone who helped me learn to script ]
[=========================================================================]
[ Instructions ]
[=========================================================================]
[ 1. Have character in Edgeville Bank with Pickaxe ]
[ 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. Start script and enjoy, dont forget to post a proggy! ]
[=========================================================================}

const
World = 23; //world to load ( 0 will load random)
Signed = True; //signed client(true) or unsigned (false)
SRLStats_UserID = ''; // Your SRL Stats Username (ID didnt work for me)
SRLStats_Password = ''; // Your SRL Stats Password


var
DebugTheTPA:Boolean;
RunTime:integer;

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

DebugTheTPA := False; //True if you want to see TPA debug (color only)

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) not currently used, but might be later
Active := True; //Player Active?
WorldInfo := [False, -1, False]; //members, world (-1 is random), pvp

Booleans[10] := True; //want to mine clay
Booleans[11] := True; //want to wet clay
Booleans[12] := True; //want to make urns

Integers[10] := 1; //trips to mine
Integers[11] := 1; //trips to well
Integers[12] := 1; //trips to pottery shed

Strings[0] := ''; //if you want a specific urn, else leave blank

end;

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

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

var
ColourSetup : Colour; //allows to set specific colors for trees

procedure SetupColour(what:string);
begin
case Lowercase(what) of
'clayrock': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 8570605; //color of what we cutting
Tol := 6; // tolerance for finding tree
HMod := 0.02; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 3.11; //30
UpText := [ 'ine Rock', 'ine'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Clay Rock'; //tree name
end;
end;
'furnace': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 2447024; //color of what we cutting
Tol := 13; // tolerance for finding tree
HMod := 0.06; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 1.91; //30
UpText := [ 'Pottery Oven', 'Oven', 'ven'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Pottery Oven'; //tree name
end;
end;
'potterwheel': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 3166828; //color of what we cutting
Tol := 1; // tolerance for finding tree
HMod := 0.28; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.50; //30
UpText := [ 'Potter', 'Wheel', 'heel', 'otter'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Pottery Wheel'; //tree name
end;
end;
'door': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 2449020; //color of what we cutting
Tol := 1; // tolerance for finding tree
HMod := 0.07; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.67; //30
UpText := [ 'pen Door', 'pen'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Door'; //tree name
end;
end;
'well': begin
with ColourSetup do //loads recoard to store tree specific infomation for script
begin
Col := 3032403; //color of what we cutting
Tol := 3; // tolerance for finding tree
HMod := 0.15; //4 //used for colortolerancespeed, changes how accurate it is
SMod := 0.21; //30
UpText := [ 'Well', 'ell'] //uptext of tree for cutting, needs most of uptext to insure it trains only selected treeS
Colour := 'Well'; //tree name
end;
end;
end;
try wait(5);
SetColorSpeed2Modifiers(ColourSetup.HMod, ColourSetup.SMod);
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;

Function MyFindColor(what:String; MM: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
'bankbooth': begin
color := 4018267;
bL := 58;
bH := 63;
gL := 77;
gH := 82;
rL := 88;
rH := 94;
colTol:= 4; //use to alter tollerance
end;
'bank': begin
color := 988754;
bL := 11;
bH := 19;
gL := 17;
gH := 26;
rL := 71;
rH := 92;
colTol:= 12; //use to alter tollerance
end;
'road': begin
color := 4219502;
bL := 59;
bH := 68;
gL := 93;
gH := 103;
rL := 103;
rH := 116;
colTol:= 9;
end;
'road2': begin
color := 8948367;
bL := 134;
bH := 137;
gL := 135;
gH := 140;
rL := 139;
rH := 146;
colTol:= 4;
end;
end;
Result := 0;
if MM 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 MM 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 LogoutWhy(Why:string); //idea from BobboHobbo script
begin
WriteLn(Why);
Players[CurrentPlayer].Active := False; //stes player to inactive
Logout;
end;

Function HighestUrn:TVariantArray; //not good looking but it workes
var //urns of same level will only have first one made from list
Level:integer;
What:String;
begin
Level:= Players[CurrentPlayer].Integers[20];
What:= lowercase(Players[CurrentPlayer].Strings[0]);
if Level = 0 then LogoutWhy('Crafting Level not found');
if InRange(Level, 1, 1) or (What = 'cracked mining') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [248, 392, 355, 457, 92, 393,
200, 456, 'racked', 'ining'];
exit;
end; //Cracked mining urn 1

if InRange(Level, 2, 3) or (What = 'cracked cooking') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [37, 390, 142, 459, 84, 392,
196, 455, 'racked', 'ooking'];
exit;
end;//Cracked cooking urn2

if InRange(Level, 2, 3) or (What = 'cracked fishing') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [144, 393, 247, 457, 86, 393,
198, 458,'racked', 'ishing'];
exit;
end;//Cracked fishing urn 2

if InRange(Level, 2, 3) or (What = 'impious') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [377, 392, 479, 458, 174, 394,
256, 454, 496, 421, 'mpious', 'rayer'];
exit;
end;//Impious urn 2

if InRange(Level, 4, 11) or (What = 'cracked woodcutting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [270, 391, 376, 457, 51, 395,
186, 457, 498, 414, 'racked', 'oodcutting'];
exit;
end;//Cracked woodcutting urn 4

if InRange(Level, 4, 11) or (What = 'cracked smelting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [356, 391, 461, 458, 77, 394,
194, 456, 'racked', 'melting'];
exit;
end;//Cracked smelting urn 4

if InRange(Level, 12, 14) or (What = 'fragile cooking') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [37, 390, 142, 459, 204, 394,
317, 459, 'ragile', 'ooking'];
exit;
end;//Fragile cooking urn 12

if InRange(Level, 15, 16) or (What = 'fragile fishing') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [144, 393, 247, 457, 205, 394,
314, 456, 'fragile', 'fishing'];
exit;
end;//Fragile fishing urn 15

if InRange(Level, 15, 16) or (What = 'fragile woodcutting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [270, 391, 376, 457, 190, 393,
328, 456, 498, 414, 'ragile', 'oodcutting'];
exit;
end;//Fragile woodcutting urn 15

if InRange(Level, 17, 25) or (What = 'fragile mining') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [248, 392, 355, 457, 206, 393 ,
312, 457, 'ragile', 'ining'];
exit;
end;//Fragile mining urn 17

if InRange(Level, 17, 25) or (What = 'fragile smelting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [356, 391, 461, 458, 204, 394,
315, 456, 'ragile', 'melting'];
exit;
end;//Fragile smelting urn 17

if InRange(Level, 26, 31) or (What = 'accursed') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [377, 392, 479, 458, 259, 395,
341, 454, 496, 421, 'ccursed', 'rayer'];
exit;
end;//Accursed urn 26

if InRange(Level, 32, 34) or (What = 'mining') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [248, 392, 355, 457, 321, 395,
425, 456, 'ining', 'ining'];
exit;
end;//Mining urn 32

if InRange(Level, 35, 35) or (What = 'smelting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [356, 391, 461, 458, 327, 395,
442, 452, 'melting', 'melting'];
exit;
end;//Smelting urn 35

if InRange(Level, 36, 40) or (What = 'cooking') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [37, 390, 142, 459, 325, 394,
429, 454, 'ooking', 'ooking'];
exit;
end;//Cooking urn 36

if InRange(Level, 41, 43) or (What = 'fishing') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [144, 393, 247, 457, 323, 393,
431, 457, 'ishing', 'ishing'];
exit;
end;//Fishing urn 41

if InRange(Level, 44, 99) or (What = 'woodcutting') then
begin
Writeln('Urn Selected to be Crafted is ');
Result:= [270, 391, 376, 457 , 336, 395,
463, 454, 498, 414, 'oodcutting', 'oodcutting'];
exit;
end;//Woodcutting urn 44

end;

procedure AntiBan;
var
MousePos: TPoint;
begin
if (not (LoggedIn)) then Exit;
GetMousePos(MousePos.x, MousePos.y);

case random(100) of
0..4: PickupMouse;
20..24: Wait(200+Random(2500));
40..42: GameTab(RandomRange(tab_Combat, tab_Notes));
60..64: Wait(500 + Random(1500));
80..82: RandomAngle(1);
95..97: MakeCompass(RandomRange(0, 340));
end;

MakeCompass('n');
GameTab(Tab_Inv);
MMouse(MousePos.x, MousePos.y, 0, 0);
end;

procedure WalkToMine;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk: TPointArray;
ATPA : T2DPointArray;
x, y:Integer;

begin
if not LoggedIn then Exit;

MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145), point(3957, 1164), point(3945, 1202),
point(3961, 1241), point(3987, 1280), point(3991, 1330), point(3981, 1380),
point(3962, 1431), point(3967, 1479), point(3957, 1497)];

SPS_WalkPath(SPSWalk);
Wait(1500+random(800));
Writeln('Walking to Mine from Bank Complete');

end;

procedure WalkToBankFromMine;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;
x, y:Integer;

begin
if not LoggedIn then Exit;

MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145), point(3957, 1164), point(3945, 1202),
point(3961, 1241), point(3987, 1280), point(3991, 1330), point(3981, 1380),
point(3962, 1431), point(3967, 1479), point(3957, 1497)];

InvertTPA(SPSWalk);

SPS_WalkPath(SPSWalk);
Wait(1500+random(800));
Writeln('Walking to Bank from Mine Complete');

end;

Procedure WalkToPottery;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;
fern1, fern2, threeferns, ferncluster, lastfern, minespot, x, y:Integer;

begin
if not LoggedIn then Exit;

MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145), point(3957, 1164), point(3945, 1202),
point(3961, 1241), point(3987, 1280), point(3991, 1330), point(3981, 1380),
point(3963, 1430), point(3965, 1464)];


SPS_WalkPath(SPSWalk);
Wait(1500+random(800));
Writeln('Walking to Pottery from Bank Complete');

Players[CurrentPlayer].Integers[20]:= GetSkillLevel(skill_Crafting); //get crafting level once at pottery
GameTab(Tab_Inv);

end;

Procedure WalkToBankFromPottery;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;
x, y:Integer;

begin
if not LoggedIn then Exit;

MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145), point(3957, 1164), point(3945, 1202),
point(3961, 1241), point(3987, 1280), point(3991, 1330), point(3981, 1380),
point(3963, 1430), point(3963, 1464)];

InvertTPA(SPSWalk);
SPS_WalkPath(SPSWalk);
Wait(1500+random(800));
Writeln('Walking to Bank from Pottery Complete');

end;

Procedure WalkToWater;
var
x, y:integer;
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;

begin
if not LoggedIn then Exit;

MakeCompass('n');
Wait(200);
SPSWalk:= [point(3966, 1104)];

SPS_WalkPath(SPSWalk);
Writeln('Walking to Water from Bank complete');
Wait(1500+random(800));

end;

Procedure WalkToBankFromWater;
var
MiddleOfTPA: TPoint;
TPA, SPSWalk : TPointArray;
ATPA : T2DPointArray;

begin
if not LoggedIn then Exit;
MakeCompass('n');
Wait(200);
SPSWalk:= [point(3999, 1145)];

SPS_WalkPath(SPSWalk);
Writeln('Walking to Bank from Water complete');
Wait(1500+random(800));

end;

function WeStillMining: boolean;
var
T, MineTime, count, x, y, ColCount: integer;
Search:TBox;
begin
GetMousePos(x, y);
Search.X1 := x - 10;
Search.Y1 := y - 10;
Search.X2 := x + 10;
Search.Y2 := y + 10;
SetupColour('clayrock');
ColCount := CountColorTolerance(ColourSetup.Col, Search.X1, Search.Y1, Search.X2, Search.Y2, 15);
//Writeln('Starting Colour Count :'+inttostr(ColCount));
count:= InvCount;
Flag;
Wait(200 +Random(200));
if not LoggedIn or (Invfull) then exit;
T := GetSystemTime; //used to get mine time
MineTime := 5000 + random(5000); //how long to mine a rock for
Writeln('Mining started');
repeat
//Writeln('In Loop Colour Count :'+inttostr(CountColorTolerance(ColourSetup.Col, Search.X1, Search.Y1, Search.X2, Search.Y2, ColourSetup.Tol )));
if (not CountColorTolerance(ColourSetup.Col, Search.X1, Search.Y1, Search.X2, Search.Y2, 15 ) = ColCount) then Exit;
if FindBlackChatMessage('no ore') then break;
if not (FindBlackChatMessage('swing your pick')) then
begin
if FindBlackChatMessage('manage') then break;
end;
if InvCount > count then break;
Wait(500 + random(200));
if Invfull then Break;
Antiban;
Result := True; //true if we are still chopping
until ((GetSystemTime - T > MineTime) or (not LoggedIn)) //exit repeat if we reach mine time
FindNormalRandoms;
if (GetSystemTime - T > MineTime) then
Writeln('Took longer then ' + IntToStr(MineTime) + ' to Mine the clay.');
if not LoggedIn then
Writeln('Player not logged in');
if Invfull then
writeln('Invfull starting banking');
Result := False;
end;

function FindObjectTPA(what, option:String; left:boolean):Boolean;
var
x, y, i, ii: Integer;
ObjectTPA: TPointArray;
ObjectATPA: T2dPointArray;
begin
if not LoggedIn then Exit; //if not logged in exit
try Wait(1);
ColorToleranceSpeed(2);
SetupColour(what);
SetColorSpeed2Modifiers(ColourSetup.HMod, ColourSetup.SMod);
Writeln('Attempting to Find ' +ColourSetup.Colour );
FindColorsSpiralTolerance(MSCX, MSCY, ObjectTPA, ColourSetup.Col, MSX1, MSY1, MSX2, MSY2, ColourSetup.Tol);
ObjectATPA := SplitTPAEx(ObjectTPA, 12, 12); //TPAtoATPAex( 20, 20)
if DebugTheTPA then
begin
DebugATPABounds(ObjectATPA);
//Wait(2000);
end;
if Length(ObjectATPA) = 0 then Exit; //if the split returns nothing TreeATPA will be empty so
SortATPAFromFirstPoint(ObjectATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point
if DebugTheTPA then
begin
Writeln('ATPA After Sort');
DebugATPA(ObjectATPA, '');
end;
ii := High(ObjectATPA);
for i := 0 to ii do //from 0 first entry in array to ii highest entry
begin
MiddleTPAEx(ObjectATPA[i], x, y);//find middle of array entry
MMouse(x, y, 0, 0);
Wait(100);
if WaitUpTextMulti(ColourSetup.UpText , 200) then
begin
if left then
begin
Mouse(x, y, 0, 0, True);
Flag;
Result:=True;
Exit;
Wait(500 + Random(1500));
end else
begin
Mouse(x, y, 0, 0, false);
if ChooseOption(option)then
begin //only used for potteryoven
Flag;
Result:=True;
Exit;
Wait(500 + Random(1500));
end;
end;
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 MineIt;
var
x, y, Fail: Integer;
begin
if not LoggedIn then Exit; //if not logged in exit
Writeln('Attempting to Mine Clay ');
repeat
if not FindObjectTPA('clayrock', '', True) then
begin
Writeln('Could not find tree Trying Failsafe Finder');
if FindObj(x, y, 'ine', ColourSetup.Col, ColourSetup.Tol) then //use normal find object function as failsafe
begin
Writeln('Found Clay using FindObj');
Mouse(x, y, 0, 0, True);
end else
begin
Writeln('Could not find Clay 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
Writeln('Script failed to find Clay');
Writeln('Even after 15 attempts');
Writeln('Script will Terminate');
Fail := 0; //Resetting for next player
Writeln('loging out');
end;
end;
end;
Flag;
Wait(500+Random(500))
if not WeStillMining then
begin
Continue; //restarts procedure
end;
AntiBan;
until((InvFull) or (not LoggedIn)); //if inventory is full
if InvFull then
Writeln('Inventory Full Banking');
Writeln('Mined '+inttostr(CountItemsBlackLine(62, 1)));
end;

Procedure WetClay;
var
i, b, bb, x, y:integer;
Clay, SoftClay:TBox;
begin
for i:=1 to 28 do
begin
Clay:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Clay.X1, Clay.Y1, Clay.X2, Clay.Y2 ) = 62 then
begin
Writeln('Clay Found, Clicking it to be wetted');
MouseBox(Clay.X1 + 5, Clay.Y1 + 5, Clay.X2 - 5, Clay.Y2 - 5, 1)
Flag;
Wait(500+Random(800));
if FindObjectTPA('well', '', True)then
begin
Flag;
Wait(1500+Random(800));
if FindText(x, y, 'Soft clay', 'StatChars', 235, 433, 283, 452 ) then
begin
Mouse(x, y, 2, 2, true);
Writeln('Clay and Water mixing');
repeat
Wait(200+Random(200));
bb:=0;
for b:=1 to 28 do
begin
SoftClay:= InvBox(b)
if (CountColor(SRL_OUTLINE_BLACK, SoftClay.X1, SoftClay.Y1, SoftClay.X2, SoftClay.Y2 ) = 67) or (CountColor(SRL_OUTLINE_BLACK, SoftClay.X1, SoftClay.Y1, SoftClay.X2, SoftClay.Y2 ) = 0 ) then
begin
inc(bb);
Writeln('Total Soft Clay so far is including spaces:'+inttostr(bb));
Wait(50+Random(50));
end;
end;
until(bb = 28)
end;
end else
begin
LogoutWhy('Could not find well Loging out');
end;
end;
end;
end;

Procedure MakeUrns;
var
x, y, Top, b, bb:Integer;
Search:TVariantArray;
Urn:TBox;
FireUrn:TPoint;
begin
GameTab(Tab_Inv);
SetupColour('potterwheel'); //change to use chooseoption
if not FindObjectTPA('potterwheel', '', True) then
begin
Writeln('Could not find tree Trying Failsafe Finder');
if FindObj(x, y, 'otter', ColourSetup.Col, ColourSetup.Tol) then //use normal find object function as failsafe
begin
Writeln('Found Clay using FindObj');
Mouse(x, y, 0, 0, True);
end;
end;
Flag;
Wait(1500+Random(800));
if FindText(x, y, 'Urns', 'StatChars', 148, 433, 180, 449 ) then
begin
Mouse(x, y, 2, 2, True);
Search:= HighestUrn;
Top:= High(Search);
If Length(Search) > 10 then
begin //if scrolling is needed
Writeln('Need to scroll for woodcutting and prayer');
MMouse(Search[8], Search[9], 3, 3);
Wait(2500+Random(800));
end else
begin
Writeln('Make sure we are fully left');
MMouse(21, 414, 3, 3);
Wait(2500+Random(800));
end;
if FindText(x, y, Search[Top], 'StatChars', Search[0], Search[1], Search[2], Search[3] )then
begin
Mouse(x, y, 3, 3, True);
Wait(2500+Random(1000));
if FindText(x, y, Search[Top-1], 'StatChars', Search[4], Search[5], Search[6], Search[7] )then
begin
Mouse(x, y, 3, 3, True);
Wait(1500+random(800));
repeat
Wait(200+Random(200));
ClickToContinue;
bb:=0;
for b:=1 to 28 do
begin
Urn:= InvBox(b)
if (CountColor(SRL_OUTLINE_BLACK, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) > 75) or (CountColor(SRL_OUTLINE_BLACK, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) = 0 ) then
begin
inc(bb);
Writeln('Total Urns so far is including spaces:'+inttostr(bb));
Wait(50+Random(50));
end;
end;
until(bb = 28)
MakeCompass('s')
Wait(300);
for b:=1 to 28 do
begin
Urn:= InvBox(b);
FireUrn:= ItemCoords(b);
if (CountColor(SRL_OUTLINE_BLACK, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) > 60) then
begin
Mouse(FireUrn.x, FireUrn.y, 2, 2, True);//click urn in inv
Wait(500+random(250));
If FindObjectTPA('furnace', 'unf', False) then
begin
Flag;
Wait(2000+Random(800));
if FindText(x, y, 'urn', 'StatChars', 96, 388, 390, 463 )then
begin
Mouse(x, y, 2, 2, true);
repeat
Wait(200+Random(200));
ClickToContinue;
bb:=0;
for b:=1 to 28 do
begin
Urn:= InvBox(b) //second from bottom black
if (CountColor(659990, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) < 15) or (CountColor(SRL_OUTLINE_BLACK, Urn.X1, Urn.Y1, Urn.X2, Urn.Y2 ) = 0 ) then
begin
inc(bb);
Writeln('Total Urns Fired so far is including spaces:'+inttostr(bb));
Wait(50+Random(50));
end;
end;
until(bb = 28)
end else
begin
LogoutWhy('Firing urn text not found');
end;
end else
begin
LogoutWhy('Furnace not found Logging out');
end;
end;
end;
end else
begin
LogoutWhy('Could not Find Urn to craft (fragile, normal)');
end;
end else
begin
LogoutWhy('Could not Find Urn to craft (Mining, Fishing)');
end;
end else
LogoutWhy('Could not find Pottery Wheel interface, logging out');
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('e');
Wait(300); //screen settel
FindColorsSpiralTolerance(x, y, TPA, MyFindColor('bankbooth', 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 PinScreen then //if it fins pin screen, enter pin
begin
InPin(Players[CurrentPlayer].Pin);
end;
if BankScreen then
begin
Result:= True;
Writeln('Bank has been opened');
Wait(500+Random(500));
Exit;
end;
end;
end;
end;

procedure WithdrawIt(BL:integer);
var
i:integer;
Items:TBox;
begin
if MyOpenBank then //62 = soft clay
begin
DepositAll;
Wait(500+random(800));
for i:=1 to 11 do
begin
Items:= BankIndexToMSBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1 , Items.Y1 + 10, Items.X2 , Items.Y2 ) = BL then
begin
Writeln('Clay Found, Banking it');
MouseBox(Items.X1 + 5, Items.Y1 + 5, Items.X2 - 5, Items.Y2 -5, 2)
ChooseOptionMulti(['All but one', 'll but', 'one']);
Wait(500+Random(800));
end;
end;
Writeln('Withdrwaing Done');
CloseBank;
end else
begin
Writeln('Failed to open Bank, logging out');
LogoutWhy('Failed to withdraw items');
end;
MakeCompass('n');
end;

Procedure BankIt(BL:integer);
var
i:integer;
Clay:TBox;
begin
if MyOpenBank then
begin
if Players[CurrentPlayer].Booleans[1] then
begin
DepositAll;
Wait(500+random(800));
Writeln('Banking Done');
CloseBank;
end else
begin
for i:=1 to 28 do
begin
Clay:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Clay.X1, Clay.Y1, Clay.X2, Clay.Y2 ) = BL then
begin
Writeln('Clay Found, Banking it');
MouseBox(Clay.X1 + 5, Clay.Y1 + 5, Clay.X2 - 5, Clay.Y2 - 5, 2)
ChooseOptionMulti(['All', 'll', 'Al']);
Wait(500+Random(800));
end;
end;
Writeln('Banking Done');
//CloseBank;
end;
end else
begin
Writeln('Failed to open Bank, logging out');
LogoutWhy('Failed to bank items');
end;
end;

Procedure EquipmentCheck;
var
i:integer;
item:TPoint;
Items:TBox;
begin
if (not (LoggedIn)) then Exit;
Gametab(tab_Equip)
if CountColor(SRL_OUTLINE_BLACK, 568, 288, 604, 322 ) = 98 then //takes off weapon/pic
begin
Writeln('Pic Found equiped');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := True; //true if equiped
Exit;
end else
begin
Gametab(tab_Inv)
Wait(500);
for i:=1 to 28 do
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Pic Found in Inventory');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := False;
Exit;
end;
end;
end;
If (not Players[CurrentPlayer].Booleans[0]) then
begin
Writeln('No Pic found, checking bank');
MakeCompass('E');
if MyOpenBank then
begin
FixBankTab;
FixBank;
DepositAll; //clears inventory
for i:=1 to 10 do //only first line
begin
Items:= BankIndexToMSBox(i);
item:= BankIndexToMSPoint(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1 , Items.Y1 + 11, Items.X2 , Items.Y2 ) = 49 then
begin
Writeln('possible match for pic');
MouseBox(Items.X1, Items.Y1, Items.X2, Items.Y2, 3);
Wait(500);
If IsUpTextMultiCustom(['pickaxe', 'ckaxe', 'pick'])then
begin
Writeln('Pic Found, withdrawing it');
Mouse(item.x + 15, item.y + 15, 0, 0, True);
Wait(500+Random(500));
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
CloseBank;
for i:=1 to 28 do
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Trying to equipit');
MouseBox(Items.X1, Items.Y1, Items.X2, Items.Y2, 1);
Wait(1000+random(800));
for i:=1 to 28 do //might seem redundent but works
begin
Items:= InvBox(i);
if CountColor(SRL_OUTLINE_BLACK, Items.X1, Items.Y1, Items.X2, Items.Y2 ) = 98 then
begin
Writeln('Pic Found in Inventory');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := False;
Exit;
end else
begin
Writeln('Pic has been equiped');
Players[CurrentPlayer].Booleans[0] := True; //Have Pic
Players[CurrentPlayer].Booleans[1] := True;

end;
end;
end;
end;
Exit;
end;
end;
end;
end else
begin
Writeln('Bank not found loging out');
end;
end;
Gametab(tab_Inv); // black count for pic 98 49 in bank stacked
MakeCompass('n');

if Players[CurrentPlayer].Booleans[0] then
begin
Writeln('pickaxe in inventory');
end else
Writeln('pickaxe equiped');

end;

Procedure Main;
var
Mining, Wetting, Crafting:integer;
MiningDone, WettingDone, CraftingDone:Boolean;
Check:TBox;
begin
Mining:= 0;
Wetting:= 0;
Crafting:= 0;
MiningDone:=False; //could have used Players[CurrentPlayer].Booleans[10] to check
WettingDone:= False;
CraftingDone:= False;

LoginPlayer;
Wait(500+Random(800));
SetAngle(True);
if Players[CurrentPlayer].Booleans[10] then EquipmentCheck;
GameTab(Tab_Inv);
repeat
if Players[CurrentPlayer].Booleans[10] then
begin
while Mining < Players[CurrentPlayer].Integers[10] do
begin
WalkToMine;
MineIt;
WalkToBankFromMine;
BankIt(62);
inc(Mining);
end;
if (not Players[CurrentPlayer].Booleans[11]) or (not Players[CurrentPlayer].Booleans[12]) then CloseBank;
MiningDone:= True; //have it twice, once for after loop inside and one for if its not done
end else
MiningDone:= True;

if Players[CurrentPlayer].Booleans[11] then
begin
while Wetting < Players[CurrentPlayer].Integers[11] do
begin
WithdrawIt(62);
Check:= InvBox(1);
if (not CountColor(SRL_OUTLINE_BLACK, Check.X1, Check.Y1, Check.X2, Check.Y2 ) = 62) then
begin
Writeln('Inv Slot 1 could be pick, checking slot 2');
Check:= InvBox(2);
if (not CountColor(SRL_OUTLINE_BLACK, Check.X1, Check.Y1, Check.X2, Check.Y2 ) = 62) then
begin
LogoutWhy('Withdrawing seems to have failed, insure items are on top bank line');
end;
end;
CloseBank;
WalkToWater;
WetClay;
WalkToBankFromWater;
BankIt(67);
inc(Wetting);
end; //if we dont have to continue close bank else leave it open
if (not Players[CurrentPlayer].Booleans[12]) then CloseBank;
WettingDone:= True;
end else
WettingDone:= True;

if Players[CurrentPlayer].Booleans[12] then
begin
while Crafting < Players[CurrentPlayer].Integers[12] do
begin
WithdrawIt(51); //higher due to using 10 instead of 11 diffrence
Check:= InvBox(1);
if (not CountColor(SRL_OUTLINE_BLACK, Check.X1, Check.Y1, Check.X2, Check.Y2 ) = 67) then
begin
Writeln('Inv Slot 1 could be pick, checking slot 2');
Check:= InvBox(2);
if (not CountColor(SRL_OUTLINE_BLACK, Check.X1, Check.Y1, Check.X2, Check.Y2 ) = 67) then
begin
LogoutWhy('Withdrawing seems to have failed, insure items are on top bank line');
end;
end;
CloseBank;
WalkToPottery;
MakeUrns;
WalkToBankFromPottery;
BankIt(88);
inc(Crafting);
end;
CloseBank;
CraftingDone:= True;
end else
CraftingDone:= True;

if CraftingDone and WettingDone and MiningDone then
begin
Writeln('Current Player finished logging out');
Players[CurrentPlayer].Active := False;
Logout;
end;
//BankIt(62); //mined clay 62 soft clay 67 soft clay in bank 48 cracked mining 85 same afetr fired
until(not(LoggedIn))
end;
procedure ProgressReport;
begin
Writeln('');
SRLProgressReport(ResultDebugBox, 'ErnieUrnCrafter', 'Bobzilla69', '0.05',
['TimeRunning', 'Active Players'],
[MsToTime(TimeFromMark(RunTime), Time_Formal), PlayersActive ]);
//SRLPlayerReport( ResultDebugBox, 0, false, [False, False, False, False, False, True], ['Rats Attacked', 'Deathwalk Count'], [], [0, 1], [], [] );
SRLRandomsReport;
Writeln('');
Writeln('Please post bugs and report at [url]http://villavu.com/forum/showthread.php?t=60296');[/url]
Writeln('');
stats_Commit
SendSRLReport;
Writeln('Ernie the fastest UrnCrafter in the west');
end;

procedure Setup;
begin
SetupSRLStats(108, SRLStats_UserID, SRLStats_Password);
Smart_Server := World;
Smart_Signed := Signed;
SetupSRL;
SPS_Areas := ['9_2', '9_3'];
DeclarePlayers;
AddOnTerminate('ProgressReport'); //on script terminate do progress report
end;

begin //62 mined clay black count 66 = diamond
Setup;
MarkTime(RunTime); //total running time
Main;
end.

Edit: Updated Script to Stable Version