rickhunley
2015-05-19 18:14:01
Hi Everyone,
Thought I'd post my developments here. First time scripting. I'm epic noob, and will no doubt need epic help.
I'm mostly using @Twinki script, trying to modify it so it works with Ellis.
This will be for Runescape 3.
Proggy Update

Here is script so far:
Update: Ellis now works after renaming haha.
Update: Banker selection rate seems to have improved, focused colour on green pants. Changed exclude distance to 100. Banker bug below still exists
New bugs:
SUPER BUG 1.1 - Banker identification isn't too bad, but sometimes finds banker and then misclicks open bank, even though they are right in front of the character. Has a high tendency to choose the banker on the far left which screws the pathway. Is bank selection random or is there something in the code that's making it pick the one on the left? If it chooses the banker from the far left, or second to left, it then sets the pathway to the left of Al Kharid, instead of going North to the tanner. Advice please?
SUPER BUG 1.2 - Pathfinding is not consistent. When you run to Ellis, sometimes the pathfind clicks to the far left of the bank, as if you're going to Lumbridge, when the tanner is dead north.
BUG 1.3 - When reaches Ellis, Ellis can sometimes be under the door way and not detect his head (only colour that was safe). Possible to rotate camera angle to east or west which will detect him?
BUG 1.4 - By the time Ellis has been detected, and the mouse goes to that hotspot, and then tries to right click, Ellis has moved. How to fix?
Improvements: Identifies Ellis colour, but mouse movement to reach that colour, and by the time Ellis moves is slow, and misses the right click action a lot of the time. How do I improve mouse speed?
Improvements: Instead of script terminating, extend time to find Ellis, and repeat loops again.
Please help with bugs and improvements Going to test it again…
Feels like it's almost done. Been going all day!
Thanks for help
Thought I'd post my developments here. First time scripting. I'm epic noob, and will no doubt need epic help.
I'm mostly using @Twinki script, trying to modify it so it works with Ellis.
This will be for Runescape 3.
Proggy Update

Here is script so far:
Update: Ellis now works after renaming haha.
Update: Banker selection rate seems to have improved, focused colour on green pants. Changed exclude distance to 100. Banker bug below still exists
New bugs:
SUPER BUG 1.1 - Banker identification isn't too bad, but sometimes finds banker and then misclicks open bank, even though they are right in front of the character. Has a high tendency to choose the banker on the far left which screws the pathway. Is bank selection random or is there something in the code that's making it pick the one on the left? If it chooses the banker from the far left, or second to left, it then sets the pathway to the left of Al Kharid, instead of going North to the tanner. Advice please?
SUPER BUG 1.2 - Pathfinding is not consistent. When you run to Ellis, sometimes the pathfind clicks to the far left of the bank, as if you're going to Lumbridge, when the tanner is dead north.
BUG 1.3 - When reaches Ellis, Ellis can sometimes be under the door way and not detect his head (only colour that was safe). Possible to rotate camera angle to east or west which will detect him?
BUG 1.4 - By the time Ellis has been detected, and the mouse goes to that hotspot, and then tries to right click, Ellis has moved. How to fix?
Improvements: Identifies Ellis colour, but mouse movement to reach that colour, and by the time Ellis moves is slow, and misses the right click action a lot of the time. How do I improve mouse speed?
Improvements: Instead of script terminating, extend time to find Ellis, and repeat loops again.
Please help with bugs and improvements Going to test it again…
Feels like it's almost done. Been going all day!
Thanks for help
program RickHunley;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
{------------------------------------------------------------------------------)
Thanks to all those people who motivated me to write my first script.
Twinki, this is his original script modified for Al Kharid
furrykittens, for the motivation.
Thank you guys in the IRC for pointing out some mistakes and improvements that could be made
(------------------------------------------------------------------------------}
{--- Constants that can easily be updated * No touchy, unless you know what you're doing--}
Const
{--- Banker / Bank Booth---}
B_HUE := 0.23;
B_SAT := 0.35;
B_COLOR := 5142827;
B_TOL := 8;
B_FILTER := 15; //ATPA Filter
{--- Relative Object for Banker ---}
rB_HUE := 0.23;
rB_SAT := 0.35;
rB_COLOR := 5142827;
rB_TOL := 8;
rB_EXCLUDE := 100; //Exclude Distance
{--- Ellis the Tanner ---}
E_HUE := 0.62;
E_SAT := 0.70;
E_COLOR := 3291714;
E_TOL := 5;
E_FILTER := 3; //ATPA Filter
{--- Relative Object for Ellis ---}
rE_HUE := 0.62;
rE_SAT := 5.98;
rE_COLOR := 3291714;
rE_TOL := 3;
rE_EXCLUDE := 150; //Exclude Distance
Var
HardLeatherDTM, GreenLeatherDTM, BlueLeatherDTM, RedLeatherDTM,
BlackLeatherDTM, RoyalLeatherDTM, TotalTannedLeather, scriptPaintBMP: Integer;
BotStatus: String;
scriptSMARTDebug: boolean;
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'RickHunley';
scriptHelpThread := '';
editBoxLabels := ['Amount to Tan: ', 'Bank Preset'];
editBoxDefaults := ['100000', '1'];
editBoxHints := ['Amount of Hide to Tan', 'Bank Preset to use (1 or 2)'];
checkBoxLabels := ['Draw on SMART', 'RickHunley SMART Debug'];
checkBoxDefaults := ['True', 'False'];
checkBoxHints := ['Do you want do draw some debug information on SMART?', 'Turns on RickHunley SMART Debug'];
end;
end;
procedure declarePlayers();
var
i: Integer;
begin
players.setup(playerForm.playerNames, playerForm.playerFile);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
smartEnableDrawing := strToBool(playerForm.players[i].settings[2]);
scriptSMARTDebug := strToBool(playerForm.players[i].settings[3]);
end;
end;
{------------------------------------------------------------------------------)
Function: CheckIfFrozen
Description: Checks if the screen is frozen/is in a loading screen by using PixelShift
Credits: Twinki
(------------------------------------------------------------------------------}
function CheckIfFrozen(MarkerWaitTime: Integer = 5000): boolean;
Var
pS, i: Integer;
FrozenTimer: TTimeMarker;
begin
FrozenTimer.start();
result := true;
repeat
pS := getPixelShift(mainscreen.getBounds(), 500);
if scriptSMARTDebug then
WriteLn('Current PixelShift: '+toStr(pS));
if Ps <= 100 then
begin
repeat
Wait(randomRange(250, 750));
pS := getPixelShift(mainscreen.getBounds(), 500);
until (Ps >= 500) or (FrozenTimer.getTime() >= 10000);
end;
if not (minimap.isPlayerMoving()) and (Ps >= 500) then
break();
until FrozenTimer.getTime() >= MarkerWaitTime;
end;
{------------------------------------------------------------------------------)
Function: FindTheTwinki
Description: Custom FindObject. Anyone is welcome to use this, I just ask you provide credits where it's due!
Credits: Twinki (Thank you TheMayor, hoodz, Ross, and BMWxi for the help!)
(------------------------------------------------------------------------------}
function FindTheTwinki(Hue, Sat: extended; Color, Tolerance, Filter, clickType: Integer; mouseOverText, chooseOptions: array of string;
FindRelativeObject: boolean = false; rHue, rSat: extended = 0; rColor, rTolerance: Integer = 0; excludePointsDist: Integer = 150; Cluster: boolean = false; ClusterDist: Integer = 50): boolean;
Var
X, Y, i: integer;
rTPA, TPA: TPointArray;
ATPA: T2DPointArray;
rPoint: TPoint;
begin
if not isLoggedIn() then
exit;
CheckIfFrozen(randomRange(2500, 3500));
if FindRelativeObject then
begin
findColorsSpiralTolerance(X, Y, rTPA, rColor, mainScreen.getBounds(), rTolerance, colorSetting(2, rHue, rSat));
if length(rTPA) < 1 then
exit(false);
if scriptSMARTDebug then
smartImage.debugTPA(rTPA, false);
rPoint := middleTPA(rTPA);
end;
findColorsSpiralTolerance(X, Y, TPA, Color, mainScreen.getBounds(), Tolerance, colorSetting(2, Hue, Sat)); //NOTE: Core of this function
if length(TPA) < 1 then
exit(false);
if FindRelativeObject then
TPA.excludePointsDist(0, excludePointsDist, rPoint.x, rPoint.y);
if Cluster then
ATPA := ClusterTPA(TPA, ClusterDist)
else
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(1, Filter);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
if scriptSMARTDebug then
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
if scriptSMARTDebug then
smartImage.drawText('ATPA Length: '+IntToStr(length(ATPA[i])), point(ATPA[i][0].x+10, ATPA[i][0].y+10), clLime);
if (length(ATPA[i]) <= 10) then
Continue; //NOTE: *Will go to the next index if the current TPA length (in the ATPA) is less than 10
pickUpMouse();
case random(50) of
1..30: Mouse(ATPA[i].getBounds().getRandomPoint(), MOUSE_MOVE);
31..50: missMouse(ATPA[i].getBounds().getRandomPoint(), true);
end;
if isMouseOverText(mouseOverText, 150) then
begin
fastClick(clickType);
Wait(randomRange(250, 750));
if (clickType = MOUSE_RIGHT) and (chooseOption.optionsExist(chooseOptions)) then
if not chooseOption.select(chooseOptions, 1000) then
Continue;
exit(true);
end
else
Continue;
end;
if scriptSMARTDebug then
smartImage.clear();
end;
{------------------------------------------------------------------------------)
Procedure: Proggy
Description: Draws a progress report on SMART
Credits: Clarity, for the right coordinates :D
(------------------------------------------------------------------------------}
procedure Proggy;
begin
if not smartEnableDrawing then
begin
WriteLn('***************TwinkiTanner***************');
WriteLn('* Time Running: '+ToStr(TimeRunning));
WriteLn('* Leathers Tanned: '+ToStr(TotalTannedLeather));
WriteLn('* STATUS: ',+BotStatus);
WriteLn('******************************************');
end
else
begin
smartImage.clear;
smartImage.drawBitmap(scriptPaintBMP, point(actionbar.x1 + 390, actionbar.y1 - 185));
smartImage.drawText('TwinkiTanner', point(mainscreen.x1 + 5, mainscreen.y1 + 5), 'LoginChars', true, clWhite);
smartImage.drawText('Time Running:', point(mainscreen.x1 + 15, mainscreen.y1 + 25), 'SmallChars', true, clYellow);
smartImage.drawText(toStr(TimeRunning), point(mainscreen.x1 + 96, mainscreen.y1 + 25), 'SmallChars', true, clWhite);
smartImage.drawText('Tanned:', point(mainscreen.x1 + 15, mainscreen.y1 + 50), 'SmallChars', true, clYellow);
smartImage.drawText(toStr(TotalTannedLeather) + ' hides', point(mainscreen.x1 + 61, mainscreen.y1 + 50), 'SmallChars', true, clWhite);
smartImage.drawText('STATUS: ', point(actionbar.x1 + 5, actionbar.y1 - 20), 'Loginchars', true, clWhite);
smartImage.drawText(BotStatus, point(actionbar.x1 + 68, actionbar.y1 - 20), 'Loginchars', true, clYellow);
end;
end;
{------------------------------------------------------------------------------)
Procedure: RunToEllis
Description: Runs to Ellis the Tanner
(------------------------------------------------------------------------------}
procedure RunToEllis;
Var
PathToEllis: TPointArray;
begin
if not isLoggedIn() then
exit;
BotStatus := 'Running to Ellis the Tanner';
Proggy;
PathToEllis := [Point(66, 212), Point(74, 187), Point(79, 150), Point(66, 112)] //Thanks giavanni6 for suggestion
if not SPS.walkPath(PathToEllis) then
begin
ClearDebug();
BotStatus := 'ERROR: Hmph, we failed running to Ellis.. our legs must be broken';
Proggy;
WriteLn('ERROR: Hmph, we failed running to Ellis.. our legs must be broken'); //PrintError(1);
TerminateScript();
end;
end;
{------------------------------------------------------------------------------)
Procedure: RunToBank
Description: Runs to Al Kharid Bank
(------------------------------------------------------------------------------}
procedure RunToBank;
Var
PathToBank: TPointArray;
begin
if not isLoggedIn() then
exit;
BotStatus := 'Running to the Al Kharid Banker';
Proggy;
PathToBank := [Point(86, 138), Point(76, 176), Point(51, 213)]
if not SPS.walkPath(PathToBank) then
begin
ClearDebug();
BotStatus := 'ERROR: Hmph, we failed running to the bank.. our legs must be broken';
Proggy;
WriteLn('ERROR: Hmph, we failed running to the bank.. our legs must be broken');
TerminateScript();
end;
end;
{------------------------------------------------------------------------------)
Function: FindBanker
Description: Finds the Al Kharid Banker in Al Kharid, returns True if found, uses FindTheTwinki
(------------------------------------------------------------------------------}
function FindBanker(): boolean;
Var
BankSymbol: TPoint;
alkharidBankerTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit();
if bankScreen.isOpen() then
exit(true);
BotStatus := 'Trying to find the Al Kharid Banker';
Proggy;
alkharidBankerTimer.start();
repeat
if FindTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, random(2), ['anker','ank','ooth'], ['ank', 'ooth'], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE, true, 40) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end
else if (minimap.findSymbol(BankSymbol, MM_SYMBOL_BANK, minimap.getBounds())) and (alkharidBankerTimer.getTime() >= 10000) then
begin
BotStatus := 'Couldn''t find banker, clicking BankSymbol and trying again';
Proggy;
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
Mouse(point(BankSymbol.x + gaussRangeInt( - 5, 5), BankSymbol.y + gaussRangeInt( - 5, 5)), MOUSE_LEFT, MOUSE_HUMAN);
Wait(randomRange(250, 750));
if FindTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, random(2), ['anker','ank','ooth'], ['ank', 'ooth'], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE, true, 40) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end;
end;
until alkharidBankerTimer.getTime() >= 30000;
ClearDebug();
BotStatus := 'ERROR: Could not find the Al Kharid Banker';
Proggy;
WriteLn('ERROR: Could not find the Al Kharid Banker');
TerminateScript();
end;
{------------------------------------------------------------------------------)
Procedure: FindEllis
Description: Finds Ellis the Tanner using FindTheTwinki
(------------------------------------------------------------------------------}
function FindEllis(): boolean;
Var
TannerSymbol: TPoint;
ellisOvalTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit();
if productionScreen.isOpen() then
productionscreen.close();
BotStatus := 'Trying to find Ellis the Tanner';
Proggy;
ellisOvalTimer.start();
repeat
if FindTheTwinki(E_HUE, E_SAT, E_COLOR, E_TOL, E_FILTER, MOUSE_RIGHT, ['Ellis','llis'], ['an', 'ide'], true, rE_HUE, rE_SAT, rE_COLOR, rE_TOL, rE_EXCLUDE, true, 30) then
begin
BotStatus := 'Found Ellis';
Proggy;
exit(true);
end
else if (minimap.findSymbol(TannerSymbol, MM_SYMBOL_TANNER, minimap.getBounds())) and (ellisOvalTimer.getTime() >= 10000) then
begin
BotStatus := 'Couldn''t find Ellis, clicking Tanner Symbol and trying again';
Proggy;
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
Mouse(point(TannerSymbol.x + gaussRangeInt( - 5, 5), TannerSymbol.y + gaussRangeInt( - 5, 5)), MOUSE_LEFT, MOUSE_HUMAN);
Wait(randomRange(250, 750));
if FindTheTwinki(E_HUE, E_SAT, E_COLOR, E_TOL, E_FILTER, MOUSE_RIGHT, ['Ellis','llis'], ['an', 'ide'], true, rE_HUE, rE_SAT, rE_COLOR, rE_TOL, rE_EXCLUDE, true, 30) then
mouseBox(mainScreen.playerBox);
if (isMouseOverText(['Ellis','llis'])) then
begin
fastClick(MOUSE_RIGHT);
Wait(randomRange(250, 750));
chooseOption.select(['an', 'ide'], 1000);
BotStatus := 'Found Ellis';
Proggy;
exit(true);
end;
end;
until ellisOvalTimer.getTime() >= 30000;
ClearDebug();
BotStatus := 'ERROR: Could not find Ellis';
Proggy;
WriteLn('ERROR: Could not find Ellis');
TerminateScript();
end;
{------------------------------------------------------------------------------)
Procedure: BankHides
Description: Uses Bank Presets to quickly deposit and take out Hides
(------------------------------------------------------------------------------}
procedure BankHides;
Var
i, attempts: Integer;
bankScreenTimer: TTimeMarker;
begin
if not bankScreen.isOpen() then
if FindBanker then
begin
bankScreenTimer.start();
repeat
begin
Wait(randomRange(100, 250));
BotStatus := 'Waiting for Bank Screen to open';
Proggy;
if bankScreenTimer.getTime() > 20000 then
begin
ClearDebug();
BotStatus := 'ERROR: We ran out of time waiting for the Bank Screen to open';
Proggy;
WriteLn('ERROR: We ran out of time waiting for the Bank Screen to open');
TerminateScript();
end;
end;
until bankScreen.isOpen();
if bankScreen.isOpen() then
begin
bankScreenTimer.reset();
BotStatus := 'Bank Screen is open, taking out hides';
Proggy;
if players[i].integers[1] = 1 then
begin
case random(1, 2) of
1: bankScreen.clickButton(BANK_BUTTON_PRESET_1, true);
2: bankScreen.clickButton(BANK_BUTTON_PRESET_1, false);
end;
end
else
if players[i].integers[1] = 2 then
begin
case random(1, 2) of
1: bankScreen.clickButton(BANK_BUTTON_PRESET_2, true);
2: bankScreen.clickButton(BANK_BUTTON_PRESET_2, false);
end;
end
else
begin
ClearDebug();
BotStatus := 'ERROR: Something went wrong in the Bank Button Presets';
Proggy;
WriteLn('ERROR: Something went wrong in the Bank Button Presets');
TerminateScript();
end;
Wait(randomRange(1500, 2500));
if not tabbackpack.isItemInSlot(1) then
begin
ClearDebug();
BotStatus := 'ERROR: We''re either out of Leather or you didn''t setup your Bank Preset correctly';
Proggy;
WriteLn('ERROR: We''re either out of Leather or you didn''t setup your Bank Preset correctly');
TerminateScript();
end;
end
else
begin
ClearDebug();
BotStatus := 'ERROR: Could not Bank Hides';
Proggy;
WriteLn('ERROR: Could not Bank Hides');
TerminateScript();
end;
end;
end;
{------------------------------------------------------------------------------)
Procedure: DepositLast
Description: Depososits the last Tanned Leather then logs out
(------------------------------------------------------------------------------}
procedure DepositLast;
Var
i: Integer;
bankScreenTimer: TTimeMarker;
begin
if not bankScreen.isOpen() then
if FindBanker then
begin
bankScreenTimer.start();
repeat
begin
Wait(randomRange(100, 250));
BotStatus := 'Waiting for Bank Screen to open';
Proggy;
if bankScreenTimer.getTime() > 20000 then
begin
ClearDebug();
BotStatus := 'ERROR: We ran out of time waiting for the Bank Screen to open';
Proggy;
WriteLn('ERROR: We ran out of time waiting for the Bank Screen to open');
TerminateScript();
end;
end;
until bankScreen.isOpen();
if bankScreen.isOpen() then
begin
bankScreenTimer.reset();
BotStatus := 'Bank Screen is open, depositing and logging out';
Proggy;
Wait(randomRange(500, 750));
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
bankScreen.close();
players[currentPlayer].logout();
smartImage.clear();
smartEnableDrawing := false;
Proggy;
TerminateScript();
end;
end;
end;
{------------------------------------------------------------------------------)
Procedure: CountTannedLeather
Description: Counts Tanned Leather using DTM's
(------------------------------------------------------------------------------}
function CountTannedLeather(): boolean;
Var
i: Integer;
DTMArray: TIntegerArray;
begin
DTMArray := [HardLeatherDTM, GreenLeatherDTM, BlueLeatherDTM, RedLeatherDTM, BlackLeatherDTM, RoyalLeatherDTM];
for i := 0 to high(DTMArray) do
begin
if tabBackpack.countDTM(DTMArray[i]) > 1 then
begin
if scriptSMARTDebug then
smartImage.debugDTM(DTMArray[i], tabBackpack.getBounds, clLime);
if tabBackpack.countDTM(DTMArray[i]) < 28 then
begin
BotStatus := 'Found less than 28 Tanned Leather, depositing and logging out';
Proggy;
TotalTannedLeather := TotalTannedLeather + tabBackpack.countDTM(DTMArray[i]);
DepositLast;
end;
TotalTannedLeather := TotalTannedLeather + tabBackpack.countDTM(DTMArray[i]);
result := true
end;
end;
end;
{------------------------------------------------------------------------------)
Procedure: TanHides
Description: Tans Hides at Ellis
(------------------------------------------------------------------------------}
procedure TanHides;
Var
i: Integer;
productionScreenTimer: TTimeMarker;
CraftSymbol: TPoint;
begin
if not productionScreen.isOpen() then
if FindEllis then
begin
productionScreenTimer.start();
repeat
begin
Wait(randomRange(100, 250));
BotStatus := 'Waiting for Production Screen to show up';
Proggy;
if productionScreenTimer.getTime() > 25000 then
begin
ClearDebug();
BotStatus := 'ERROR: We ran out of time waiting for the Production Screen to open';
Proggy;
WriteLn('ERROR: We ran out of time waiting for the Production Screen to open');
TerminateScript();
end;
end;
until productionScreen.isOpen();
if productionScreen.isOpen then
begin
productionScreenTimer.reset();
BotStatus := 'Production Screen is Open, tanning hides';
Proggy;
case random(1, 2) of
1: productionScreen.clickStart(true);
2: productionScreen.clickStart(false);
end;
Wait(randomRange(500, 750));
end
else
begin
ClearDebug();
BotStatus := 'ERROR: Production Screen at Ellis failure';
Proggy;
WriteLn('ERROR: Production Screen at Ellis failure');
TerminateScript();
end;
end;
end;
{------------------------------------------------------------------------------)
Procedure: checkForImages
Description: Downloads the SPS map and/or paint picture if you don't have them.
Credits: Kevin
(------------------------------------------------------------------------------}
procedure checkForImages(path, link, item: string);
var
progFile: longInt;
picName: string;
begin
picName := AppPath + path;
try
if not fileExists(picName) then
begin
writeLn('NOTIFICATION: ' + item + ' does not exist - Downloading it now!.');
progFile := createFile(picName);
end else
exit;
closeFile(progFile);
progFile := rewriteFile(picName, false);
writeFileString(progFile, getPage(link));
writeLn('NOTIFICATION: ' + item + ' has been download to Simba folder!');
writeLn('');
finally
if (progFile > 0) then
closeFile(progFile);
end;
end;
{------------------------------------------------------------------------------)
Procedure: MainLoop
Description: The main loop of this script, don't touch it!
(------------------------------------------------------------------------------}
procedure MainLoop;
Var
i: Integer;
begin
BotStatus := 'Booting up';
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
Wait(randomRange(2000, 3000));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
exitTreasure();
closePollWindow();
end;
Proggy;
BankHides;
RunToEllis;
TanHides;
RunToBank;
if not CountTannedLeather then
begin
WriteLn('ERROR: Couldn''t count Tanned Leather');
TerminateScript();
end;
until (TotalTannedLeather >= players[i].integers[0]);
DepositLast;
end;
procedure LoadDTMs;
begin
HardLeatherDTM := DTMFromString('mlwAAAHicY2dgYOABYk4gFgVicSBmZYAAGSDmg7IZgVgKKs8LxToaskCSCYoZkdhMDFwMuAEjHgwFAIsvAVE=');
GreenLeatherDTM := DTMFromString('mrAAAAHic42BgYBAAYhEgZgViWQYIYANiKSDmBWJuIJYBYhYgZoeKSQKxGFQthxUXkGTCghnBtCQDfsBIAMMAAKrkAWQ=');
BlueLeatherDTM := DTMFromString('mlwAAAHicY2dgYOAEYiEGCBAAYiYgZgdiCSAWBGJmIGYDYhkgloSq4wVibl4fqGpMDFOHDTDiwVAAAIALAUA=');
RedLeatherDTM := DTMFromString('mlwAAAHicY2dgYOABYjEglmKAAFYglgFiPiDmh4qDxHiBWAKIhaDqbHk5gSQTGmYE05IMuAEjHgwFAI95AVY=');
BlackLeatherDTM := DTMFromString('mrAAAAHic42BgYOAFYiYgFgdiUQYIkAFiYSDmAWIuIGYHYkYglgBiIagYCEgCsbysLNQEZMwIZ7Mz4AeMBDAMAACkAwFT');
RoyalLeatherDTM := DTMFromString('mlwAAAHicY2dgYOBngAAZIBYHYk4gZgViQSDmBWI+IOYBYgkglgRiZqh6R5koIMmEFUsy4AaMeDAUAACpPQGn');
end;
procedure FreeTheDTMs;
begin
FreeDTM(HardLeatherDTM);
FreeDTM(GreenLeatherDTM);
FreeDTM(BlueLeatherDTM);
FreeDTM(RedLeatherDTM);
FreeDTM(BlackLeatherDTM);
FreeDTM(RoyalLeatherDTM);
FreeBitmap(scriptPaintBMP);
end;
begin
//Setup
ClearDebug();
initPlayerForm();
runPlayerForm();
if not playerForm.isScriptReady then
exit;
declarePlayers();
smartShowConsole := false;
DisableSRLDebug := true;
SetupSRL();
AddOnTerminate('FreeTheDTMs');
LoadDTMs;
CheckForImages('Includes/SPS/img/runescape_other/ALKHARID_TAN.png', 'http://i.imgur.com/m3Xx1nU.png', 'SPS map');
SPS.setup('ALKHARID_TAN', RUNESCAPE_OTHER, 4, 600.0, 0.40);
//Script Paint
if smartEnableDrawing then
begin
CheckForImages('\Scripts\RickHunley\scriptpaint.png', 'http://i.imgur.com/AtFd4qK.png', 'Script Paint');
scriptPaintBMP := loadBitmap(appPath + '\Scripts\RickHunley\scriptpaint.png');
FastReplaceColor(scriptPaintBmp, 0, 1);
FastReplaceColor(scriptPaintBmp, 2188575, 65280);
FastReplaceColor(scriptPaintBmp, 2066708, 65280);
FastReplaceColor(scriptPaintBmp, 327168, 65280);
FastReplaceColor(scriptPaintBmp, 130816, 65280);
SetTransparentcolor(scriptPaintBMP, 65280);
end;
while players.getActive > 0 do
mainLoop;
end.

