SRL Archive - Archive

davis_junior - SRL Member Application


davis_junior

2012-03-10 22:25:00

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


Are you affilated in anyway with Jagex LTD?
No


Were you Referred to SRL?
No


What is your general programming knowledge?
Favorite/most used: C#
Intermediate: Java (mostly learned from college – I almost have an A.S. in computer science)
Beginner: SCAR/Pascal, C++


Are you a member of any other communities?
I have an account on Sythe, which is where I originally learned about SCAR, but I never use it anymore (I never really used it to begin with).


Tell us about yourself…
From: davis_junior
I am a current student attending a community college – Jamestown CC to be specific. It's a SUNY school. I am looking forward to furthering my education at a 4-year school after I finish my current degree.

Besides working with computers (linux/servers, programming, etc.), I have played guitar and sung since early high school. The last two years, I have been mostly busy with college, however, and have not been into music as much as I used to be.



Please show us one (or multiple) of your scripts.
For some reason, I'm not able to attach my scripts, so I used a file host if that's alright. All of the scripts use custom includes, which are all included.

There are four separate scripts (besides the includes), two of which are just walking scripts, one is a tanner/smelter hybrid, and the other is a merchenter (it buys and sells at the GE).

The tanner/smelter and the merchenter read and write off .ini files; I'm not sure I have any instructions for setting them up; just ask me and I'll upload them if you need them. Information such as what to buy for the merchenter are read from the .ini files and information such as if the script should be restarted are written to the .ini files. I have a separate program written in C# that reads if the script should be restarted or closed and it executes those tasks if necessary. For instance, if the tanner script becomes lost, it will write restart info. and the name of the walk-duelling-ring script to the .ini file and then my C# program will close that script and restart the script as that walker.

I am posting these four scripts because they are all used together; I will probably eventually permanently connect them by, for instance, creating functions for the entry points and main loops for each script and then including them all in one script.

Link to rar file containing all scripts and includes: http://www.mediafire.com/?ilaok4f3hcp403q

Thanks for considering me for SRL membership! I am looking forward to being a member!

Tanner/smelter without DDTMS:

program Tanner;
{$DEFINE CUSTOM_DEBUG_DRAW}
{$i Custom/Custom.simba}

var
x, y : Integer;
TPA: TPointArray;

BDAX1, BDAX2, BDAY1, BDAY2 : Integer;

B1X1, B1X2, B1Y1, B1Y2 : Integer;
B2X1, B2X2, B2Y1, B2Y2 : Integer;

tempS: String;
tempB: Boolean;

// DTMs
AlKharidBankDTM, CounterDTM, EllisDTM, Ellis2DTM, FurnaceDTM : Integer;
TanHideDTM, TanHide2DTM : Integer;
TannerBuildingDTM, TannerBuilding2DTM: Integer;

HideUptext, TanHideUptext : String;
HideName, TanHideName : String;

DTMTest, Skip : Boolean;

tanner: Boolean;
smelter: Integer; // 0 for tanner, 1 for bronze smelter, 2 for iron smelter, 3 for steel smelter

const
//HideType = 'Green'; // Which type of hide to tan: Green, Blue, Red, Black, or White
HideType = 'Blue';
//HideType = 'Red';
//HideType = 'Black';
//HideType = 'White';

// Function/procedrue prototypes
procedure DeclarePlayers; forward;

function SetAlKharidBankDTM: Integer; forward;
function SetCounterDTM: Integer; forward;
function SetEllisDTM: Integer; forward;
function SetEllis2DTM: Integer; forward;
function SetFurnaceDTM: Integer; forward;
function SetTannerBuildingDTM: Integer; forward;
function SetTannerBuilding2DTM: Integer; forward;
function SetTanCowhideDTM: Integer; forward;
function SetTanCowhide2DTM: Integer; forward;
function SetTanGreenDragonhideDTM: Integer; forward;
function SetTanBlueDragonhideDTM: Integer; forward;
function SetTanRedDragonhideDTM: Integer; forward;
function SetTanBlackDragonhideDTM: Integer; forward;

function DDTMWalk(WalkNumber: Integer): Integer; forward;
function DDTMWalk2(WalkNumber: Integer): Integer; forward;
function FindWalkDTM(walkNumber: Integer; var xOut: Integer; var yOut: Integer; x1: Integer; y1: Integer; x2: Integer; y2: Integer): Boolean; forward;
function FindWalkDTM2(walkNumber: Integer; var xOut: Integer; var yOut: Integer; x1: Integer; y1: Integer; x2: Integer; y2: Integer): Boolean; forward;

function WalkToTanner: Boolean; forward;
function WalkToFurnace: Boolean; forward;
function WalkToBank: Boolean; forward;
function TanItems: Boolean; forward;

procedure InitializeScreenshots; forward;
procedure cSetDTMs; forward;
procedure cFreeDTMs; forward;

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

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Member := True;
Players[0].Pin := '';
end;

function FindWalkDTM(walkNumber: Integer; var xOut: Integer; var yOut: Integer; x1: Integer; y1: Integer; x2: Integer; y2: Integer): Boolean;
var
WalkDTM : Integer;
begin
WalkDTM := DDTMWalk(walkNumber);
SetDTMName(WalkDTM, 'DDTMWalk(' + IntToStr(walkNumber) + ')');
if (FindDTM(WalkDTM, xOut, yOut, x1, y1, x2, y2)) then
begin
DrawBox_IfDebug(xOut, yOut);
FreeDTM(WalkDTM);
Result := True;
exit;
end;
FreeDTM(WalkDTM);

Result := False;
end;

function FindWalkDTM2(walkNumber: Integer; var xOut: Integer; var yOut: Integer; x1: Integer; y1: Integer; x2: Integer; y2: Integer): Boolean;
var
WalkDTM : Integer;
begin
WalkDTM := DDTMWalk2(walkNumber);
SetDTMName(WalkDTM, 'DDTMWalk2(' + IntToStr(walkNumber) + ')');
if (FindDTM(WalkDTM, xOut, yOut, x1, y1, x2, y2)) then
begin
DrawBox_IfDebug(xOut, yOut);
FreeDTM(WalkDTM);
Result := True;
exit;
end;
FreeDTM(WalkDTM);

Result := False;
end;

function WalkToTanner: Boolean;
var
done: Array of Boolean;
attempts: Array of Integer;
begin
InitializeAttempts_Custom(done, attempts, 2);

Wait(200 + Random(100));
Writeln('Resting until 80...');
RestUntil(80);
SetRun(True);

SaveScreenshot(ScreenshotName);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);

while (not done[0]) do
begin
ResetAttempts(done, attempts, 1);

if (FindWalkDTM(0, x, y, MMX1, MMY1, MMX2, MMY2) or FindWalkDTM2(0, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 0.');
Mouse(x, y, 4, 4, True);
RandomAntiBan_Custom(3000);
RandomAntiBan_Custom(3000);
//Wait(5000 + Random(200));

while (not done[1]) do
begin
//ResetAttempts(done, attempts, 2);

if (FindWalkDTM(1, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 1.');
Mouse(x, y, 1, 1, True);
RandomAntiBan_Custom(4200);
RandomAntiBan_Custom(4500);
//Wait(8700 + Random(200));
Result := True;
exit;
end else
begin
Writeln('Unable to find Walk DTM 1!');
TestAttempts(done, attempts, 1);
end;
end;
end else
begin
Writeln('Unable to find Walk DTM 0!');
TestAttempts(done, attempts, 0);
end;
end;

Result := False;
end;

function WalkToFurnace: Boolean;
var
done: Array of Boolean;
attempts: Array of Integer;
begin
InitializeAttempts_Custom(done, attempts, 2);

Wait(200 + Random(100));
Writeln('Resting until 80...');
RestUntil(80);
SetRun(True);

SaveScreenshot(ScreenshotName);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);

while (not done[0]) do
begin
ResetAttempts(done, attempts, 1);

if (FindWalkDTM(0, x, y, MMX1, MMY1, MMX2, MMY2) or FindWalkDTM2(0, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 0.');
Mouse(x, y, 4, 4, True);
RandomAntiBan_Custom(3000);
RandomAntiBan_Custom(3000);
//Wait(5000 + Random(200));

while (not done[1]) do
begin
//ResetAttempts(done, attempts, 2);

if (FindWalkDTM(4, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 4.');
Mouse(x, y, 1, 1, True);
RandomAntiBan_Custom(3200);
RandomAntiBan_Custom(3500);

Result := True;
exit;
end else
begin
Writeln('Unable to find Walk DTM 4!');
TestAttempts(done, attempts, 1);
end;
end;
end else
begin
Writeln('Unable to find Walk DTM 0!');
TestAttempts(done, attempts, 0);
end;
end;

Result := False;
end;

function WalkToBank: Boolean;
var
done: Array of Boolean;
attempts: Array of Integer;
begin
InitializeAttempts_Custom(done, attempts, 2);

while (not done[0]) do
begin
ResetAttempts(done, attempts, 1);

SaveScreenshot(ScreenshotName);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);

if (FindWalkDTM(2, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 2.');
Mouse(x, y, 4, 4, True);

if (tanner) then
begin
RandomAntiBan_Custom(3000);
RandomAntiBan_Custom(3000);
//Wait(6000 + Random(200));
end else
begin
RandomAntiBan_Custom(2000);
RandomAntiBan_Custom(2200);
end;

while (not done[1]) do
begin
//ResetAttempts(done, attempts, 2);

if (FindWalkDTM(3, x, y, MMX1, MMY1, MMX2, MMY2) or FindWalkDTM2(3, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 3.');
Mouse(x, y, 1, 1, True);

RandomAntiBan_Custom(4000);
RandomAntiBan_Custom(4500);
//Wait(7000 + Random(200));

Result := True;
exit;
end else
begin
Writeln('Unable to find Walk DTM 3!');
TestAttempts(done, attempts, 1);
end;
end;
end else
begin
Writeln('Unable to find Walk DTM 2!');

if ((attempts[0] = 0) or (attempts[0] = 1)) then
begin
// Find and click tanner building
if (FindDTM(TannerBuildingDTM, x, y, MMX1, MMY1, MMX2, MMY2) or FindDTM(TannerBuilding2DTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
DrawBox_IfDebug(x, y);
Writeln('Found Tanner Building DTM.');
Mouse(x, y, 4, 4, True);
WaitUntilNotMoving_Custom(8000);
end else
Writeln('Unable to find Tanner Building DTM!');
end;

TestAttempts(done, attempts, 0);
end;
end;

Result := False;
end;

function TanItems: Boolean;
var
done, doneUT : Array of Boolean;
attempts, attemptsUT : Array of Integer;
foundOption: Boolean;
forHigh: Integer;
begin
InitializeAttempts_Custom(done, attempts, 4);
InitializeAttempts_Custom(doneUT, attemptsUT, 2);

while (not done[0]) do
begin
ResetAttempts(done, attempts, 1);

WaitUntilNotMoving_Custom(8000);

if (FindDTMs(EllisDTM, TPA, MSX1, MSY1, MSX2, MSY2)) then
begin
DTMTest := True;
end else
begin
if (FindDTMs(Ellis2DTM, TPA, MSX1, MSY1, MSX2, MSY2)) then
begin
DTMTest := True;
end else
begin
// Find and click tanner building
if (FindDTM(TannerBuildingDTM, x, y, MMX1, MMY1, MMX2, MMY2) or FindDTM(TannerBuilding2DTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
DrawBox_IfDebug(x, y);
Writeln('Found Tanner Building DTM.');
Mouse(x, y, 4, 4, True);
WaitUntilNotMoving_Custom(8000);
end else
Writeln('Unable to find Tanner Building DTM!');

DTMTest := False;
end;
end;

// Test if already at tan screen, skip if so
if (FindDTM(TanHideDTM, x, y, MBX1, MBY1, MBX2, MBY2) or FindDTM(TanHide2DTM, x, y, MBX1, MBY1, MBX2, MBY2)) then
begin
DrawBox_IfDebug(x, y);
Writeln('Found Tan Hide Screen. Skipping...');
Skip := True;
end;

if (DTMTest or Skip) then
begin
if (not Skip) then
begin
Writeln('Found Ellis DTM(s).');

TPA := TrimTPA(TPA);
TPA := RemoveCloseTPAPoints(TPA, 5);
DrawTPAToBoxes_IfDebug(TPA);

forHigh := High(TPA);
end else
begin
forHigh := 1;
end;

for i := 0 to forHigh do
begin
if (not Skip) then
begin
MMouse(TPA[i].x, TPA[i].y, 4, 4);
Wait(DTMWait + Random(100));
end;


WaitQ;
ResetAttempts(doneUT, attemptsUT, 0);

while (not doneUT[0]) do
begin
if (IsUptext('lis') or Skip) then
begin
foundOption := True;

if (not Skip) then
begin
Writeln('Found Ellis uptext.');
Mouse(TPA[i].x, TPA[i].y, 0, 0, False);

// TODO: make done/attempt while block
if (not WaitOption('ra', 1000)) then // 'Trade'
foundOption := False;

Wait(1500 + Random(200));
end;

if (foundOption) then
begin
while (not done[1]) do
begin
//ResetAttempts(done, attempts, 2);

SaveScreenshot(ScreenshotName);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);

if (FindDTM(TanHideDTM, x, y, MBX1, MBY1, MBX2, MBY2)) then
begin
DTMTest := True;
end else
begin
if (FindDTM(TanHide2DTM, x, y, MBX1, MBY1, MBX2, MBY2)) then
begin
DTMTest := True;
end else
DTMTest := False;
end;

if (DTMTest) then
begin
DrawBox_IfDebug(x, y);
Writeln('Found Tan ' + HideName + ' DTM.');
MMouse(x, y, 4, 4);


WaitQ;
ResetAttempts(doneUT, attemptsUT, 1);

while (not doneUT[1]) do
begin
if (IsUptext(TanHideUptext)) then
begin
Writeln('Found Tan ' + HideName + ' uptext.');
Mouse(x, y, 0, 0, False);

if (WaitOption('ll', 800)) then // 'all'
begin
Writeln('Tanned all ' + HideName + 's.');
Wait(800 + Random(200));
Result := True;
exit;
end;
end else
begin
Writeln('Unable to find Tan ' + HideName + ' uptext!');
if (TestAttempts_Uptext(doneUT, attemptsUT, 1)) then
if (NextAttemptAtLimit(attempts, 1)) then
done[1] := True;
end;
end;
end else
begin
Writeln('Unable to find Tan ' + HideName + ' DTM!');
TestAttempts(done, attempts, 1);

if (not (FindDTM(TanHideDTM, x, y, MBX1, MBY1, MBX2, MBY2) or FindDTM(TanHide2DTM, x, y, MBX1, MBY1, MBX2, MBY2))) then
begin
Writeln('Unable to find Tan Hide Screen. Setting ''skip'' to FALSE...');
Skip := False;
end;
end;
end;

break;
end;
end else
begin
Writeln('Unable to find Ellis uptext!');
if (TestAttempts_Uptext(doneUT, attemptsUT, 0)) then
SetAttemptsIfNextAttemptAtLimit(done, attempts, 0);
end;
end;
end;
DTMTest := False;
end else
begin
Writeln('Unable to find Ellis DTM!');

TestAttempts(done, attempts, 0);

if (attempts[0] = 1) then
begin
Wait(500 + Random(100));
Writeln('Clicking to the left 1 tile.');
x := RandomRange(195, 235);
y := RandomRange(150, 190);
Mouse(x, y, 1, 1, True);
end;

if (attempts[0] = 2) then
begin
Wait(500 + Random(100));
Writeln('Turning to face west. Setting camera angle to low.');
MakeCompass('w');
SetAngle(SRL_ANGLE_LOW);
end;
end;
end;

Result := False;
end;

function SmeltItems: Boolean;
var
done, doneUT : Array of Boolean;
attempts, attemptsUT : Array of Integer;
foundOption: Boolean;
forHigh: Integer;
begin
InitializeAttempts_Custom(done, attempts, 4);
InitializeAttempts_Custom(doneUT, attemptsUT, 1);

while (not done[0]) do
begin
ResetAttempts(done, attempts, 1);

WaitUntilNotMoving_Custom(8000);

if (FindDTMs(FurnaceDTM, TPA, MSX1, MSY1, MSX2, MSY2)) then
begin
Writeln('Found Furnace DTM(s).');

TPA := TrimTPA(TPA);
TPA := RemoveCloseTPAPoints(TPA, 5);
DrawTPAToBoxes_IfDebug(TPA);

for i := 0 to High(TPA) do
begin
MMouse(TPA[i].x, TPA[i].y, 4, 4);
Wait(DTMWait + Random(100));

WaitQ;
ResetAttempts(doneUT, attemptsUT, 0);

while (not doneUT[0]) do
begin
if (IsUptext('nac')) then // 'Furnace'
begin
Writeln('Found Furnace uptext.');
Mouse(TPA[i].x, TPA[i].y, 0, 0, False);

if (WaitOption('elt', 1000)) then // 'Smelt Furnace'
begin
while (not done[1]) do
begin
//ResetAttempts(done, attempts, 2);

SaveScreenshot(ScreenshotName);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);

WaitL;
//ResetAttempts(doneUT, attemptsUT, 1);

if ((smelter = 1) or (smelter = 2)) then
begin
// Bronze bar in middle
x := RandomRange(237, 280);
y := RandomRange(403, 449);
Mouse(x, y, 0, 0, False);
end;

if (WaitOption('ll', 1000)) then // 'Make All'
begin
//Writeln('Found ''Make All'' uptext.');
//Mouse(x, y, 0, 0, True);

if (smelter = 1) then
begin
Writeln('Smelting bronze bars (35 seconds)...');
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(5000);
//Wait(35000 + Random(2000));
end;

if (smelter = 2) then
begin
Writeln('Smelting iron bars (70 seconds)...');
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(10000);
RandomAntiBan_Custom(10000);
//Wait(70000 + Random(4000));
end;

// Incase antiban moved tab, go back to invetory
GameTab(tab_Inv);
WaitQ;

if (not ExistsItem(28)) then
begin
Writeln('Made all bars.');
WaitQ;

Result := True;
exit;
end else
Writeln('There exists an item at location 28!');
end else
begin
{
Writeln('Unable to find Tan ' + HideName + ' uptext!');
if (TestAttempts_Uptext(doneUT, attemptsUT, 1)) then
if (NextAttemptAtLimit(attempts, 1)) then
done[1] := True;
}

TestAttempts(done, attempts, 1);

Writeln('Could not find ''Make All'' option!');
end;
end;

break;
end;
end else
begin
Writeln('Unable to find Furnace uptext!');
if (TestAttempts_Uptext(doneUT, attemptsUT, 0)) then
SetAttemptsIfNextAttemptAtLimit(done, attempts, 0);
end;
end;
end;
end else
begin
Writeln('Unable to find Furnace DTM!');

TestAttempts(done, attempts, 0);

if (attempts[0] = 1) then
begin
Wait(500 + Random(100));
Writeln('Clicking to the left 1 tile.');
x := RandomRange(195, 235);
y := RandomRange(150, 190);
Mouse(x, y, 1, 1, True);
end;

if (attempts[0] = 2) then
begin
Wait(500 + Random(100));
Writeln('Turning to face west. Setting camera angle to low.');
MakeCompass('w');
SetAngle(SRL_ANGLE_LOW);
end;
end;
end;

Result := False;
end;

procedure LoadCompleted;
begin
Inc(Loads);
ClearDebug();
Writeln('-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-');
Writeln('Load done! Loads done so far: ' + IntToStr(Loads));

if (tanner) then
Writeln('Number of hides tanned: ' + IntToStr(Loads*28))
else if (smelter = 1) then
Writeln('Number of bronze bars smelted: ' + IntToStr(Loads*14))
else if (smelter = 2) then
Writeln('Number of iron bars smelted (approx. -- 50% of iron ore): ' + IntToStr(Loads*14));

Writeln('Total time running: ' + TimeRunning);
Writeln('-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-');

SaveScreenshot(ScreenshotName);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);
MarkTime(lastUpdateTime);

Handle_WriteINI(IntToStr(botNumber), 'restartAttempt', '0', Table_Accounts);
end;

function TanItems_Full: Boolean;
begin
if (WalkToTanner()) then
begin
if (TanItems()) then
begin
if (WalkToBank()) then
begin
LoadCompleted();

Result := True;
exit;
end;
end;
end;

Result := False;
end;

function SmeltItems_Full: Boolean;
begin
if (WalkToFurnace()) then
begin
if (SmeltItems()) then
begin
if (WalkToBank()) then
begin
LoadCompleted();

Result := True;
exit;
end;
end;
end;

Result := False;
end;

function RetrieveHides(var _done: Array of Boolean; var _attempts: Array of Integer): Boolean;
var
doneUT : Array of Boolean;
attemptsUT : Array of Integer;
begin
InitializeAttempts_Custom(doneUT, attemptsUT, 1);

x := RandomRange(B1X1, B1X2);
y := RandomRange(B1Y1, B1Y2);
MMouse(x, y, 0, 0);
WaitQ;

while (not doneUT[0]) do
begin
if (IsUpText(HideUptext)) then
begin
Writeln('Found ' + HideName + ' uptext.');
Mouse(x, y, 0, 0, False);

if (WaitOption('but', 300)) then
begin
Wait(800 + Random(800));
if (ExistsItem(1)) then
begin
RetrieveAttempt := 0;
Writeln('Retrieved ' + HideName + 's.');
CloseBank();
Wait(500 + Random(100));

Result := True;
exit;
end else
begin
Writeln('Unable to retrieve ' + HideName + 's! None in invetory!');
Inc(RetrieveAttempt);

if (RetrieveAttempt >= 3) then
begin
Writeln('Unable to find ' + HideName + 's! Attempting to start Walker Script...');
CloseBank();

Handle_WriteINI(IntToStr(botNumber), 'script', 'Walk_AlKharidToGE_Glory', Table_AccountsUpdates);
Handle_WriteINI(IntToStr(botNumber), 'script', 'Walk_AlKharidToGE_Glory', Table_Accounts);
Wait(10000 + Random(5000));
RestartScript();
end;
end;
end;
end else
begin
Writeln('Unable to find ''' + HideName + ''' uptext!');

// could add this, though it wouldn't do much of anything:
//if (IntToStr(Length(GetChooseOptions('all')) > 0) then
if (ChooseOption('ancel')) then
WaitQ;

if (TestAttempts_Uptext(doneUT, attemptsUT, 0)) then
SetAttemptsIfNextAttemptAtLimit(_done, _attempts, 2);
end;
end;

Result := False;
end;

procedure EnterStr(str: String);
begin
TypeSend(str);
WaitQ;
TypeByte(VK_EXECUTE);
end;

function RetrieveItem(uptext, name : String; amount, slot : Integer; var _done: Array of Boolean; var _attempts: Array of Integer): Boolean;
var
doneUT : Array of Boolean;
attemptsUT : Array of Integer;

tempB2: Boolean;
begin
InitializeAttempts_Custom(doneUT, attemptsUT, 1);

if (slot = 1) then
begin
x := RandomRange(B1X1, B1X2);
y := RandomRange(B1Y1, B1Y2);
end else if (slot = 2) then
begin
x := RandomRange(B2X1, B2X2);
y := RandomRange(B2Y1, B2Y2);
end;

MMouse(x, y, 0, 0);
WaitQ;

while (not doneUT[0]) do
begin
if (IsUpText(uptext)) then
begin
Writeln('Found ' + name + ' uptext.');
Mouse(x, y, 0, 0, False);

tempB2 := False;

if ((amount = -1) or (amount = 28)) then
begin
if (WaitOption('but', 400)) then
tempB2 := True;
end else
begin
WaitQ;

if (OptionsExist([IntToStr(amount)], False)) then
begin
ChooseOption(IntToStr(amount));
tempB2 := True;
end else if (ChooseOption('X')) then
begin
tempB2 := True;

WaitM;

EnterStr(IntToStr(amount));
end;
end;

if (tempB2) then
begin
WaitM;
if (ExistsItem(1)) then
begin
RetrieveAttempt := 0;
Writeln('Retrieved ' + name + 's.');
//CloseBank();
//Wait(500 + Random(100));

Result := True;
exit;
end else
begin
Writeln('Unable to retrieve ' + name + 's! None in invetory!');
Inc(RetrieveAttempt);

if (RetrieveAttempt >= 3) then
begin
Writeln('Unable to find ' + name + 's! Attempting to start Walker Script...');
CloseBank();

Handle_WriteINI(IntToStr(botNumber), 'script', 'Walk_AlKharidToGE_Glory', Table_AccountsUpdates);
Handle_WriteINI(IntToStr(botNumber), 'script', 'Walk_AlKharidToGE_Glory', Table_Accounts);
Wait(10000 + Random(5000));
RestartScript();
end;
end;
end;
end else
begin
Writeln('Unable to find ''' + name + ''' uptext!');

// could add this, though it wouldn't do much of anything:
//if (IntToStr(Length(GetChooseOptions('all')) > 0) then
if (ChooseOption('ancel')) then
WaitQ;

if (TestAttempts_Uptext(doneUT, attemptsUT, 0)) then
SetAttemptsIfNextAttemptAtLimit(_done, _attempts, 2);
end;
end;

Result := False;
end;

procedure InitializeScreenshots;
begin
if (not DirectoryExists('C:/SimbaScreenshots/Tanner')) then
CreateDirectory('C:/SimbaScreenshots/Tanner');
ScreenshotName := 'C:/SimbaScreenshots/Tanner/$SCRIPT_NAME - ' + Players[0].Name + '.bmp';

if (not DirectoryExists('C:/SimbaScreenshots/Tanner/Start')) then
CreateDirectory('C:/SimbaScreenshots/Tanner/Start');
ScreenshotStart := 'C:/SimbaScreenshots/Tanner/Start/$SCRIPT_NAME - ' + Players[0].Name + '.bmp';

if (not DirectoryExists('C:/SimbaScreenshots/Tanner/BeforeLogout')) then
CreateDirectory('C:/SimbaScreenshots/Tanner/BeforeLogout');
ScreenshotBeforeLogout := 'C:/SimbaScreenshots/Tanner/BeforeLogout/$SCRIPT_NAME - ' + Players[0].Name + '.bmp';

if (not DirectoryExists('C:/SimbaScreenshots/Tanner/Bank')) then
CreateDirectory('C:/SimbaScreenshots/Tanner/Bank');
ScreenshotBank := 'C:/SimbaScreenshots/Tanner/Bank/$SCRIPT_NAME - ' + Players[0].Name + '.bmp';

Handle_WriteINI(IntToStr(botNumber), 'current', ScreenshotName, Table_Screenshots);
Handle_WriteINI(IntToStr(botNumber), 'start', ScreenshotStart, Table_Screenshots);
Handle_WriteINI(IntToStr(botNumber), 'beforeLogout', ScreenshotBeforeLogout, Table_Screenshots);
Handle_WriteINI(IntToStr(botNumber), 'bank', ScreenshotBank, Table_Screenshots);
end;

procedure cSetDTMs;
begin
AlKharidBankDTM := SetAlKharidBankDTM();
CounterDTM := SetCounterDTM();
EllisDTM := SetEllisDTM();
Ellis2DTM := SetEllis2DTM();
FurnaceDTM := SetFurnaceDTM();
TannerBuildingDTM := SetTannerBuildingDTM();
TannerBuilding2DTM := SetTannerBuilding2DTM();

case HideType of
'Green': begin
TanHideDTM := SetTanGreenDragonhideDTM();
TanHide2DTM := SetTanGreenDragonhideDTM();
end;

'Blue': begin
TanHideDTM := SetTanBlueDragonhideDTM();
TanHide2DTM := SetTanBlueDragonhideDTM();
end;

'Red': begin
TanHideDTM := SetTanRedDragonhideDTM();
TanHide2DTM := SetTanRedDragonhideDTM();
end;

'Black': begin
TanHideDTM := SetTanBlackDragonhideDTM();
TanHide2DTM := SetTanBlackDragonhideDTM();
end;

'White': begin
TanHideDTM := SetTanCowhideDTM();
TanHide2DTM := SetTanCowhide2DTM();
end;
end;

SetDTMName(AlKharidBankDTM, 'AlKharidBankDTM');
SetDTMName(CounterDTM, 'CounterDTM');
SetDTMName(EllisDTM, 'EllisDTM');
SetDTMName(Ellis2DTM, 'Ellis2DTM');
SetDTMName(FurnaceDTM, 'FurnaceDTM');
SetDTMName(TannerBuildingDTM, 'TannerBuildingDTM');
SetDTMName(TannerBuilding2DTM, 'TannerBuilding2DTM');
SetDTMName(TanHideDTM, 'TanHideDTM');
SetDTMName(TanHide2DTM, 'TanHide2DTM');
end;

procedure cFreeDTMs;
begin
Writeln('Freeing DTMs...');

FreeDTM(AlKharidBankDTM);
FreeDTM(CounterDTM);
FreeDTM(EllisDTM);
FreeDTM(Ellis2DTM);
FreeDTM(FurnaceDTM);
FreeDTM(TannerBuildingDTM);
FreeDTM(TannerBuilding2DTM);
FreeDTM(TanHideDTM);
FreeDTM(TanHide2DTM);
end;

var
done, doneUT : Array of Boolean;
attempts, attemptsUT : Array of Integer;
begin
botNumber := 99999;
Disguise('$SCRIPT_NAME');

Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

custom_DeclarePlayersProc := @DeclarePlayers;

custom_Procs[custom_OnStartup_AfterSRLSetup] := @InitializeScreenshots;
custom_Procs[custom_SetDTMs] := @cSetDTMs;
custom_Procs[custom_FreeDTMs] := @cFreeDTMs;
AddonTerminate('FreeDTMs');

InitializeGlobals();

ScriptStartup();

SmartSetGraphics(False);
SmartSetDebug(False);

InitializeAttempts_Custom(done, attempts, 3);
InitializeAttempts_Custom(doneUT, attemptsUT, 1);

smelter := 1;

if (smelter = 0) then
tanner := True
else
tanner := False;

{repeat
FindWalkDTM2(3, x, y, MMX1, MMY1, MMX2, MMY2);
Wait(500);
until (false);}

// Bank deposit all
BDAX1 := 354;
BDAX2 := 381;
BDAY1 := 298;
BDAY2 := 317;

// Bank 1st slot
B1X1 := 41;
B1X2 := 64;
B1Y1 := 97;
B1Y2 := 117;

// Bank 2nd slot
B2X1 := 87;
B2X2 := 105;
B2Y1 := 97;
B2Y2 := 117;

case HideType of
'Green': begin
HideUptext := 'G'; // 'hide'
TanHideUptext := 'G';
HideName := 'Green Dragonhide';
TanHideName := 'Green Dragon Leather';
end;

'Blue': begin
HideUptext := 'B';
TanHideUptext := 'B';
HideName := 'Blue Dragonhide';
TanHideName := 'Blue Dragon Leather';
end;

'Red': begin
HideUptext := 'R';
TanHideUptext := 'R';
HideName := 'Red Dragonhide';
TanHideName := 'Red Dragon Leather';
end;

'Black': begin
HideUptext := 'B';
TanHideUptext := 'B';
HideName := 'Black Dragonhide';
TanHideName := 'Black Dragon Leather';
end;

'White': begin
HideUptext := 'ow'; // 'cowhide'
TanHideUptext := 'of'; // 'soft leather'
HideName := 'Cowhide';
TanHideName := 'Soft Leather';
end;
end;

if (not (FindDTM(AlKharidBankDTM, x, y, MMX1, MMY1, MMX2, MMY2))) then
begin
Writeln('Unable to find Al Kharid Bank DTM, attempting to walk to bank.');

// Rest
Wait(200 + Random(100));
Writeln('Resting until 80...');
RestUntil(80);
SetRun(True);

if (not WalkToBank()) then
begin
FindNormalRandoms();
WalkToTanner();
TanItems();
WalkToBank();
end;
end;

while (not done[0]) do
begin
ResetAttempts(done, attempts, 1);

if (FindDTM(AlKharidBankDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
DrawBox_IfDebug(x, y);
Writeln('Found Al Kharid Bank DTM.');
Mouse(x, y, 4, 4, True);
Wait(Random(100));

WaitUntilNotMoving;

while (not done[1]) do
begin
ResetAttempts(done, attempts, 2);

if (tanner) then
begin
// Check money
if (GetMoneyPouchAmount() < 600) then
begin
Writeln('Out of money; calling next script...');

Handle_WriteINI(IntToStr(botNumber), 'script', 'Walk_AlKharidToGE_Glory', Table_AccountsUpdates);
Handle_WriteINI(IntToStr(botNumber), 'script', 'Walk_AlKharidToGE_Glory', Table_Accounts);
Wait(10000 + Random(5000));
RestartScript();
end;
end;

if (FindDTMs(CounterDTM, TPA, MSX1, MSY1, MSX2, MSY2)) then
begin
Writeln('Found Counter DTM(s).');
Wait(500 + Random(100));

TPA := TrimTPA(TPA);
TPA := RemoveCloseTPAPoints(TPA, 5);
DrawTPAToBoxes_IfDebug(TPA);

for i := 0 to High(TPA) do
begin
MMouse(TPA[i].x, TPA[i].y, 4, 4);
Wait(DTMWait + Random(100));


WaitQ;
ResetAttempts(doneUT, attemptsUT, 0);

while (not doneUT[0]) do
begin
if (IsUpText('ank')) then
begin
Writeln('Found Counter uptext.');
Mouse(TPA[i].x, TPA[i].y, 0, 0, False);

if (WaitOptionMulti(['quick', 'ank B'], 500)) then
begin
Wait(1500 + Random(200));

//DepositAll(); // bugged with money pouch addition
x := RandomRange(BDAX1, BDAX2);
y := RandomRange(BDAY1, BDAY2);
Mouse(x, y, 0, 0, True);
Wait(400 + Random(100));

while (not done[2]) do
begin
//ResetAttempts(done, attempts, 3);

if (BankScreen) then
begin
Writeln('Found Bank Screen.');
SaveScreenshot(ScreenshotBank);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);

tempB := False;

if (tanner) then
begin
if (RetrieveHides(done, attempts)) then
begin
WaitQ;

if (TanItems_Full) then
begin
tempB := True;
end;
end;
end;

if (smelter = 1) then
begin
if (RetrieveItem('in', 'Tin ore', 14, 1, done, attempts)) then
begin
WaitQ;

if (RetrieveItem('C', 'Copper ore', 14, 2, done, attempts)) then
begin
WaitQ;

if (SmeltItems_Full) then
begin
tempB := True;
end;
end;
end;
end;

if (smelter = 2) then
begin
if (RetrieveItem('I', 'Iron ore', 28, 1, done, attempts)) then
begin
WaitQ;

if (SmeltItems_Full) then
begin
tempB := True;
end;
end;
end;

if (tempB) then
begin
RestartAttemptsLoop(done);
RestartAttemptsLoop(doneUT);
done[1] := False;
attempts[1] := 0;
end;
end else
begin
Writeln('Unable to find Bank Screen!');
TestAttempts(done, attempts, 2);
end;
end;

break;
end;
end else
begin
Writeln('Unable to find Counter uptext!');
if (TestAttempts_Uptext_Short(doneUT, attemptsUT, 0)) then
SetAttemptsIfNextAttemptAtLimit(done, attempts, 1);
end;
end;
end;
end else
begin
Writeln('Unable to find Counter DTM!');

if ((attempts[0] = 0) or (attempts[0] = 2)) then
begin
Writeln('Checking if at bank...');

Wait(200 + Random(100));
if (FindDTM(AlKharidBankDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
DrawBox_IfDebug(x, y);
Writeln('Found Al Kharid Bank DTM.');
Mouse(x, y, 4, 4, True);
Wait(Random(100));

WaitUntilNotMoving;

done[0] := False;
attempts[0] := 0;
end else
begin
Writeln('Unable to find Al Kharid Bank!');

if (FindWalkDTM(3, x, y, MMX1, MMY1, MMX2, MMY2) or FindWalkDTM2(3, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 3.');
Mouse(x + 4, y - 4, 1, 1, True); // Move away from edge of MM
RandomAntiBan_Custom(4000);
RandomAntiBan_Custom(4500);
end;
end;
end;

if (attempts[0] = 1) then
begin
Writeln('Attempting to walk to bank.');
if (WalkToBank()) then
begin
Writeln('Walked to bank.');
attempts[0] := 0;
end else
begin
Writeln('Could not walk to bank!');

if (FindWalkDTM(3, x, y, MMX1, MMY1, MMX2, MMY2) or FindWalkDTM2(3, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 3.');
Mouse(x + 4, y - 4, 1, 1, True); // Move away from edge of MM
RandomAntiBan_Custom(4000);
RandomAntiBan_Custom(4500);
end;
end;
end;

TestAttempts(done, attempts, 1);
end;
end;
end else
begin
Writeln('Unable to find Al Kharid Bank DTM!');

if (not WalkToBank()) then
begin
if (FindWalkDTM(3, x, y, MMX1, MMY1, MMX2, MMY2) or FindWalkDTM2(3, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Walk DTM 3.');
Mouse(x + 4, y - 4, 1, 1, True); // Move away from edge of MM
RandomAntiBan_Custom(4000);
RandomAntiBan_Custom(4500);
end;
end else
WaitQ;

if (attempts[0] >= TryLimit) then
begin
WriteStopError('Unable to find Al Kharid Bank DTM!');

Handle_WriteINI(IntToStr(botNumber), 'script', 'Walk_GEToAlKharid_DuellingRing', Table_AccountsUpdates);
Handle_WriteINI(IntToStr(botNumber), 'script', 'Walk_GEToAlKharid_DuellingRing', Table_Accounts);
Wait(10000 + Random(5000));
RestartScript_IncrementAndByRestartAttempt();
end;

TestAttempts(done, attempts, 0);
end;
end;

OnTerminate();
end.

Custom include:

{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}
{$i Custom/Globals.simba}

{$IFDEF CUSTOM_DEBUG_DRAW}
{$i srl/srl/misc/paintsmart.simba}
{$ENDIF}

procedure WriteException; forward;
function Handle_ReadINI(const Section, KeyName, FileName : String): String; forward;
procedure Handle_WriteINI(const Section, KeyName, NewString, FileName: String); forward;
procedure Update; forward;

function IncrementRestartAttempt: Integer; forward;
procedure RestartScript; forward;
procedure RestartScript_IncrementAndByRestartAttempt; forward;
procedure CloseScript; forward;

procedure RandomAntiBan_Custom_SetDebug(debug: Boolean; n: Integer); forward;
procedure RandomAntiBan_SetDebug(debug: Boolean); forward;
procedure RandomAntiBan_Custom(n: Integer); forward;
procedure RandomAntiBan; forward;

procedure InitializeAttempts_CustomEx(var done: Array of Boolean; setDoneLength: Integer; var attempts: Array of Integer; setAttemptsLength: Integer); forward;
procedure InitializeAttempts_Custom(var done: Array of Boolean; var attempts: Array of Integer; setLength: Integer); forward;
procedure InitializeAttempts(var done: Array of Boolean; var attempts: Array of Integer); forward;

function CheckUpdateTime_Exit: Boolean; forward;

function TestAttempts_CustomEx_SetDebug(var done: Array of Boolean; var attempts: Array of Integer; n, _checkLimit, _waitTime : Integer; setAngle, setDebug : Boolean): Boolean; forward;
function TestAttempts_CustomEx(var done: Array of Boolean; var attempts: Array of Integer; n, _checkLimit, _waitTime : Integer; setAngle: Boolean): Boolean; forward;
function TestAttempts_Custom(var done: Array of Boolean; var attempts: Array of Integer; n, _checkLimit: Integer): Boolean; forward;
function TestAttempts(var done: Array of Boolean; var attempts: Array of Integer; n: Integer): Boolean; forward;
function TestAttempts_Uptext(var done: Array of Boolean; var attempts: Array of Integer; n: Integer): Boolean; forward;
function TestAttempts_Uptext_Short(var done: Array of Boolean; var attempts: Array of Integer; n: Integer): Boolean; forward;
function NextAttemptAtLimit_Custom_SetDebug(attempts: Array of Integer; n: Integer; _checkLimit: Integer; setDebug: Boolean): Boolean; forward;
function NextAttemptAtLimit_Custom(attempts: Array of Integer; n: Integer; _checkLimit: Integer): Boolean; forward;
function NextAttemptAtLimit(attempts: Array of Integer; n: Integer): Boolean; forward;
procedure SetAttemptsIfNextAttemptAtLimit(var done: Array of Boolean; var attempts: Array of Integer; n: Integer); forward;
procedure ResetAttempts(var done: Array of Boolean; var attempts: Array of Integer; index: Integer); forward;
procedure RestartAttemptsLoop(var done: Array of Boolean); forward;
procedure ExitAttemptsLoop(var done: Array of Boolean); forward;
procedure ExitMainLoop; forward;
function CheckIfExitMainLoop(var done: Array of Boolean): Boolean; forward;

procedure WaitQ; forward;
procedure WaitM; forward;
procedure WaitL; forward;

function GetTimeFixed: string; forward;
function GetDateFixed: string; forward;
function GetDateTime: string; forward;
function GetDateTimeFromStr(str, format : String): TDateTime; forward;
function GetTimeIntervalFromDateTime(intervalType: String; dt: TDateTime): Integer; forward;

procedure WaitUntilNotMoving_Custom(maxTime: Integer); forward;
procedure WaitUntilNotMoving; forward;

procedure GetDifferentUpText_Loop; forward;
function RemoveStringMatches(_strL: TStringList): TStringList; forward;
function RemoveCloseTPAPoints(_TPA: TPointArray; distance: Integer): TPointArray; forward;
function TrimTPA_Custom(_TPA: TPointArray; newLength: Integer): TPointArray; forward;
function TrimTPA(_TPA: TPointArray): TPointArray; forward;

function FileToString(filePath: String; commaDelimit: Boolean): String; forward;
function FileToCommaString(filePath: String): String; forward;
function CommaStringToTStringArray(str: String): TStringArray; forward;
function CommaStringToLineSpacedString(str: String): String; forward;

procedure PrintTextAtEx_AllFonts(x, y: Integer; Tolerance: Integer; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer; TextLength: Integer; Strict: Boolean; Range: TCharRange); forward;

procedure DrawTPAToBoxes_IfDebug_Custom(_TPA: TPointArray; limit: Boolean); forward;
procedure DrawTPAToBoxes_IfDebug(_TPA: TPointArray); forward;
procedure DrawBox_IfDebug_Custom(_x, _y : Integer; limit: Boolean); forward;
procedure DrawBox_IfDebug(_x, _y : Integer); forward;

procedure WriteStopError_Custom(_stopError: Integer; _stopReason: String); forward;
procedure WriteStopError(_stopReason: String); forward;

procedure OnLogin(findRandoms: Boolean); forward;
procedure ScriptStartup_Custom(findRandoms: Boolean); forward;
procedure ScriptStartup; forward;
procedure OnTerminate; forward;

procedure WriteException;
begin
Writeln('Error number ' + IntToStr(ExceptionPos) + ', procedure number ' + IntToStr(ExceptionProc) + ', Reason: ' + ExceptionToString(ExceptionType, ExceptionParam));
end;

function Handle_ReadINI(const Section, KeyName, FileName : String): String;
var
check : Boolean;
begin
repeat
check := True;
try
Result := ReadINI(Section, KeyName, FileName);
except
WriteException;
check := False;
Wait(20);
end;
until (check = True);
end;

procedure Handle_WriteINI(const Section, KeyName, NewString, FileName : String);
var
check : Boolean;
begin
repeat
check := True;
try
WriteINI(Section, KeyName, NewString, FileName);
except
WriteException;
check := False;
Wait(20);
end;
until (check = True);
end;

procedure Update;
begin
SaveScreenshot(ScreenshotName);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);
end;

function IncrementRestartAttempt: Integer;
var
restartAttempt: String;
begin
restartAttempt := Handle_ReadINI(IntToStr(botNumber), 'price', Table_Buy);

if ((restartAttempt = '') or (restartAttempt = ' ') or (restartAttempt = nil)) then
begin
restartAttempt := '0';
end;

Handle_WriteINI(IntToStr(botNumber), 'restartAttempt', IntToStr(StrToInt(restartAttempt) + 1), Table_Accounts);

Result := StrToInt(restartAttempt);
end;

procedure RestartScript;
begin
Writeln('Calling to restart script...');

if (custom_Procs[custom_OnRestartScript] <> nil) then
custom_Procs[custom_OnRestartScript]();

if (custom_Procs[custom_OnTerminate] <> nil) then
custom_Procs[custom_OnTerminate]();

OnTerminate();

Handle_WriteINI(IntToStr(botNumber), 'restart', '1', 'C:/controls_sep.ini');
TerminateScript();
end;

procedure RestartScript_IncrementAndByRestartAttempt;
begin
if (IncrementRestartAttempt() <= 3) then
RestartScript();
end;

procedure CloseScript;
begin
Writeln('Calling to close script...');

if (custom_Procs[custom_OnCloseScript] <> nil) then
custom_Procs[custom_OnCloseScript]();

if (custom_Procs[custom_OnTerminate] <> nil) then
custom_Procs[custom_OnTerminate]();

OnTerminate();

Handle_WriteINI(IntToStr(botNumber), 'close', '1', 'C:/controls_sep.ini');
TerminateScript;
end;

procedure RandomAntiBan_Custom_SetDebug(debug: Boolean; n: Integer);
begin
Wait(200 + Random(100))
MarkTime(TimeMark);
TimeMark := TimeMark;

case Random(61) of
10: begin
if (debug) then
Writeln('AntiBan: Random Right Click.');

RandomRClick;
end;

20: begin
if (debug) then
Writeln('AntiBan: Hover Skill.');

HoverSkill('random', False);
end;

30: begin
if (debug) then
Writeln('AntiBan: Pick Up Mouse.');

PickUpMouse;
end;

40: begin
if (debug) then
Writeln('AntiBan: Random Movement.');

RandomMovement;
end;

50: begin
//if (debug) then
// Writeln('AntiBan: Bored Human.');

//BoredHuman;

if (debug) then
Writeln('AntiBan: Random Right Click.');

RandomRClick;
end;

60: begin
if (debug) then
Writeln('AntiBan: Examine Invetory.');

ExamineInv;
end;
end;

repeat
Wait(200);
until (TimeFromMark(TimeMark) >= n)
end;

procedure RandomAntiBan_SetDebug(debug: Boolean);
begin
RandomAntiBan_Custom_SetDebug(debug, 4000);
end;

procedure RandomAntiBan_Custom(n: Integer);
begin
RandomAntiBan_Custom_SetDebug(True, n);
end;

procedure RandomAntiBan;
begin
RandomAntiBan_Custom(4000);
end;

procedure InitializeAttempts_CustomEx(var done: Array of Boolean; setDoneLength: Integer; var attempts: Array of Integer; setAttemptsLength: Integer);
var
n: Integer;
begin
if (SetDoneLength <> -1) then
SetLength(done, setDoneLength);

if (SetAttemptsLength <> -1) then
SetLength(attempts, setAttemptsLength);

for n := 0 to High(done) do
begin
done[n] := False;
end;

for n := 0 to High(attempts) do
begin
attempts[n] := 0;
end;
end;

procedure InitializeAttempts_Custom(var done: Array of Boolean; var attempts: Array of Integer; setLength: Integer);
begin
InitializeAttempts_CustomEx(done, setLength, attempts, setLength);
end;

procedure InitializeAttempts(var done: Array of Boolean; var attempts: Array of Integer);
begin
InitializeAttempts_Custom(done, attempts, -1);
end;

function CheckUpdateTime_Exit: Boolean;
begin
if (checkUpdateTime) then
begin
if (TimeFromMark(lastUpdateTime) > checkUpdateTimeInterval) then // if not updated within ... (default is 10 minutes)
begin
WriteStopError('No update detected within ' + IntToStr(checkUpdateTimeInterval/60000) + ' minutes!');
Writeln('Exiting...');
ExitMainLoop();
Result := True;
exit;
end;
end;

Result := False;
end;

// resturn true if done
function TestAttempts_CustomEx_SetDebug(var done: Array of Boolean; var attempts: Array of Integer; n, _checkLimit, _waitTime : Integer; setAngle, setDebug : Boolean): Boolean;
var
checkLimit, waitTime : Integer;
begin
if (not CheckIfExitMainLoop(done)) then
begin
if (CheckUpdateTime_Exit) then
begin
Result := True;
exit;
end;

if (_checkLimit = -1) then
checkLimit := TryLimit
else
checkLimit := _checkLimit;

if (_waitTime = -1) then
waitTime := 1000
else
waitTime := _waitTime;

if (not LoggedIn) then
LogInPlayer;

FindNormalRandoms();

if (setDebug) then
Writeln('[TestAttempts] Current attempt: ' + IntToStr(attempts[n]));

Inc(attempts[n]);
if (attempts[n] > checkLimit) then
begin
if (setDebug) then
Writeln('[TestAttempts] Too many attempts: ' + IntToStr(attempts[n]) + ' > ' + IntToStr(checkLimit) + '!');

done[n] := True;
Result := True;
end else
Result := False;

Wait(waitTime + Random(Round(waitTime*0.2)));

if (setAngle) then
begin
if (attempts[n] = 1) then
ClickNorth(SRL_ANGLE_HIGH);
end;
end;
end;

function TestAttempts_CustomEx(var done: Array of Boolean; var attempts: Array of Integer; n, _checkLimit, _waitTime : Integer; setAngle: Boolean): Boolean;
begin
Result := TestAttempts_CustomEx_SetDebug(done, attempts, n, _checkLimit, _waitTime, setAngle, False);
end;

function TestAttempts_Custom(var done: Array of Boolean; var attempts: Array of Integer; n, _checkLimit : Integer): Boolean;
begin
Result := TestAttempts_CustomEx(done, attempts, n, _checkLimit, -1, True);
end;

function TestAttempts(var done: Array of Boolean; var attempts: Array of Integer; n: Integer): Boolean;
begin
Result := TestAttempts_Custom(done, attempts, n, -1);
end;

function TestAttempts_Uptext(var done: Array of Boolean; var attempts: Array of Integer; n: Integer): Boolean;
begin
Result := TestAttempts_CustomEx(done, attempts, n, 8, 200, False);
end;

function TestAttempts_Uptext_Short(var done: Array of Boolean; var attempts: Array of Integer; n: Integer): Boolean;
begin
Result := TestAttempts_CustomEx(done, attempts, n, 1, 50, False);
end;

function NextAttemptAtLimit_Custom_SetDebug(attempts: Array of Integer; n: Integer; _checkLimit: Integer; setDebug: Boolean): Boolean;
var
checkLimit: Integer;
begin
if (_checkLimit = -1) then
checkLimit := TryLimit
else
checkLimit := _checkLimit;

if ((attempts[n] + 1) > checkLimit) then
Result := True
else
Result := False;

if (setDebug) then
Writeln('[NextAttempt] Next Attempt: ' + IntToStr(attempts[n] + 1) + '; Result: ' + BoolToStr(Result));
end;

function NextAttemptAtLimit_Custom(attempts: Array of Integer; n: Integer; _checkLimit: Integer): Boolean;
begin
Result := NextAttemptAtLimit_Custom_SetDebug(attempts, n, -1, False);
end;

function NextAttemptAtLimit(attempts: Array of Integer; n: Integer): Boolean;
begin
Result := NextAttemptAtLimit_Custom(attempts, n, -1);
end;

procedure SetAttemptsIfNextAttemptAtLimit(var done: Array of Boolean; var attempts: Array of Integer; n: Integer);
begin
if (NextAttemptAtLimit(attempts, n)) then
begin
done[n] := True;
end else
begin
if (recordAttempt = attempts[n]) then
TestAttempts(done, attempts, n);

recordAttempt := attempts[n];
end;
end;

procedure ResetAttempts(var done: Array of Boolean; var attempts: Array of Integer; index: Integer);
begin
if (not CheckIfExitMainLoop(done)) then
begin
done[index] := False;
attempts[index] := 0;
end;
end;

procedure RestartAttemptsLoop(var done: Array of Boolean);
var
n: Integer;
begin
if (High(done) >= 0) then
done[0] := False;
{if (High(attempts) >= 0) then
attempts[0] := 0;}

if (High(done) > 0) then
begin
for n := 1 to High(done) do
begin
done[n] := True;
end;
end;

{// setting attempts isn't really mandatory
if (High(attempts) > 0) then
begin
for n := 1 to High(attempts) do
begin
attempts[n] := 3;
end;
end;}
end;

procedure ExitAttemptsLoop(var done: Array of Boolean);
var
n: Integer;
begin
for n := 0 to High(done) do
begin
done[n] := True;
end;
end;

procedure ExitMainLoop;
begin
exitML:= True;
end;

function CheckIfExitMainLoop(var done: Array of Boolean): Boolean;
begin
if (exitML) then
begin
ExitAttemptsLoop(done);
Result := True;
end else
Result := False;
end;

// Wait Quick
procedure WaitQ;
begin
Wait(500 + Random(100));
end;

// Wait Moderate
procedure WaitM;
begin
Wait(1200 + Random(200));
end;

// Wait Long
procedure WaitL;
begin
Wait(2400 + Random(500));
end;

function GetTimeFixed: string;
var
Hour, Mins, Sec, MSec : Word;
begin
DecodeTime(Now, Hour, Mins, Sec, MSec);
Result := (Padz(IntToStr(Hour), 2) + ':' + Padz(IntToStr(Mins), 2) + ':' + Padz(IntToStr(Sec), 2));
end;

function GetDateFixed: string;
var
Year, Month, Day : Word;
begin
DecodeDate(Date, Year, Month, Day);
Result := IntToStr(Year) + '-' + Padz(IntToStr(Month), 2) + '-' + Padz(IntToStr(Day), 2);
end;

function GetDateTime: string;
begin
Result := GetDateFixed + ' ' + GetTimeFixed;
end;

function GetDateTimeFromStr(str, format : String): TDateTime;
var
Val: TStringArray;
stri: Integer;

Year, Month, Day : Word;
Hour, Mins, Sec, MSec : Double;

d : Integer;
monthi: Integer;
begin
SetLength(Val, 6);
if ((str <> nil) and (str <> '') and (str <> ' ')) then
begin
Val[0] := Copy(str, 1, 4);
Val[1] := Copy(str, 6, 2);
Val[2] := Copy(str, 9, 2);

Val[3] := Copy(str, 12, 2);
Val[4] := Copy(str, 15, 2);
Val[5] := Copy(str, 18, 2);

for stri := 0 to High(Val) do
begin
if ((ExecRegExpr('-', Val[stri])) or (ExecRegExpr(':', Val[stri]))) then
begin
Result := -1;
exit;
end;
end;

Year := StrToInt(Val[0]);
Month := StrToInt(Val[1]);
Day := StrToInt(Val[2]);
Hour := StrToInt(Val[3]);
Mins := StrToInt(Val[4]);
Sec := StrToInt(Val[5]);

d := 0;
for monthi := 0 to Month do
begin
case monthi of
1: begin
d := d + 31;
end;

2: begin
d := d + 28;
end;

3: begin
d := d + 31;
end;

4: begin
d := d + 30;
end;

5: begin
d := d + 31;
end;

6: begin
d := d + 30;
end;

7: begin
d := d + 31;
end;

8: begin
d := d + 31;
end;

9: begin
d := d + 30;
end;

10: begin
d := d + 31;
end;

11: begin
d := d + 30;
end;

12: begin
d := d + 31;
end;
end;
end;

// Leap year isn't calculated...
//d := d + (Year - 1900)/4

if (format = 'yyyy-dd-MM hh:mm:ss') then
Result := ((Year-1900)*365) + d + Day + ((Hour + Mins/60 + Sec/3600)/24)
else
Result := -1;
end else
Result := -1;
end;

// Example: Writeln(GetTimeIntervalFromDateTime('min', GetDateTimeFromStr(Handle_ReadINI('Blue Dragonhide', 'lastUpdated', Table_BuyUpdates), 'yyyy-dd-MM hh:mm:ss')));
function GetTimeIntervalFromDateTime(intervalType: String; dt: TDateTime): Integer;
var
Year, Month, Day : Word;
Hour, Mins, Sec, MSec : Word;

Year_, Month_, Day_ : Word;
Hour_, Mins_, Sec_, MSec_ : Word;

Diff: TDateTime;
begin
DecodeDate(Date, Year, Month, Day);
DecodeTime(Now, Hour, Mins, Sec, MSec);

DecodeDate(dt, Year_, Month_, Day_);
DecodeTime(dt, Hour_, Mins_, Sec_, MSec_);

diff := GetDateTimeFromStr(Padz(IntToStr(Year), 4) + '-' + Padz(IntToStr(Month), 2) + '-' + Padz(IntToStr(Day), 2) + ' ' + Padz(IntToStr(Hour), 2) + ':' + Padz(IntToStr(Mins), 2) + ':' + Padz(IntToStr(Sec), 2), 'yyyy-dd-MM hh:mm:ss');
diff := diff - GetDateTimeFromStr(Padz(IntToStr(Year_), 4) + '-' + Padz(IntToStr(Month_), 2) + '-' + Padz(IntToStr(Day_), 2) + ' ' + Padz(IntToStr(Hour_), 2) + ':' + Padz(IntToStr(Mins_), 2) + ':' + Padz(IntToStr(Sec_), 2), 'yyyy-dd-MM hh:mm:ss');

if (Lowercase(intervalType) = 'day') then
Result := Round(diff)
else if (Lowercase(intervalType) = 'hour') then
Result := Round(24*diff)
else if (Lowercase(intervalType) = 'min') then
Result := Round(24*60*diff)
else if (Lowercase(intervalType) = 'sec') then
Result := Round(24*60*60*diff)
else if (Lowercase(intervalType) = 'msec') then
Result := Round(24*60*60*1000*diff)
else
Result := 9999999999;
end;

procedure WaitUntilNotMoving_Custom(maxTime: Integer);
var
procedureTimeMark : Integer;
begin
Writeln('Waiting until character stops moving (or up to ' + IntToStr(maxTime/1000) + ' secs.)...');
MarkTime(procedureTimeMark);
repeat
Wait(100);
until ((not IsMoving()) or (TimeFromMark(procedureTimeMark) >= maxTime)); // Make sure character is not moving to prevent DTM coordinate screw up
end;

procedure WaitUntilNotMoving;
begin
WaitUntilNotMoving_Custom(10000);
end;

procedure GetDifferentUpText_Loop;
var
strL: TStringList;
test: String;
foundStr: Boolean;

coordx, coordy, x, y : Integer;
begin
coordx := 49;
coordy := 106;

MMouse(coordx, coordy, 5, 5);
strL := TStringList.Create;;
repeat
test := GetUpText;
foundStr := False;

if (test <> nil) then
begin
test := Replace(test, 'Withdraw-1 ', '');
test := Replace(test, ' / 7 more options', '');
for i := 0 to strL.Count - 1 do
begin
//if (ExecRegExpr(test, strL[i])) then
if (test = strL[i]) then
begin
foundStr := True;
break;
end;
end;

if (not foundStr) then
begin
strL.Add(test);
Writeln(test);
//Wait(1000);
end;
end;

RandomAntiBan_Custom_SetDebug(False, 2000);

GetMousePos(x, y);
if ((x <> 9) and (y <> 106)) then
begin
//Writeln('Moving Mouse!');
MMouse(coordx, coordy, 0, 0);
Wait(100 + Random(100));
end;
until (false);
end;

function RemoveStringMatches(_strL: TStringList): TStringList;
var
strL: TStringList;
test: String;
found: Boolean;
n, n2: Integer;
newCount: Integer;
begin
newCount := 0;
strL := TStringList.Create();
//SetLength(strL, Length(_strL));

for n:= 0 to (_strL.Count - 1) do
begin
test := _strL[n];
found := False;

if (test <> nil) then
begin
for n2 := 0 to (_strL.Count - 1) do
begin
if (n <> n2) then
begin
if (test = _strL[n2]) then
begin
found := True;
break;
end;
end;
end;

if (not found) then
begin
strL.Add(test);
Inc(newCount);
end;
end;
end;

//SetLength(strL, newCount);
Writeln('[RemoveStringMatches] Removed: ' + IntToStr(_strL.Count - strL.Count) + '; New Length: ' + IntToStr(strL.Count));
Result := strL;
end;

function RemoveCloseTPAPoints(_TPA: TPointArray; distance: Integer): TPointArray;
var
TPA: TPointArray;
test: TPoint;
found: Boolean;
n, n2 : Integer;
newCount: Integer;

xModi, yModi : Integer;
begin
newCount := 0;
SetLength(TPA, Length(_TPA));

for n := 0 to High(_TPA) do
begin
test := _TPA[n];
found := False;

for n2 := 0 to High(_TPA) do
begin
if (n <> n2) then
begin


for xModi := 0 to distance do
begin
if (((test.x - xModi) = _TPA[n2].x) or ((test.x + xModi) = _TPA[n2].x)) then
begin

for yModi := 0 to distance do
begin
if (((test.y - yModi) = _TPA[n2].y) or ((test.y + yModi) = _TPA[n2].y)) then
begin
found := True;
break;
end;
end;

end;
end;


end;
end;

if (not found) then
begin
TPA[newCount] := test;
Inc(newCount);
end;
end;

if (newCount = 0) then
begin
newCount := 1;
TPA[0] := _TPA[RandomRange(0, High(_TPA))];
end;

SetLength(TPA, newCount);
Writeln('[RemoveCloseTPAPoints] Removed: ' + IntToStr(Length(_TPA) - Length(TPA)) + '; New Length: ' + IntToStr(Length(TPA)));
Result := TPA;
end;

function TrimTPA_Custom(_TPA: TPointArray; newLength: Integer): TPointArray;
begin
if (newLength > 0) then
begin
if (newLength < Length(_TPA)) then
SetLength(_TPA, newLength);
end else
SetLength(_TPA, 1);

Result := _TPA;
end;

function TrimTPA(_TPA: TPointArray): TPointArray;
begin
Result := TrimTPA_Custom(_TPA, 50);
end;

function FileToString(filePath: String; commaDelimit: Boolean): String;
var
strL: TStringList;
str: String;
n: Integer;
begin
strL := TStringList.Create();
strL.LoadFromFile(filePath);

strL := RemoveStringMatches(strL);

for n := 0 to (strL.Count - 1) do
begin
if (n < (strL.Count - 1)) then
begin
str := str + strL[n];

if (commaDelimit) then
str := str + ','
else
str := str + CRLF;
end else
begin
str := str + strL[n];
end;
end;
strL.Free;

Result := str;
end;

function FileToCommaString(filePath: String): String;
begin
Result := FileToString(filePath, True);
end;

// Example: strA := CommaStringToTStringArray(Handle_ReadINI('a', 'b', 'C:/test.ini'));
function CommaStringToTStringArray(str: String): TStringArray;
var
strL: TStringList;
n: Integer;
begin
strL := TStringList.Create();
strL.CommaText := str;

SetLength(Result, strL.Count);

for n := 0 to (strL.Count - 1) do
begin
Result[n] := strL[n];
//Writeln(Result[n]);
end;

strL.Free;
end;

function CommaStringToLineSpacedString(str: String): String;
begin
//Result := Replace(str, ',', CRLF, rfReplaceAll);
Result := Replace(str, ',', CRLF);
end;

// Example: PrintTextAtEx_AllFonts(65, 344, Tol, False, False, 0, 2, 23200, 50, False, tr_AllChars);
procedure PrintTextAtEx_AllFonts(x, y: Integer; Tolerance: Integer; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer; TextLength: Integer; Strict: Boolean; Range: TCharRange);
var
fonti: Integer;
begin
for fonti := 0 to High(fontset) do
begin
Writeln(GetTextAtEx(x, y, Tolerance, fontset[fonti], CheckShadow, CheckOutline, MinSpacing, MaxSpacing, TextColor, TextLength, Strict, Range) + ' [Font: ' + fontset[fonti] + ']');
end;
end;

procedure DrawTPAToBoxes_IfDebug_Custom(_TPA: TPointArray; limit: Boolean);
var
boxes: TBoxArray;
n: Integer;
begin
{$IFDEF CUSTOM_DEBUG_DRAW}
if (not SMART_DebugSetup) then
SMART_SetupDebug();

if (limit) then
begin
// Limit to 25 boxes
if (Length(_TPA) < 25) then
SetLength(boxes, Length(_TPA))
else
SetLength(boxes, 25);
end else
SetLength(boxes, Length(_TPA));

SMART_ClearCanvas();
for n := 0 to High(boxes) do
begin
boxes[n].X1 := (_TPA[n].x - 10);
boxes[n].Y1 := (_TPA[n].y - 10);
boxes[n].X2 := (_TPA[n].x + 10);
boxes[n].Y2 := (_TPA[n].y + 10);
SMART_DrawBoxEx(False, boxes[n], clRed);
end;

//Writeln('Drew TPAToBoxes.');
{$ENDIF}
end;

procedure DrawTPAToBoxes_IfDebug(_TPA: TPointArray);
begin
{$IFDEF CUSTOM_DEBUG_DRAW}
DrawTPAToBoxes_IfDebug_Custom(_TPA, True);
{$ENDIF}
end;

procedure DrawBox_IfDebug_Custom(_x, _y : Integer; limit: Boolean);
var
newTPA: TPointArray;
begin
{$IFDEF CUSTOM_DEBUG_DRAW}
SetLength(newTPA, 1);
newTPA[0].x := _x;
newTPA[0].y := _y;
DrawTPAToBoxes_IfDebug_Custom(newTPA, limit);
{$ENDIF}
end;

procedure DrawBox_IfDebug(_x, _y : Integer);
begin
{$IFDEF CUSTOM_DEBUG_DRAW}
DrawBox_IfDebug_Custom(_x, _y, True);
{$ENDIF}
end;

procedure WriteStopError_Custom(_stopError: Integer; _stopReason: String);
begin
Writeln('[Stop Error] - ' + _stopReason);

Handle_WriteINI(IntToStr(botNumber), 'stopError', IntToStr(_stopError), Table_States);
Handle_WriteINI(IntToStr(botNumber), 'stopReason', _stopReason, Table_States);
end;

procedure WriteStopError(_stopReason: String);
begin
WriteStopError_Custom(1, _stopReason);
end;

procedure OnLogin(findRandoms: Boolean);
begin
WaitM;

// Hide Squeal of Fortune
MMouse(463, 283, 2, 2);
WaitQ;
Mouse(463, 283, 2, 2, True);
WaitM;

ClickNorth(SRL_ANGLE_HIGH);
WaitQ;
SaveScreenshot(ScreenshotStart);
Update;

if (findRandoms) then
FindNormalRandoms();
WaitQ;
end;

procedure ScriptStartup_Custom(findRandoms: Boolean);
begin
SetScriptProp(SP_WriteTimeStamp, [True]);

// Create table .ini files if they do not exist
if (not FileExists(Table_Accounts)) then
CreateFile(Table_Accounts);
if (not FileExists(Table_AccountsUpdates)) then
CreateFile(Table_AccountsUpdates);
if (not FileExists(Table_Screenshots)) then
CreateFile(Table_Screenshots);
if (not FileExists(Table_States)) then
CreateFile(Table_States);
if (not FileExists(Table_Buy)) then
CreateFile(Table_Buy);
if (not FileExists(Table_Sell)) then
CreateFile(Table_Sell);

if (custom_Procs[custom_OnStartup] <> nil) then
custom_Procs[custom_OnStartup]();

ClearDebug;
try
SetupSRL;
except
RestartScript;
end;
SRL_Procs[srl_OnRSUpdate] := @RestartScript;

if (custom_Procs[custom_SetDTMs] <> nil) then
custom_Procs[custom_SetDTMs]();

Handle_WriteINI(IntToStr(botNumber), 'stopError', '0', Table_States);
Handle_WriteINI(IntToStr(botNumber), 'stopReason', ' ', Table_States);
Handle_WriteINI(IntToStr(botNumber), 'scriptRunning', '1', Table_States);
//Handle_WriteINI(IntToStr(botNumber), 'messageSent', '0', Table_States);

custom_DeclarePlayersProc();

if (custom_Procs[custom_OnStartup_AfterSRLSetup] <> nil) then
custom_Procs[custom_OnStartup_AfterSRLSetup]();

LoginPlayer;
//botNumber := StrToInt(Handle_ReadINI(Players[0].Name, 'account', Table_Accounts));

Handle_WriteINI(IntToStr(botNumber), 'loggedIn', '1', Table_States);
Handle_WriteINI(IntToStr(botNumber), 'lastUpdated', GetDateTime, Table_States);

if (FileExists(ScreenshotName)) then
DeleteFile(ScreenshotName);
if (FileExists(ScreenshotStart)) then
DeleteFile(ScreenshotStart);
if (FileExists(ScreenshotBeforeLogout)) then
DeleteFile(ScreenshotBeforeLogout);
if (FileExists(ScreenshotBank)) then
DeleteFile(ScreenshotBank);
if (FileExists(ScreenshotName)) then
DeleteFile(Replace(ScreenshotName, '.bmp', '.png'));
if (FileExists(ScreenshotStart)) then
DeleteFile(Replace(ScreenshotStart, '.bmp', '.png'));
if (FileExists(ScreenshotBeforeLogout)) then
DeleteFile(Replace(ScreenshotBeforeLogout, '.bmp', '.png'));
if (FileExists(ScreenshotBank)) then
DeleteFile(Replace(ScreenshotBank, '.bmp', '.png'));

OnLogin(findRandoms);

if (custom_Procs[custom_OnLogin_FirstTime] <> nil) then
begin
custom_Procs[custom_OnLogin_FirstTime]();
WaitQ;
end;
end;

procedure ScriptStartup;
begin
ScriptStartup_Custom(True);
end;

procedure OnTerminate;
begin
Update();

Writeln('Exiting to lobby...');
Wait(1000 + Random(200));
SaveScreenshot(ScreenshotBeforeLogout);
ExitToLobby();

Handle_WriteINI(IntToStr(botNumber), 'loggedIn', '0', Table_States);
Handle_WriteINI(IntToStr(botNumber), 'scriptRunning', '0', Table_States);

if (custom_Procs[custom_FreeDTMs] <> nil) then
custom_Procs[custom_FreeDTMs]();
end;

Besides comments, I know I need to be consistent with method parentheses. I started making sure I always have them but I haven't gotten around to adding them to all older methods.

By the way, here's a progress report for smelter part of the script. It usually goes until a random or until it runs out of materials. This time it was an update, so it called to restart the script.

[5:59:59]: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[5:59:59]: Load done! Loads done so far: 215
[5:59:59]: Number of bronze bars smelted: 3010
[5:59:59]: Total time running: 5 Hours, 59 Minutes and 59 Seconds
[5:59:59]: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[5:59:59]: Found Counter DTM(s).
[6:00:00]: [RemoveCloseTPAPoints] Removed: 49; New Length: 1
[6:00:01]: Found Counter uptext.
[6:00:04]: Found Bank Screen.
[6:00:05]: Unable to find 'Tin ore' uptext!
[6:00:06]: Unable to find 'Tin ore' uptext!
[6:00:06]: Unable to find 'Tin ore' uptext!
[6:00:06]: Unable to find 'Tin ore' uptext!
[6:00:06]: Unable to find 'Tin ore' uptext!
[6:00:07]: Unable to find 'Tin ore' uptext!
[6:00:07]: Unable to find 'Tin ore' uptext!
[6:00:07]: Unable to find 'Tin ore' uptext!
[6:00:07]: Unable to find 'Tin ore' uptext!
[6:00:11]: Found Bank Screen.
[6:00:12]: Unable to find 'Tin ore' uptext!
[6:00:12]: Unable to find 'Tin ore' uptext!
[6:00:13]: Unable to find 'Tin ore' uptext!
[6:00:13]: Unable to find 'Tin ore' uptext!
[6:00:13]: Unable to find 'Tin ore' uptext!
[6:00:14]: Unable to find 'Tin ore' uptext!
[6:00:14]: Unable to find 'Tin ore' uptext!
[6:00:14]: Unable to find 'Tin ore' uptext!
[6:00:15]: Unable to find 'Tin ore' uptext!
[6:00:16]: Found Bank Screen.
[6:00:16]: Unable to find 'Tin ore' uptext!
[6:00:17]: Unable to find 'Tin ore' uptext!
[6:00:17]: Unable to find 'Tin ore' uptext!
[6:00:17]: Unable to find 'Tin ore' uptext!
[6:00:17]: Unable to find 'Tin ore' uptext!
[6:00:18]: Unable to find 'Tin ore' uptext!
[6:00:18]: Unable to find 'Tin ore' uptext!
[6:00:18]: Unable to find 'Tin ore' uptext!
[6:00:18]: Unable to find 'Tin ore' uptext!
[6:00:19]: Unable to find Counter DTM!
[6:00:19]: Checking if at bank…
[6:00:19]: Found Al Kharid Bank DTM.
[6:00:20]: Waiting until character stops moving (or up to 10 secs.)…
[6:00:24]: Found Counter DTM(s).
[6:00:25]: [RemoveCloseTPAPoints] Removed: 49; New Length: 1
[6:00:26]: Found Counter uptext.
[6:00:29]: Found Bank Screen.
[6:00:30]: Found Tin ore uptext.
[6:00:33]: Retrieved Tin ores.
[6:00:34]: Found Copper ore uptext.
[6:00:37]: Retrieved Copper ores.
[6:00:38]: Resting until 80…
[6:00:47]: Found Walk DTM 0.
[6:00:54]: Found Walk DTM 4.
[6:01:02]: Waiting until character stops moving (or up to 8 secs.)…
[6:01:02]: Found Furnace DTM(s).
[6:01:03]: [RemoveCloseTPAPoints] Removed: 49; New Length: 1
[6:01:04]: Found Furnace uptext.
[6:01:09]: Smelting bronze bars (35 seconds)…
[6:01:30]: AntiBan: Random Right Click.
[6:01:45]: Made all bars.
[6:01:46]: Unable to find Walk DTM 2!
[6:01:46]: Unable to find Tanner Building DTM!
[6:01:47]: Welcome to Runescape.
[6:01:47]: Account name
[6:01:53]: 'Client token changed.'
[6:01:54]: Calling to restart script…
[6:01:54]: Exiting to lobby…
[6:01:56]: Freeing DTMs…
[6:01:56]: Exception in Script: Not enough parameters
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

Er1k

2012-03-10 22:27:14

Copy and paste the script and wrap it with simba tags here, then we can review it.

Kyle Undefined

2012-03-10 22:36:41

Holy crap! Going to go through everything.


From: Er1k
Copy and paste the script and wrap it with simba tags here, then we can review it.


There's a lot of code, there's no way for him to attach everything.

Er1k

2012-03-10 22:38:45

Maybe show a script or 2 and attach others? I looked at them too. All are 1k lines+ with a lot of DTM uses and custom functions. It's interesting.

davis_junior

2012-03-10 22:42:41

I just added the tanner/smelter without the DDTMs.

Edit: I made it a bit more readable and also added my main custom include. Also, I did not comment very much, but I will go through and comment everything once they are all finished (which I don't know when that will be).

PatDuffy

2012-03-10 23:08:46

I'm not even going to look at the scripts, your too new here to get a yes from me.

Become an active member of the community, I look at that as more important than scripts.

davis_junior

2012-03-10 23:11:14

From: PatDuffy
I'm not even going to look at the scripts, your too new here to get a yes from me.

Become an active member of the community, I look at that as more important than scripts.


Ok, thanks for the criticism, though.

Daniel

2012-03-10 23:44:02

Why have a forward directive on every single method?

davis_junior

2012-03-10 23:49:27

From: Daniel
Why have a forward directive on every single method?


I actually missed a couple in the tanner/smelter script. I do this for organization, and I'm able to quickly find those methods just by looking at that section.

Jagex_Fagex

2012-03-11 10:37:29

Sorry mate, as PatDuffy said, you have way too low activity for me to consider.

davis_junior

2012-03-11 10:49:34

From: Jagex_Fagex
Sorry mate, as PatDuffy said, you have way too low activity for me to consider.


That's fine; I don't think I'll get accepted this time anyway (I'm seeing win/loss = 0/5), but what do you think is a reasonable amount of activity for me to be considered?

Also, is there anything else I should improve upon? So far, the only reason people have said why they haven't accepted me is activity. Is that it?

I know there is more to see of me with more activity, but I can assure you I'm not rude, I can be helpful, etc.

Jagex_Fagex

2012-03-11 11:15:37

You have been here since 07, with 24 posts. Clearly you haven't been active all that time, which isn't an issue. I would expect anyone that wants to be a member to have at least a couple of hundred posts, this shows that they are dedicated to the community and allows everyone to see what that person is like and judge them for themselves.

Note that this is all personal preference and in no way is it what everyone will be looking for. I myself didn't even look at your scripts, because regardless of scripting talent, if you aren't a part of the community, i'm going to vote no, also, by the time you apply next time, you will most likely have gotten better at scripting.

DemiseScythe

2012-03-11 12:15:34

I usually vote Yes on all apps with a script to encourage people to keep trying but I am going to vote no this time because I am disappointed at your DTMWalk:


function FindWalkDTM(walkNumber: Integer; var xOut: Integer; var yOut: Integer; x1: Integer; y1: Integer; x2: Integer; y2: Integer): Boolean;
var
WalkDTM : Integer;
begin
WalkDTM := DDTMWalk(walkNumber);
SetDTMName(WalkDTM, 'DDTMWalk(' + IntToStr(walkNumber) + ')');
if (FindDTM(WalkDTM, xOut, yOut, x1, y1, x2, y2)) then
begin
DrawBox_IfDebug(xOut, yOut);
FreeDTM(WalkDTM);
Result := True;
exit;
end;
FreeDTM(WalkDTM);

Result := False;
end;


You use FindDTM, that only works if the minimap angle is the same everytime. If you are going to use DTMs for walking, use FindDTMRotated instead. For a script that relies a lot on walking, your walking doesn't seem too reliable for me. Don't take it bad, you on the right path here but if you are going to bring DTMs into your script, I am going to make sure they are used correctly.

I <3 DTMs ^.^~

Good luck next time

davis_junior

2012-03-11 12:31:03

From: DemiseScythe
I usually vote Yes on all apps with a script to encourage people to keep trying but I am going to vote no this time because I am disappointed at your DTMWalk:



You use FindDTM, that only works if the minimap angle is the same everytime. If you are going to use DTMs for walking, use FindDTMRotated instead. For a script that relies a lot on walking, your walking doesn't seem too reliable for me. Don't take it bad, you on the right path here but if you are going to bring DTMs into your script, I am going to make sure they are used correctly.

I <3 DTMs ^.^~

Good luck next time


Ok, thanks! I have been using the scripts for some time now with minor DTM finding issues, but for every one that fails, I add an alternative. I always thought it was just completely different colors from the minimap when it would fail, but it must just be that it needs that function instead as you have said. I'll definitely switch them out.

'Toxin

2012-03-12 02:19:18

From: Jagex_Fagex
You have been here since 07, with 24 posts. Clearly you haven't been active all that time, which isn't an issue. I would expect anyone that wants to be a member to have at least a couple of hundred posts, this shows that they are dedicated to the community and allows everyone to see what that person is like and judge them for themselves.

Note that this is all personal preference and in no way is it what everyone will be looking for. I myself didn't even look at your scripts, because regardless of scripting talent, if you aren't a part of the community, i'm going to vote no, also, by the time you apply next time, you will most likely have gotten better at scripting.


I really couldn't have said it any better myself, and I don't do this much on applications because I usually have different things to say than other people, but 'this'. Anyway, further luck next time :)

Daniel

2012-03-20 01:31:15

From: davis_junior
I do this for organization, and I'm able to quickly find those methods just by looking at that section.

What about Simba's function list?

davis_junior

2012-03-20 14:32:06

From: Daniel
What about Simba's function list?


Yes, I already know about that. However, here are some reasons why I don't use it:

  • Methods with longer parameters aren't displayed in full.
  • It only lists method names and not parameters. You must click the method you want to view to see the parameters, and as I have already said, it does not completely display methods with longer parameters.
  • It is occasionally bugged and does not show all methods. At least this was the case before; I don't know if it's been fixed.
  • It does not allow for white-space, and therefore, I am unable to group similar methods for reference.
  • (When using forward references) When I change a method, for instance, by changing its name or parameters, I am unable to compile. This will help when I add method comments because I will be notified when I must change the comments also. With Simba's function list, I am unable to do this.

Anyway, am I using them incorrectly?

nielsie95

2012-03-24 06:46:48

I don't think you're using them incorrectly, and it looks like you put them there for a reason. I'd say it's no biggie.

It looks like you're not getting in this time.
Try again in two weeks! :)