SRL Archive - Archive

Twinki - SRL Member Application


Twinki

2015-01-29 01:38:10

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


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
I know the very basics of Java, LUA, and I now I know probably the intermediates of Pascal


Are you a member of any other communities?
I'm also part of the RiD community


Tell us about yourself…
From: Twinki
I'm always bad at explaining myself, I don't really like typing up things about me :P So i'll just do my best, it'll probably be pretty bad, just warning you.

I'm 17 years old, I do nothing but sit on my ass all day on my computer. I have online school, I stopped going to physical highschool due to me being forced to waste 8 hours a day, 5 days a week of my life learning nothing, and being yelled at. I failed pretty much all my classes when I was physically going to highshcool, and I wasn't learning anything useful in life. I now cheat on pretty much all my classes in my online school, which is the only way I've been able to pass my classes. It's not because i'm dumb and don't understand it, I just don't like being forced to learn Algebra 2 for 2 hours on a daily basis, when instead I could be learning something I could use in life, or as a career.

I love playing with different dedicated server software, Virtual Machine software, and in general I'm fascinated by networking. I've actually ran a Minecraft Modded Server (Ha ha, that's so easy though) but in reality, it's very hard to have a stable server and keep 100 daily players happy. Modded MC servers are very rare, and aren't that popular due to server limits and the such. I did that for about 8 months, until I left the team I was on due to them making very stupid actions. Since I left, the MC server and Modpack has completely died, from 50-100 daily players, to literally nothing. Guess I was the one doing all the work…

After i'm done with Highschool I'm looking at going to College for Networking and maybe Computer Science. I'm not quite sure what the future holds for me, but I don't think it's going to be a positive.

I'm also fascinated by programming, something i'm not that great at. However it amazes me the software/scripts/programs programmers can come up with, to me it's just like magic. I don't think i'll ever get too deep into programming, as it gets to a point where it makes my brain turn into a slushy. Even doing my first script, I think about things way too much and I lose track of what does what, I like being organized, and sometimes that leads to faulty scripts. Once I start reaching something like 1000 lines of code, I lose track as I said above, and my brain turns to mush. I have to physically go back and read each line of code, to try and remember what I was doing and where this is supposed to go. Sometimes I get a headache doing it, and it sometimes ends up taking me 8 hours just to add in 20 lines of code to an existing 1000 line script. Which is why I don't want to pursue it as a career, but this is something I need to learn for networking, since I'm pretty sure scripting falls in line with it.

I started playing Runescape I believe in 2007 or 2008, it was on a 4Kb/s Dial Up connection. I played legit for 2 or 3 years. In 2009 I think, I started getting into botting. My first bot was RSBot, which I think was the original botting software. After awhile, I moved onto RiD and have been using RiD ever since. I pretty much quit Runescape in 2011, the game was getting boring and too grindy for me. In 2013 I got into Goldfarming, me and my partner ended up running a 30-50 farm together. I ran about 10 bots on my side, he was running 20-30, he ended up making 500-1000$ on a weekly basis, I only made about 100. After the farm kinda died due to bans, I moved onto a solo farm with only 15 bots, I ended up making about 300$ in a weeks time. I still legit here and there when I get bored. I also tend to quest for just the sake of questing. I recently started getting back into SRL/Villavu a lot more. After seeing such interesting projects like OGL and Clarity's Human Biometrics, it really kinda inspired me to try scripting again and see what I could come up with. I also wanted to give back, since I have been a leecher for a bit. Figured it was time to repay the debt :P




Please show us one (or multiple) of your scripts.
From: Twinki
This script was my first SRL-6 script. I spent most of the time on it on the Object Finding Function.
I learned how TPA's and ATPA's work from TheMayors tutorial.
I also learned about finding a specific object by using relative objects around it thanks to another tutorial in the
Intermediate RS3 tutorial section.


program TwinkiTanner;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}

{------------------------------------------------------------------------------)
I wanted to thank all those who've helped me accomplish this, and give credits
where due.

Clarity, for the private help and feedback! (Sorry for spamming your skype :P)

TheMayor, for the tutorials, would've never figured out TPA's if it wasn't for you
hoodz, for the examples and help with questions I had
Ross, for the Tanner example script, I based a lot of this after your script
BMWxi, for the private help and general feedback
Enig, for the GFX

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.65;
B_SAT := 0.89;
B_COLOR := 13624282;
B_TOL := 15;
B_FILTER := 15; //ATPA Filter
{--- Relative Object for Banker ---}
rB_HUE := 0.10;
rB_SAT := 0.36;
rB_COLOR := 5528700;
rB_TOL := 9;
rB_EXCLUDE := 150; //Exclude Distance

{--- Jack the Tanner ---}
J_HUE := 0.12;
J_SAT := 0.70;
J_COLOR := 2908960;
J_TOL := 10;
J_FILTER := 10; //ATPA Filter
{--- Relative Object for Jack ---}
rJ_HUE := 1.12;
rJ_SAT := 8.11;
rJ_COLOR := 15397620;
rJ_TOL := 2;
rJ_EXCLUDE := 150; //Exclude Distance

Var
HardLeatherDTM, GreenLeatherDTM, BlueLeatherDTM, RedLeatherDTM,
BlackLeatherDTM, RoyalLeatherDTM, DTMToLook, FoundDTMs, TotalTannedLeather, scriptPaintBMP: Integer;
BotStatus: String;
scriptSMARTDebug: boolean;

procedure initPlayerForm();
begin
with playerForm do
begin
name := 'TwinkiTanner';
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', 'TwinkiTanner SMART Debug'];
checkBoxDefaults := ['True', 'False'];
checkBoxHints := ['Do you want do draw some debug information on SMART?', 'Turns on TwinkiTanner 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: CheckFrozen
Description: Checks if the screen is frozen/is in a loading screen by using PixelShift
Credits: Twinki
(------------------------------------------------------------------------------}
function CheckFrozen(MarkerWaitTime: Integer = 5000): boolean;
Var
pS, i: Integer;
FrozenTimer: TTimeMarker;
begin
FrozenTimer.start();
result := true;
repeat
pS := getPixelShift(mainscreen.getBounds(), 500);
WriteLn(toStr(pS));
if Ps <= 100 then
begin
repeat
Wait(randomRange(250, 750));
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): boolean;
Var
attempts, X, Y, i: integer;
rTPA, TPA: TPointArray;
ATPA: T2DPointArray;
rPoint: TPoint;

begin
if not isLoggedIn() then
exit;
if scriptSMARTDebug then
smartImage.clear();

CheckFrozen(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;
if scriptSMARTDebug then
smartImage.debugTPA(rTPA, false);
rPoint := middleTPA(rTPA);
end;

findColorsSpiralTolerance(X, Y, TPA, Color, mainScreen.getBounds(), Tolerance, colorSetting(2, Hue, Sat));

if length(TPA) < 1 then
exit;
if FindRelativeObject then TPA.excludePointsDist(0, excludePointsDist, rPoint.x, rPoint.y);
ATPA := TPA.toATPA(30, 30);
if length(ATPA) < 1 then
exit;
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

case random(50) of
1..40: Mouse(ATPA[i].getBounds().getRandomPoint(), MOUSE_MOVE);
41..50: missMouse(ATPA[i].getBounds().getRandomPoint(), true);
end;

if isMouseOverText(mouseOverText, 150) then
begin
fastClick(clickType);
Wait(randomRange(250, 750));
if clickType = MOUSE_RIGHT then
begin
if chooseOption.optionsExist(chooseOptions) then
chooseOption.select(chooseOptions, 1000)
else
exit(false);
end;
exit(true);
end;
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: RunToJack
Description: Runs to Jack the Tanner
(------------------------------------------------------------------------------}
procedure RunToJack;
Var
PathToJack: TPointArray;
begin
if not isLoggedIn() then
exit;

BotStatus := 'Running to Jack the Tanner';
Proggy;
PathToJack := [Point(166, 162), Point(162, 210), Point(138, 268)] //Thanks giavanni6 for suggestion
if not SPS.walkPath(PathToJack) then
begin
ClearDebug();
BotStatus := 'ERROR: Hmph, we failed running to Jack.. our legs must be broken';
Proggy;
WriteLn('ERROR: Hmph, we failed running to Jack.. our legs must be broken');
TerminateScript();
end;
end;

{------------------------------------------------------------------------------)
Procedure: RunToBank
Description: Runs to Burthope Bank
(------------------------------------------------------------------------------}
procedure RunToBank;
Var
PathToBank: TPointArray;
begin
if not isLoggedIn() then
exit;

BotStatus := 'Running to the Burthorpe Banker';
Proggy;

PathToBank := [Point(144, 253), Point(150, 222), Point(153, 203), Point(156, 161), Point(148, 131)]
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 Gnome Banker in Burthope, returns True if found, uses FindTheTwinki
(------------------------------------------------------------------------------}
function FindBanker(): boolean;
Var
BankSymbol: TPoint;
gnomeBankerTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit();
if bankScreen.isOpen() then
exit(true);
BotStatus := 'Trying to find the Burthorpe Gnome Banker';
Proggy;

gnomeBankerTimer.start();
repeat
case random(1, 2) of
1: if FindTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, MOUSE_LEFT, ['anker','ank','ooth'], [''], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end
else if (minimap.findSymbol(BankSymbol, MM_SYMBOL_BANK, minimap.getBounds())) and (gnomeBankerTimer.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, MOUSE_LEFT, ['anker','ank','ooth'], [''], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end;
end;
2: if FindTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, MOUSE_RIGHT, ['anker','ank','ooth'], ['ank', 'ooth'], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end
else if (minimap.findSymbol(BankSymbol, MM_SYMBOL_BANK, minimap.getBounds())) and (gnomeBankerTimer.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, MOUSE_RIGHT, ['anker','ank','ooth'], ['ank', 'ooth'], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end;
end;
end;
until gnomeBankerTimer.getTime() >= 30000;

ClearDebug();
BotStatus := 'ERROR: Could not find the Gnome Banker';
Proggy;
WriteLn('ERROR: Could not find the Gnome Banker');
TerminateScript();
end;

{------------------------------------------------------------------------------)
Procedure: FindJack
Description: Finds Jack the Tanner using FindTheTwinki
(------------------------------------------------------------------------------}
function FindJack(): boolean;
Var
jackOvalTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit();
if productionScreen.isOpen() then
productionscreen.close();

BotStatus := 'Trying to find Jack the Tanner';
Proggy;
jackOvalTimer.start();
repeat
if FindTheTwinki(J_HUE, J_SAT, J_COLOR, J_TOL, J_FILTER, MOUSE_RIGHT, ['ack','val'], ['an', 'ide'], true, rJ_HUE, rJ_SAT, rJ_COLOR, rJ_TOL, rJ_EXCLUDE) then
begin
BotStatus := 'Found Jack';
Proggy;
exit(true);
end
else if jackOvalTimer.getTime() >= 10000 then
begin
BotStatus := 'Couldn''t find Jack, checking under Player';
Proggy;
Wait(randomRange(1500, 2500));
mouseBox(mainScreen.playerBox);
if (isMouseOverText(['ack','val'])) then
begin
fastClick(MOUSE_RIGHT);
Wait(randomRange(250, 750));
chooseOption.select(['an', 'ide'], 1000);
BotStatus := 'Found Jack';
Proggy;
exit(true);
end;
end;
until jackOvalTimer.getTime() >= 30000;
ClearDebug();
BotStatus := 'ERROR: Could not find Jack';
Proggy;
WriteLn('ERROR: Could not find Jack');
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;
end;
end;

if bankScreen.isOpen() then
begin
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;

{------------------------------------------------------------------------------)
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 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 Jack
(------------------------------------------------------------------------------}
procedure TanHides;
Var
i: Integer;
productionScreenTimer: TTimeMarker;
CraftSymbol: TPoint;
begin
if not productionScreen.isOpen() then
if FindJack 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;
end;
end;

if productionScreen.isOpen then
begin
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 Jack failure';
Proggy;
WriteLn('ERROR: Production Screen at Jack failure');
TerminateScript();
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';
Proggy;

repeat
Proggy;
if not isLoggedIn() then
begin
players[currentPlayer].login();
Wait(randomRange(2000, 3000));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
exitTreasure();
closePollWindow();
end;

BankHides;
RunToJack;
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);
end;

begin
//Setup
ClearDebug();
initPlayerForm();
runPlayerForm();
if not playerForm.isScriptReady then
exit;
declarePlayers();
smartShowConsole := false;
DisableSRLDebug := false;
SetupSRL();
AddOnTerminate('FreeTheDTMs');
LoadDTMs;
CheckForImages('Includes/SPS/img/runescape_other/BURTHORPE_TAN.png', 'http://i.imgur.com/ITtmmeI.png', 'SPS map'); //Thank you Ross for the SPS map :)
SPS.setup('BURTHORPE_TAN', RUNESCAPE_OTHER);
//Script Paint
if smartEnableDrawing then
begin
CheckForImages('\Scripts\TwinkiTanner\scriptpaint.png', 'http://i.imgur.com/AtFd4qK.png', 'Script Paint');
scriptPaintBMP := loadBitmap(appPath + '\Scripts\TwinkiTanner\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;
//Startup
if not isLoggedIn() then
players[currentPlayer].login();
BotStatus := '';
Wait(randomRange(2000, 3000));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
exitTreasure();
closePollWindow();

while players.getActive > 0 do
mainLoop;

end.

https://villavu.com/forum/showthread.php?t=111762

I first started scripting on RSPS's I wanted to exploit just for the fun of it, I made several scripts for different RSPS's,but I recently lost most of them due to a hard drive failure. However I was able to recover two scripts, which you can find below. I also did experiment with an include to make it a lot easier, I did rip a lot of what SRL consisted of, and changed it myself for the RSPS I made it for. I never planned on releasing it publicly, as I was only really doing it just to experiment and see what I could come up with
https://villavu.com/forum/showthread.php?t=111569

The Mayor

2015-01-29 05:26:32

Post your script in SIMBA tags so the others can see it easy :)

Twinki

2015-01-29 05:42:17

Updated OP, put the script that really mattered in SIMBA tags. If you wana see the old scripts I made just check the 2nd link

Daniel

2015-01-30 20:31:32

Yes :)

Twinki

2015-01-30 21:38:16

From: Daniel
Yes :)


:biggrin:

Is it true that the users who vote no are supposed to explain why? There was something about it in the SRL Members guide here: https://villavu.com/forum/showthread.php?t=74195
Was wondering, wasn't seeing very many replies here.

Kyle

2015-01-30 21:48:59

From: Twinki

Is it true that the users who vote no are supposed to explain why? There was something about it in the SRL Members guide here: https://villavu.com/forum/showthread.php?t=74195
Was wondering, wasn't seeing very many replies here.


Yes, they should, but sometimes, especially lately, tend not to post.. I voted yes btw

slacky

2015-01-30 22:18:50

From: Twinki
Is it true that the users who vote no are supposed to explain why? There was something about it in the SRL Members guide here: https://villavu.com/forum/showthread.php?t=74195
Was wondering, wasn't seeing very many replies here.

We are not obligated to tell you why.

Some of the reasons why I voted No:
Your indentation is all around the place, look through some of the more known work/scripts at the forums to learn how to properly indent your code. Or ask someone to teach you.
You don't show me that you really know what the heck you are doing / that you are able to write your own (decent) script without help or ctrl+c -> ctrl+v.
Most of your script is straight forward, the only function that strikes me as a bit more involved is "FindTheTwinki" but to write that one you needed some help ref: «Thank you TheMayor, hoodz, Ross, and BMWxi for the help». That you have just now learned to use/manipulate arrays shows us that you are still very fresh which also weighted in on my decision.

Don't let me discourage you tho! Keep learning, keep writing stuff, and keep exploring… If you won't get in this time you will have a much better chance once you've learned "some new tricks". Keep in mind that I only speak for my self, and I can be a bit hard to satisfy.

The Mayor

2015-01-30 22:27:53

You've been fairly active recently, so that's good ;). You've done well putting this together, but the major thing I see when looking at your script is that it's really messy. All but ~2 procedures have indentation issues making it pretty hard/annoying to read (it gets worse near the bottom). You're lucky pascal doesn't require correct indentation to compile, like other languages do :p

There is this massive block of code which is essentially the same thing repeated, with the only difference being MOUSE_LEFT -> MOUSE_RIGHT

repeat
case random(1, 2) of
1: if FindTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, MOUSE_LEFT, ['anker','ank','ooth'], [''], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end
else if (minimap.findSymbol(BankSymbol, MM_SYMBOL_BANK, minimap.getBounds())) and (gnomeBankerTimer.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, MOUSE_LEFT, ['anker','ank','ooth'], [''], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end;
end;
2: if FindTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, MOUSE_RIGHT , ['anker','ank','ooth'], ['ank', 'ooth'], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end
else if (minimap.findSymbol(BankSymbol, MM_SYMBOL_BANK, minimap.getBounds())) and (gnomeBankerTimer.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, MOUSE_RIGHT, ['anker','ank','ooth'], ['ank', 'ooth'], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end;
end;
end;
until gnomeBankerTimer.getTime() >= 30000;

As MOUSE_LEFT and MOUSE_RIGHT are integer constants (1 and 0), you could do just write random(2) like:

if findTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, random(2), ['anker','ank','ooth'], [''], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then

There is a lot of code that is over-complicated, and you could use SRL-6 more. For example, this procedure:


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;

Could be achieved with something like the following:


procedure depositLast();
begin
if bankScreen.open(BANK_TABLE_BURTHORPE) then
begin
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
bankScreen.close();
BotStatus := 'Depositing last load and logging out';
end else
BotStatus := 'Couldn''t deposit last load; bank never opened';

proggy();
players[currentPlayer].logout();
terminateScript();
end;

Good job for the rest though, we'll see how this plays out.

Twinki

2015-01-30 23:20:50

From: The Mayor
You've been fairly active recently, so that's good ;). You've done well putting this together, but the major thing I see when looking at your script is that it's really messy. All but ~2 procedures have indentation issues making it pretty hard/annoying to read (it gets worse near the bottom). You're lucky pascal doesn't require correct indentation to compile, like other languages do :p

There is this massive block of code which is essentially the same thing repeated, with the only difference being MOUSE_LEFT -> MOUSE_RIGHT

repeat
case random(1, 2) of
1: if FindTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, MOUSE_LEFT, ['anker','ank','ooth'], [''], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end
else if (minimap.findSymbol(BankSymbol, MM_SYMBOL_BANK, minimap.getBounds())) and (gnomeBankerTimer.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, MOUSE_LEFT, ['anker','ank','ooth'], [''], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end;
end;
2: if FindTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, MOUSE_RIGHT , ['anker','ank','ooth'], ['ank', 'ooth'], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end
else if (minimap.findSymbol(BankSymbol, MM_SYMBOL_BANK, minimap.getBounds())) and (gnomeBankerTimer.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, MOUSE_RIGHT, ['anker','ank','ooth'], ['ank', 'ooth'], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end;
end;
end;
until gnomeBankerTimer.getTime() >= 30000;

As MOUSE_LEFT and MOUSE_RIGHT are integer constants (1 and 0), you could do just write random(2) like:

if findTheTwinki(B_HUE, B_SAT, B_COLOR, B_TOL, B_FILTER, random(2), ['anker','ank','ooth'], [''], true, rB_HUE, rB_SAT, rB_COLOR, rB_TOL, rB_EXCLUDE) then

There is a lot of code that is over-complicated, and you could use SRL-6 more. For example, this procedure:


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;

Could be achieved with something like the following:


procedure depositLast();
begin
if bankScreen.open(BANK_TABLE_BURTHORPE) then
begin
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
bankScreen.close();
BotStatus := 'Depositing last load and logging out';
end else
BotStatus := 'Couldn''t deposit last load; bank never opened';

proggy();
players[currentPlayer].logout();
terminateScript();
end;

Good job for the rest though, we'll see how this plays out.


I went back through, tried to simplify what I could, and tried to correct all my indention errors. Hopefully this is the way it should be.
Also, the problem I have with indention is that I do what makes it easier for me to easily go back and figure out where I was and what it does. But, i'll try and force myself to learn the correct way to indent and the standards. The DepositLast procedure, I'd like to keep it like it is, I know I can compact it a lot more, but I like my failsafe I added in, it eases my mind when it comes to failsafes, I don't worry about it as much. Also, I wanted to try and show off my FindTheTwinki function instead of using bankScreen.open.

program TwinkiTanner;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}

{------------------------------------------------------------------------------)
I wanted to thank all those who've helped me accomplish this, and give credits
where due.

Clarity, for the private help and feedback! (Sorry for spamming your skype :P)

TheMayor, for the tutorials, would've never figured out TPA's if it wasn't for you
hoodz, for the examples and help with questions I had
Ross, for the Tanner example script, I based a lot of this after your script
BMWxi, for the private help and general feedback
Enig, for the GFX

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.65;
B_SAT := 0.89;
B_COLOR := 13624282;
B_TOL := 15;
B_FILTER := 15; //ATPA Filter
{--- Relative Object for Banker ---}
rB_HUE := 0.10;
rB_SAT := 0.36;
rB_COLOR := 5528700;
rB_TOL := 9;
rB_EXCLUDE := 150; //Exclude Distance

{--- Jack the Tanner ---}
J_HUE := 0.12;
J_SAT := 0.70;
J_COLOR := 2908960;
J_TOL := 10;
J_FILTER := 10; //ATPA Filter
{--- Relative Object for Jack ---}
rJ_HUE := 1.12;
rJ_SAT := 8.11;
rJ_COLOR := 15397620;
rJ_TOL := 2;
rJ_EXCLUDE := 150; //Exclude Distance

Var
HardLeatherDTM, GreenLeatherDTM, BlueLeatherDTM, RedLeatherDTM,
BlackLeatherDTM, RoyalLeatherDTM, DTMToLook, FoundDTMs, TotalTannedLeather, scriptPaintBMP: Integer;
BotStatus: String;
scriptSMARTDebug: boolean;

procedure initPlayerForm();
begin
with playerForm do
begin
name := 'TwinkiTanner';
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', 'TwinkiTanner SMART Debug'];
checkBoxDefaults := ['True', 'False'];
checkBoxHints := ['Do you want do draw some debug information on SMART?', 'Turns on TwinkiTanner 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: CheckFrozen
Description: Checks if the screen is frozen/is in a loading screen by using PixelShift
Credits: Twinki
(------------------------------------------------------------------------------}
function CheckFrozen(MarkerWaitTime: Integer = 5000): boolean;
Var
pS, i: Integer;
FrozenTimer: TTimeMarker;
begin
FrozenTimer.start();
result := true;
repeat
pS := getPixelShift(mainscreen.getBounds(), 500);
//WriteLn(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): boolean;
Var
attempts, X, Y, i: integer;
rTPA, TPA: TPointArray;
ATPA: T2DPointArray;
rPoint: TPoint;

begin
if not isLoggedIn() then
exit;
if scriptSMARTDebug then
smartImage.clear();

CheckFrozen(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;
if scriptSMARTDebug then
smartImage.debugTPA(rTPA, false);
rPoint := middleTPA(rTPA);
end;

findColorsSpiralTolerance(X, Y, TPA, Color, mainScreen.getBounds(), Tolerance, colorSetting(2, Hue, Sat));
if length(TPA) < 1 then
exit;
if FindRelativeObject then
TPA.excludePointsDist(0, excludePointsDist, rPoint.x, rPoint.y);
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
case random(50) of
1..40: Mouse(ATPA[i].getBounds().getRandomPoint(), MOUSE_MOVE);
41..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
chooseOption.select(chooseOptions, 1000)
else
exit(false);
end;
exit(true);
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: RunToJack
Description: Runs to Jack the Tanner
(------------------------------------------------------------------------------}
procedure RunToJack;
Var
PathToJack: TPointArray;
begin
if not isLoggedIn() then
exit;
BotStatus := 'Running to Jack the Tanner';
Proggy;
PathToJack := [Point(166, 162), Point(162, 210), Point(138, 268)] //Thanks giavanni6 for suggestion
if not SPS.walkPath(PathToJack) then
begin
ClearDebug();
BotStatus := 'ERROR: Hmph, we failed running to Jack.. our legs must be broken';
Proggy;
WriteLn('ERROR: Hmph, we failed running to Jack.. our legs must be broken');
TerminateScript();
end;
end;

{------------------------------------------------------------------------------)
Procedure: RunToBank
Description: Runs to Burthope Bank
(------------------------------------------------------------------------------}
procedure RunToBank;
Var
PathToBank: TPointArray;
begin
if not isLoggedIn() then
exit;
BotStatus := 'Running to the Burthorpe Banker';
Proggy;
PathToBank := [Point(144, 253), Point(150, 222), Point(153, 203), Point(156, 161), Point(148, 131)]
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 Gnome Banker in Burthope, returns True if found, uses FindTheTwinki
(------------------------------------------------------------------------------}
function FindBanker(): boolean;
Var
BankSymbol: TPoint;
gnomeBankerTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit();
if bankScreen.isOpen() then
exit(true);
BotStatus := 'Trying to find the Burthorpe Gnome Banker';
Proggy;
gnomeBankerTimer.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) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end
else if (minimap.findSymbol(BankSymbol, MM_SYMBOL_BANK, minimap.getBounds())) and (gnomeBankerTimer.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) then
begin
BotStatus := 'Found Banker';
Proggy;
exit(true);
end;
end;
until gnomeBankerTimer.getTime() >= 30000;

ClearDebug();
BotStatus := 'ERROR: Could not find the Gnome Banker';
Proggy;
WriteLn('ERROR: Could not find the Gnome Banker');
TerminateScript();
end;

{------------------------------------------------------------------------------)
Procedure: FindJack
Description: Finds Jack the Tanner using FindTheTwinki
(------------------------------------------------------------------------------}
function FindJack(): boolean;
Var
jackOvalTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit();
if productionScreen.isOpen() then
productionscreen.close();

BotStatus := 'Trying to find Jack the Tanner';
Proggy;
jackOvalTimer.start();
repeat
if FindTheTwinki(J_HUE, J_SAT, J_COLOR, J_TOL, J_FILTER, MOUSE_RIGHT, ['ack','val'], ['an', 'ide'], true, rJ_HUE, rJ_SAT, rJ_COLOR, rJ_TOL, rJ_EXCLUDE) then
begin
BotStatus := 'Found Jack';
Proggy;
exit(true);
end
else if jackOvalTimer.getTime() >= 10000 then
begin
BotStatus := 'Couldn''t find Jack, checking under Player';
Proggy;
Wait(randomRange(1500, 2500));
mouseBox(mainScreen.playerBox);
if (isMouseOverText(['ack','val'])) then
begin
fastClick(MOUSE_RIGHT);
Wait(randomRange(250, 750));
chooseOption.select(['an', 'ide'], 1000);
BotStatus := 'Found Jack';
Proggy;
exit(true);
end;
end;
until jackOvalTimer.getTime() >= 30000;
ClearDebug();
BotStatus := 'ERROR: Could not find Jack';
Proggy;
WriteLn('ERROR: Could not find Jack');
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;

{------------------------------------------------------------------------------)
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 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 Jack
(------------------------------------------------------------------------------}
procedure TanHides;
Var
i: Integer;
productionScreenTimer: TTimeMarker;
CraftSymbol: TPoint;
begin
if not productionScreen.isOpen() then
if FindJack 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 Jack failure';
Proggy;
WriteLn('ERROR: Production Screen at Jack 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;
RunToJack;
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);
end;

begin
//Setup
ClearDebug();
initPlayerForm();
runPlayerForm();
if not playerForm.isScriptReady then
exit;
declarePlayers();
smartShowConsole := false;
DisableSRLDebug := false;
SetupSRL();
AddOnTerminate('FreeTheDTMs');
LoadDTMs;
CheckForImages('Includes/SPS/img/runescape_other/BURTHORPE_TAN.png', 'http://i.imgur.com/ITtmmeI.png', 'SPS map'); //Thank you Ross for the SPS map :)
SPS.setup('BURTHORPE_TAN', RUNESCAPE_OTHER);
//Script Paint
if smartEnableDrawing then
begin
CheckForImages('\Scripts\TwinkiTanner\scriptpaint.png', 'http://i.imgur.com/AtFd4qK.png', 'Script Paint');
scriptPaintBMP := loadBitmap(appPath + '\Scripts\TwinkiTanner\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.

From: slacky
We are not obligated to tell you why.

Some of the reasons why I voted No:
Your indentation is all around the place, look through some of the more known work/scripts at the forums to learn how to properly indent your code. Or ask someone to teach you.
You don't show me that you really know what the heck you are doing / that you are able to write your own (decent) script without help or ctrl+c -> ctrl+v.
Most of your script is straight forward, the only function that strikes me as a bit more involved is "FindTheTwinki" but to write that one you needed some help ref: «Thank you TheMayor, hoodz, Ross, and BMWxi for the help». That you have just now learned to use/manipulate arrays shows us that you are still very fresh which also weighted in on my decision.

Don't let me discourage you tho! Keep learning, keep writing stuff, and keep exploring… If you won't get in this time you will have a much better chance once you've learned "some new tricks". Keep in mind that I only speak for my self, and I can be a bit hard to satisfy.

The constructive criticism is needed, can motivate me to keep going. I know a lot of it looks like it's copied and pasted, and I want to keep improving onto my FindTheTwinki function. I do understand what it does, I didn't just copy and paste then leave it at that, I can describe line by line what it's doing and what for. It may take me a bit of time to go back and understand exactly what it does, hence the reason why I put that note //NOTE: *Will go to the next index if the current TPA length (in the ATPA) is less than 10 I have a problem when I have to go back and re-read stuff line by line, when I already have stuff on my mind I want to finish and put in place, it just kinda stresses me out. I sometimes have to take a break for 10 minutes or so, then come back. If you'd like, I can go ahead and start adding comments line by line in my FindTheTwinki function to prove I know what it does :P

Lipcot

2015-01-31 00:33:07

i dont think you have the practice! just do some more scripts and learn from the corrections they made you here! its great, i made a grate step forward when i entered a comp and the mayor corrected my whole script.. learnt lots of stuff!

learn –> re apply next month!

slacky

2015-01-31 00:36:10

From: Twinki
The constructive criticism is needed, can motivate me to keep going. I know a lot of it looks like it's copied and pasted, and I want to keep improving onto my FindTheTwinki function. I do understand what it does, I didn't just copy and paste then leave it at that, I can describe line by line what it's doing and what for. It may take me a bit of time to go back and understand exactly what it does, hence the reason why I put that note //NOTE: *Will go to the next index if the current TPA length (in the ATPA) is less than 10 I have a problem when I have to go back and re-read stuff line by line, when I already have stuff on my mind I want to finish and put in place, it just kinda stresses me out. I sometimes have to take a break for 10 minutes or so, then come back. If you'd like, I can go ahead and start adding comments line by line in my FindTheTwinki function to prove I know what it does :P

I am not saying you don't understand what it does. But that doesn't necessary mean you (alone) can create similar stuff (without guessing, and a bunch of try n' fail).

Anyway, I wanna raise a few questions:
  1. Why would you for example choose to use `FindColorsSpiralTolerance` over `FindColorsTolerance` when the order is clearly irrelevant as you don't rely the current order in any way.
  2. You also spiral from 0,0 as `X` and `Y` is not initialized, why would you need to do that?
  3. Why did you choose to use TPA.ToATPA (TPAToATPA) instead of PartitionTPA, or SplitTPA/ClusterTPA? I am specially wondering since clustering is (usually) the better way to go for your usage.
See this image for the difference: http://i.imgur.com/SzpKXJd.png

You don't have to answer my questions, I am just stating 'em so that you have something to think about.

The Mayor

2015-01-31 00:49:39

From: Lipcot

learn –> re apply next month!


Lol that's a bit early. He might still get in!

Twinki

2015-01-31 01:51:23

From: slacky
I am not saying you don't understand what it does. But that doesn't necessary mean you (alone) can create similar stuff (without guessing, and a bunch of try n' fail).

Anyway, I wanna raise a few questions:
  1. Why would you for example choose to use `FindColorsSpiralTolerance` over `FindColorsTolerance` when the order is clearly irrelevant as you don't rely the current order in any way.
  2. You also spiral from 0,0 as `X` and `Y` is not initialized, why would you need to do that?
  3. Why did you choose to use TPA.ToATPA (TPAToATPA) instead of PartitionTPA, or SplitTPA/ClusterTPA? I am specially wondering since clustering is (usually) the better way to go for your usage.
See this image for the difference: http://i.imgur.com/SzpKXJd.png

You don't have to answer my questions, I am just stating 'em so that you have something to think about.


I learn from examples, and I always tend to ask for help if I don't understand something. However once I start understanding whats infront of me, I can go on to something different a develop it with little to no help.
I had tested out ClusterTPA, and it didn't seem to do what I needed for the script I was making, I was going to add a cluster option for my function. I didn't see any different between FindColorsSpiralTolerance and FindColorsTolerance when I read the documentation on it, other than where it starts searching. FindColorsSpiralTolerance seems more practical to use in most cases, and I'm trying to develop FindTheTwinki into something other people can use if they want, and something I can use in other scripts with ease.

Even if this does pass, I'm going to try and find a script idea and start another script, this time with the correct indention and fixed errors I ran into with this script. Tonight i'm going to try and imrpove FindTheTwinki, and try out Clustering again and look at the differences.

This whole thread is feedback I really needed, so even if this does fail it's kind of a win for me, i'm getting all this feedback I really wanted and needed.

rj

2015-01-31 14:35:08

i voted yes

Daniel

2015-02-19 07:41:17

Hey @Twinki;

It looks like you won't be getting in this time. :( However, heed the advice SRL members presented to you here and when you next apply, you'll definitely get in!

You may apply again in two weeks, or any later date whenever you feel you are ready :)