SRL Archive - Archive

J_R - SRL Member Application


J_R

2015-05-31 13:11:34

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


Are you affilated in anyway with Jagex LTD?
no

Were you Referred to SRL?



What is your general programming knowledge?
average-high. Very familiar with python, java, JS, C(++), MATLAB. Somewhat familiar with many others, can probably learn the rest given a day or two to get familiar with any given language, they're all the same anyway (at least the useful/usable ones)


Are you a member of any other communities?
not actively in any other RS communities although I do check their sites from time to time


Tell us about yourself…
From: J_R
Graduate from UC Berkeley with EECS major and Math minor. Enjoys playing tennis, chess, ping pong, league of legends, and cricket. Grew up on east coast, only picked up programming in college. Enjoys theoretical debates occasionally at cost of practicality. Used to avidly play RS in middle school big into f2p pvp, quit when eoc first came out, started again; majority botting like a year ago when I found villavu



Please show us one (or multiple) of your scripts.
The one I'm the most proud of (it still has a few bugs but is very stable and I ran it for 10 hours at 230k~ xp/hr last night) as well as the first script I tried to write initially,
JRElfLarceny:

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

var
startxp, strikemaximizer, elfColor, failtofindlimit, meilyrcolor, strikes, currentxp, mainLoopIterations, currentClan, AMLODD, HEFIN, MEILYR, CRYWS, CADARN, repeats, oldxp, bankCircleColor: integer;
scriptTimer, bankTimer, failtofindtimer: TTimeMarker;
//some of these aren't used but might be useful later
ithellbankpt, ithellamloddmid, amloddpt, amloddhefinpt1, amloddhefinpt2, hefinpt, hefinmeilyrpt, meilyrpt, crywspt, crywscadarnpt, cadarnpt, lodeithellbankpt: TPoint;
pointsList: array of TPoint;
xpcheckflag, debugOn: boolean;
stringArr: array of string;

procedure DeclarePlayers;
begin
Players.Setup(['user'], 'default');
SetLength(Players, 1);
with players[0] do
begin
IsActive := True;
World := 2;
end;
CurrentPlayer := 0;
end;

procedure setupMyVariables()
begin
//clan constants
AMLODD := 0;
HEFIN := 1;
MEILYR := 2;
CRYWS := 3;
CADARN := 4;
//SET YOUR START CLAN HERE!!!!!!!
currentClan := MEILYR;
////////////////////////////////////
//setting up blindwalk coords
pointsList := [Point(398, 603), Point(337, 556), Point(337, 479), Point(369, 427), Point(428, 336), Point(496, 368), Point(585, 375), Point(676, 373), Point(756, 419), Point(790, 517), Point(865, 559), Point(522, 521)];
ithellbankpt := pointsList[0];
ithellamloddmid := pointsList[1];
amloddpt := pointsList[2];
amloddhefinpt1 := pointsList[3];
amloddhefinpt2 := pointsList[4];
hefinpt := pointsList[5];
hefinmeilyrpt := pointsList[6];
meilyrpt := pointsList[7];
crywspt := pointsList[8];
crywscadarnpt := pointsList[9];
cadarnpt := pointsList[10];
lodeithellbankpt := pointsList[11];
//setting up other script constants
startxp := chatbox.getXPBar;
write('startxp is ');
elfcolor := 2982177;
meilyrcolor := 4352551;
bankcirclecolor := 363242;
strikemaximizer := 3;
failtofindlimit := 25;
writeln(startxp);
currentxp := chatbox.getXPBar;
scriptTimer.start;
oldxp := 0;
debugOn = false;
xpcheckflag := false;
mainLoopIterations := 0;
end

function doBanking(): boolean;
begin
if not isLoggedIn then
exit;
writeLn('banking time!');
if (bankScreen.isOpen()) then
begin
writeLn('depositing all');
bankScreen.quickDeposit(0);
wait(700 + Random(200));
bankScreen.close();
wait(random(900, 1200));
exit(true);
end
exit(false);
end

procedure openBank();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn then
exit;
if bankscreen.isopen() then
exit;
bankTimer.start();
mainScreen.setAngle(MS_ANGLE_HIGH);
writeln('banking time!');
repeat
if bankscreen.isopen() then
exit;
if findColorsSpiralTolerance(x, y, TPA, bankCircleColor, mainScreen.getBounds, 20, colorSetting(2, 0.05, 0.52)) then
begin
ATPA := TPA.toATPA(10, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['se Ban']) then
begin
fastClick(MOUSE_LEFT);
wait(2500 + Random(1000));
if (bankscreen.isopen()) then
exit;
end
end
end
else
begin
writeLn('did not find a bank box, waiting and trying again');
write('bank timer is ');
writeLn(bankTimer.getTime());
wait(2000 + Random(500));
Exit;
end;
until (bankScreen.isOpen() or bankTimer.getTime() > 30 * 1000);
end

function ClickObject(color: integer; mouseOverText: array of string; waitLow: integer = 0; waitHigh: integer = 10; pt: TPoint = mainScreen.playerPoint): Boolean
var
x, y, i: integer;
Coords: TBox;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn then
exit;
if bankscreen.isOpen() then
bankscreen.close();
Coords := mainScreen.getBounds();
Coords.x1 := Coords.x1 + 200;
Coords.y1 := Coords.y1 + 100;
if findColorsSpiralTolerance(x, y, TPA, color, Coords, 20, colorSetting(2, 0.05, 0.52)) then
begin
ATPA := TPA.toATPA(10, 10);
ATPA.sortFromMidPoint(pt);
for i := 0 to high(ATPA) do
begin
if (high(ATPA[i]) > 50) then
continue;
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(mouseOverText) then
begin
FastClick(Mouse_Left);
wait(randomRange(1500 + waitLow, 2000 + waitHigh));
Exit(True);
end
if i > 5 then
exit(false);
end
Exit(True);
end
else
begin
Exit(False)
end
end

procedure progressReport();
begin
if not isLoggedIn then
exit;
if startxp = 0 then
begin
startxp := chatbox.getXPBar;
exit;
end
currentxp := chatbox.getXPBar;
if currentxp = 0 then
begin
xpcheckflag := true;
exit;
end
write('current xp is ');
writeln(currentxp);
writeLn('--------------------------------');
write(currentxp - startxp);
writeln(' XP gained');
write((currentxp - startxp) / (scriptTimer.getTime) * 1000 * 3600);
writeln(' XP / HR');
write('running for ');
write(scriptTimer.getTime / 1000 / 60);
writeln(' minutes');
writeln('---------------------------------');
//if not failsafecheck() then terminatescript;
end

function BoxFinder(mouseOverText: array of string; x: integer; y: integer; diff: integer; waitLow: integer = 0; waitHigh: integer = 10): boolean;
begin
if not isLoggedIn then
exit;
if bankscreen.isOpen() then
bankscreen.close();
if (xpcheckflag) then
begin
progressReport();
xpcheckflag := false;
end
if isMouseOverText(mouseOverText) then
begin
fastClick(mouse_left);
wait(randomRange(waitLow, waitHigh));
exit(true);
end
if mainscreen.isPlayerAnimating then
begin
wait(randomRange(1000, 1500));
result := BoxFinder(mouseOverText, x, y, waitLow, waitHigh);
exit
end
mouse(x + random(diff), y + random(diff), mouse_move);
if isMouseOverText(mouseOverText) then
begin
fastClick(mouse_left);
wait(randomRange(waitLow, waitHigh));
exit(true);
end
else
exit(false);
end
//simply blindwalks to a point, have not had infinite loop issues because blindwalk never does that for me
procedure blindWalk(p: TPoint);
var
r: boolean;
currpt: TPoint;
begin
if (bankScreen.isOpen()) then
bankScreen.close();
repeat
Wait(575 + Random(50));
r := SPS.blindwalk(p);
until (r);
writeln('blind walk successful');
end
//update current clan to next one
procedure nextClan();
begin
currentClan := (currentClan + 1) mod 5;
end
//targets an elf once we're in a clan
//checkoptions is for right clicking and
//counting the options, but I don't use this functionality yet
// (maybe eventually for checking if the workers are un-pickpocketable)
function TargetElf(checkoptions: boolean = false): Boolean
var
nextxp, temp1, x, y, i, j, color: integer;
Coords: TBox;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
writeln('in targetelf');
if (bankScreen.isOpen()) then
bankScreen.close();
color := elfcolor;
if (failToFindTimer.getTime() > failtofindlimit * 1000) then
begin
WriteLn('failed to find a suitable elf in the area, this is probably because the entire clan has been alerted');
strikes := strikemaximizer;
Exit(False);
end
//dont look if we're struck out
if (strikes >= strikemaximizer) then
begin
Exit(true);
end;
Coords := mainScreen.getBounds();
Coords.x1 := Coords.x1 + 200;
Coords.y1 := Coords.y1 + 100;
if (debugOn) then
begin
Write('we found this as the start pickpocketing xp: ');
WriteLn(currentXp);
end
//no elves => we're struck out
if (failToFindTimer.getTime() > failtofindlimit * 1000) then
begin
WriteLn('failed to find a suitable elf in the area, this is probably because the entire clan has been alerted');
strikes := strikemaximizer;
Exit(False);
end
//to help with meiyr clan, it's still pretty buggy there
if currentClan = MEILYR then
color := meilyrcolor;
if findColorsSpiralTolerance(x, y, TPA, color, Coords, 20, colorSetting(2, 0.05, 0.52)) then
begin
if (debugOn) then
begin
writeLn('found elf!!');
end
ATPA := TPA.toATPA(10, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
if (strikes > 0) then
invertATPA(ATPA);
for i := 0 to high(ATPA) do
begin
//poorly tuned atm, but goal is to use the fact elves are smaller than the other greenish stuff to fliter well
if (high(ATPA[i]) > 50) then
continue;
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
//checkoptions stuff, doesn't work yet but isnt used
if (checkoptions) then
begin
fastClick(Mouse_Right);
wait(random(100) + 50);
if (chooseOption.isOpen()) then
begin
j = high(chooseOption.getOptions());
if j = 2 then
result := true
//else
//result := false;
end
//dont endlessly rightclick elves
if i > 3 then
exit(false);
end
else
begin
if isMouseOverText(['pocket']) then
begin
FastClick(Mouse_Left);
wait(3500 + Random(1000));
nextXp := chatbox.getxpbar;
if (nextXp > currentXp) then
begin
if (debugOn) then
begin
Write('we found this in the chatbox xp: ');
WriteLn(nextXp);
WriteLn('Successfully started pickpocketing');
end;
currentXp := nextXp;
writeln('found an elf');
Exit(True);
end
end
end
end
Exit(false);
end
else
begin
Exit(False)
end
end
//finds the bank on screen by looking for icon and then does the banking
function bank(): Boolean
var
pts: array of TPoint;
begin
writeln('in bank');
if bankscreen.isopen() then
begin
exit(dobanking());
end
if (tabBackpack.isempty) then
exit(false);
if (minimap.findSymbols(pts, MM_SYMBOL_BANK, minimap.getBounds())) then
begin
if currentClan = MEILYR then
begin
sortTPAByY(pts, false);
end
if currentClan = CRYWS then
begin
sortTPAByY(pts, true);
end
mouse(pts[high(pts)], MOUSE_LEFT, MOUSE_HUMAN);
minimap.waitPlayerMoving();
openbank();
exit(dobanking());
end
else
//gotta walk to the bank
begin
case currentClan of
CRYWS:
begin
blindWalk(crywspt);
openbank();
result := dobanking();
exit;
end;
CADARN:
begin
blindWalk(crywscadarnpt);
blindWalk(crywspt);
openbank();
result := dobanking();
blindWalk(crywscadarnpt);
blindWalk(cadarnpt);
end;
AMLODD:
begin
blindwalk(ithellamloddmid);
blindwalk(ithellbankpt);
openbank();
result := dobanking();
blindwalk(ithellamloddmid);
blindwalk(amloddpt);
exit;
end;
else //just try again, it failed for some reason when it wasn't supposed to
exit;
end;
end
end
//waits while pickpocketing
//banks and re-engages pickpocketing when invent full
//exits if we are pickpocketing abnormally long
function waitWhilePickPocketing(): Boolean
var
nextxp: integer;
breakOut, foundelf: Boolean;
abnormallyLongPickPocketTimer: TTimeMarker;
begin
if not isloggedin then
exit;
if bankscreen.isopen() then
bankscreen.close();
writeln('in waitwhilepickpocketing');
breakOut := false;
abnormallylongpickpockettimer.reset();
abnormallylongpickpockettimer.start();
currentXp := chatbox.getXPBar();
wait(3700 + Random(1000));
nextXp := chatbox.getxpBar();
repeat
wait(3700 + Random(1000));
nextXp := chatbox.getxpbar;
if tabBackpack.isFull() then
begin
abnormallylongpickpockettimer.pause();
bank();
//banking will be detected as a stop pickpocketing event, so since this isn't a real strike
strikes := strikes - 1;
exit;
abnormallylongpickpockettimer.start();
end
if (debugOn) then
begin
Write('checkxp for this loop was: ');
WriteLn(nextXp);
end
//end the waiting, we got caught
if (nextXp = currentXp) then
begin
WriteLn('OH NO WE GOT CAUGHT');
breakOut := True;
end
//continue since gained xp
if (nextXp > currentXp) then
begin
currentXp := nextXp;
end
//something went wrong, fix currentxp and next will be updated by the next run through
if (nextXp < currentXp) then
begin
currentXp := chatbox.getxpbar
end
//this means we've been pickpocketing way too long which means something is wrong
if (abnormallylongpickpockettimer.gettime > 6.2 * 60 * 1000) then
break;
until (breakOut);
abnormallylongpickpockettimer.reset();
Exit(breakOut);
end
//self explanatory, notice it walks TO the current clan and banks there
procedure walkToNextClanAndBank();
begin
writeln('in walktonextclanandbank');
if not isloggedin then
exit;
if bankscreen.isopen() then
bankscreen.close();
case currentClan of
//tele to lode, walk to ithell bank, bank, go to amlodd
AMLODD:
begin
lodeStoneScreen.teleportTo(LOCATION_PREVIOUS);
wait(randomRange(10000, 11000));
blindWalk(ithellbankpt);
bank();
blindWalk(amloddpt);
exit;
end;
HEFIN:
begin
blindWalk(hefinpt);
bank();
end;
MEILYR:
begin
blindWalk(meilyrpt);
bank();
end;
CRYWS:
begin
bank();
blindWalk(crywspt);
end;
CADARN:
begin
bank();
blindWalk(cadarnpt);
end;
else
exit;
end
end
//main loop
procedure mainLoop();
var
x, y, banktries: integer;
pt: Tpoint;
foundelf, moveon: boolean;
lastfindertimer: ttimemarker;
begin
if not isLoggedIn then
exit;
if bankscreen.isopen() then
doBanking();
oldxp := currentxp;
moveOn := false;
strikes := 0;
repeat
failtofindtimer.reset();
failtofindtimer.start();
repeat
foundelf := TargetElf();
if (failtofindtimer.gettime > failtofindlimit * 1000) then
begin
strikes := strikemaximizer;
break;
end
until (foundelf);
//dont want to wait around if we havent found an elf
if foundelf then
begin
waitwhilepickpocketing();
end
strikes := strikes + 1;
writeln('we have ', strikes, ' strikes.');
until (strikes >= strikemaximizer);
nextClan();
walkToNextClanAndBank();
progressReport();
mainLoopIterations := mainLoopIterations + 1;
end
//10 iterations without exp gain is indication something grave is wrong
function failSafeCheck(): boolean;
begin
if not isLoggedIn then
exit(true);
if mainLoopIterations < 10 then
exit(true);
if oldxp = currentxp then
repeats := repeats + 1
else
repeats := 0;
if repeats > 10 then
begin
writeLn('gained no xp for at least 10 iterations, something is wrong)');
exit(false)
end
else
exit(true);
end
//check thieving
procedure antiban();
begin
if not isLoggedIn then
exit;
if not gameTabs.isTabActive(TAB_BACKPACK) then
exit;
if random(100) > 87 then
hoverSkill(SKILL_THIEVING);
end

begin
clearDebug();
DeclarePlayers;
setupSRL();
DisableSRLDebug := true;
smartEnableDrawing := true;
setupMyVariables();
SPS.setup('Prif', RUNESCAPE_OTHER);
repeat
if not IsLoggedIn then
begin
if not Players[0].Login then
TerminateScript;
MainScreen.SetAngle(MS_ANGLE_HIGH);
end;
mainLoop();
progressReport();
antiban();
if not failSafeCheck then
TerminateScript;
until (False);
Exit;
end.

My 2 released scripts,
JRElfAgility:

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

var
startxp, blueColor, currentxp, mainLoopIterations, repeats, oldxp, redCarpetColor, cathedralPipeLight, roofTileBoundary, bankCircleColor: integer;
scriptTimer, bankTimer: TTimeMarker;
xpcheckflag : boolean;
bottomOfScreenPt : Tpoint; //used to focus the ATPA to sort from a point at the bottom of the screen (suggested by Clarity)
stringArr: array of string;

procedure setupMyVariables()
begin
redCarpetColor := 922725;
bankCircleColor := 561649;
stringArr := ['eap', 'cale', 'rave', 'ault', 'lid', 'erge']; //all possible actions on the course
startxp := chatbox.getXPBar; //start script logged in with xp visible so this works
write('startxp is ');
writeln(startxp);
scriptTimer.start;
oldxp := 0;
xpcheckflag := false;
bottomOfScreenPt.x := 245;
bottomOfScreenPt.y := 320;
mainLoopIterations := 0;
end

procedure DeclarePlayers;
begin
Players.Setup(['name'], 'default');
SetLength(Players, 1);
with players[0] do
begin
IsActive := True;
World := 2; //change to your world
end;
CurrentPlayer := 0;
end;
//prints my progress report, has xp gained, xp/hr, and runtime in minutes
procedure progressReport();
begin
if not isLoggedIn then
exit;
if startxp = 0 then //in order to correctly do xp/hr calculations if start xp got messed up because you weren't logged in
begin
startxp := chatbox.getXPBar;
exit;
end
currentxp := chatbox.getXPBar;
if currentxp = 0 then //this means we can't find the xp, try again later
begin
xpcheckflag := true; //let the rest of the script know to make a proggie on the next obstacle
exit;
end
write('current xp is ');
writeln(currentxp);
writeLn('--------------------------------');
write(currentxp - startxp);
writeln(' XP gained');
write((currentxp - startxp) / (scriptTimer.getTime) * 1000 * 3600);
writeln(' XP / HR');
write('running for ');
write(scriptTimer.getTime / 1000 / 60);
writeln(' minutes');
writeln('---------------------------------');
end
//finds and clicks an object of a certain color if it has the desired mouse over text
//also waits for a random amount of time after clicking if the arguments are provided
function ClickObject(color: integer; mouseOverText: array of string; waitLow: integer = 0; waitHigh: integer = 10; pt : TPoint = mainScreen.playerPoint): Boolean
var
x, y, i: integer;
Coords: TBox;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn then
exit;
Coords := mainScreen.getBounds();
Coords.x1 := Coords.x1 + 200;
Coords.y1 := Coords.y1 + 100;
if findColorsSpiralTolerance(x, y, TPA, color, Coords, 20, colorSetting(2, 0.05, 0.52)) then
begin
ATPA := TPA.toATPA(10, 10);
ATPA.sortFromMidPoint(pt); //sorts ATPA from closest to this pt
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(mouseOverText) then
begin
FastClick(Mouse_Left);
wait(randomRange(1500 + waitLow, 2000 + waitHigh));
Exit(True);
end
if i > 5 then
exit(false);
end
Exit(True);
end
else
begin
Exit(False)
end
end
//this clicks inside a square given with bottom left corner x,y and side length diff
//it will click and return true if it finds the desired mouseover text in the box on the screen
//lastly, if it finds the object the waitLow and waitHigh arguments are the boundaries of the random range you want to wait for after you click
function BoxFinder(mouseOverText: array of string; x: integer; y: integer; diff: integer; waitLow: integer = 0; waitHigh: integer = 10): boolean;
begin
if not isLoggedIn then
exit;
if(xpcheckflag) then //this means that we need to make a progress report since we got a reward on the last lap
begin
progressReport();
xpcheckflag := false;
end
//if our mouse is already over the obstacle then just click it (usually works for at least first 3 obstacles)
if isMouseOverText(mouseOverText) then
begin
fastClick(mouse_left);
wait(randomRange(waitLow, waitHigh));
exit(true);
end
if mainscreen.isPlayerAnimating then
begin
wait(randomRange(1000, 1500));
result := BoxFinder(mouseOverText, x, y, waitLow, waitHigh);
exit
end
mouse(x + random(diff), y + random(diff), mouse_move);
if isMouseOverText(mouseOverText) then
begin
fastClick(mouse_left);
wait(randomRange(waitLow, waitHigh));
exit(true);
end
else
exit(false);
end
//deposits the entire inventory into the bank
function doBanking(): boolean;
begin
if not isLoggedIn then
exit;
writeLn('banking time!');
if (bankScreen.isOpen()) then
begin
writeLn('depositing all');
bankScreen.quickDeposit(0);
wait(700 + Random(200));
bankScreen.close();
wait(random(900, 1200));
exit(true);
end
exit(false);
end
//finds and opens a prifidinas bank chest on the screen, it uses the color of the oval on the bank chest to find it
procedure openBank();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn then
exit;
bankTimer.start();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_SOUTH);
writeln('banking time!');
repeat
if findColorsSpiralTolerance(x, y, TPA, bankCircleColor, mainScreen.getBounds, 20, colorSetting(2, 0.05, 0.52)) then
begin
ATPA := TPA.toATPA(10, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['se Ban']) then
begin
fastClick(MOUSE_LEFT);
wait(2500 + Random(1000));
Exit;
end
end
end
else
begin
writeLn('did not find a bank box, waiting and trying again');
write('bank timer is ');
writeLn(bankTimer.getTime());
wait(2000 + Random(500));
Exit;
end;
until (bankScreen.isOpen() or bankTimer.getTime() > 30 * 1000);
end
//this is the agility course logic, mostly just finding objects or clicking in boxes and waiting
procedure mainLoop();
var
x, y, banktries: integer;
pt: Tpoint;
begin
if not isLoggedIn then
exit;
if ((random(500) > 475) and (not tabBackpack.isEmpty)) or (tabBackpack.isFull) then
begin
openBank;
doBanking;
end;
oldxp := currentxp;
ClickObject(redCarpetColor, stringArr, 5500, 7500, bottomOfScreenPt);
writeln('clicked red carpet');
BoxFinder(stringArr, 288, 226, 25, 6000, 8000);
writeln('found traverse cliff');
BoxFinder(stringArr, 288, 226, 35, 10800, 11600);
writeln('clicked scale cathedral');
BoxFinder(stringArr, 288, 226, 25, 8000, 9500);
BoxFinder(stringArr, 250, 193, 12, 8000, 9500);
writeln('slid line');
BoxFinder(stringArr, 318, 180, 8, 6000, 7500);
mainLoopIterations := mainLoopIterations + 1;
end
//elementary failsafe, ends script if you havent gained xp in too long
function failSafeCheck(): boolean;
begin
if not isLoggedIn then
exit(true);
if mainLoopIterations < 10 then
exit(true);
if oldxp = currentxp then
repeats := repeats + 1
else
repeats := 0;
if repeats > 10 then
begin
writeLn('gained no xp for at least 10 iterations, something is wrong)');
exit(false)
end
else
exit(true);
end
//13% chance to check your agility xp after a lap
procedure antiban();
begin
if not isLoggedIn then
exit;
if not gameTabs.isTabActive(TAB_BACKPACK) then
exit;
if random(100) > 87 then
hoverSkill(SKILL_AGILITY);
end

begin
clearDebug();
DeclarePlayers;
setupSRL();
DisableSRLDebug := True;
smartEnableDrawing := true;
setupMyVariables();
repeat
if not IsLoggedIn then
begin
if not Players[0].Login then
TerminateScript;
MainScreen.SetAngle(MS_ANGLE_HIGH);
MiniMap.setAngle(MM_DIRECTION_SOUTH);
end;
mainLoop();
progressReport();
antiban();
if not failSafeCheck then
TerminateScript;
until (False);
Exit;
end.
JRPestControl:

program JRPestControl;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

var
colortextDTM, x, y, defilerbuttcolor, greyVeteranColor, torcherwingcolor: integer;
smallbox: TBox;
quickprayericon: TPoint;

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'xxxx';
password := 'xxxx';
isActive := true;
isMember := true;
world := 53;
end
currentPlayer := 0;
end;
//setup constants
procedure setup();
begin
colortextDTM := DTMFromString('mWAAAAHicY2FgYOAHYmEoLQDE/kBsD8S6QCwPxDP//2e4dzmLIfKSIQMIcKFhRjQMAgByQwda');
greyVeteranColor := 986896;
torcherwingcolor := 1454994;
defilerbuttcolor := 12043973;
smallbox.x1 := 0;
smallbox.x2 := 50;
smallbox.y1 := 0;
smallbox.y2 := 100;
end

function BoxFinder(mouseOverText: array of string; x: integer; y: integer; diff: integer; waitLow: integer = 0; waitHigh: integer = 10): boolean;
begin
if not isLoggedIn then
exit;
if isMouseOverText(mouseOverText) then
begin
fastClick(mouse_left);
wait(randomRange(waitLow, waitHigh));
exit(true);
end
if mainscreen.isPlayerAnimating then
begin
wait(randomRange(1000, 1500));
result := BoxFinder(mouseOverText, x, y, waitLow, waitHigh);
exit
end
mouse(x + random(diff), y + random(diff), mouse_move);
if isMouseOverText(mouseOverText) then
begin
fastClick(mouse_left);
wait(randomRange(waitLow, waitHigh));
exit(true);
end
else
exit(false);
end

function ClickObject(color: integer; mouseOverText: array of string; waitLow: integer = 0; waitHigh: integer = 10; pt: TPoint = mainScreen.playerPoint): Boolean
var
x, y, i: integer;
Coords: TBox;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn then
exit;
Coords := mainScreen.getBounds();
Coords.x1 := Coords.x1 + 200;
Coords.y1 := Coords.y1 + 100;
if findColorsSpiralTolerance(x, y, TPA, color, Coords, 20, colorSetting(2, 0.05, 0.52)) then
begin
ATPA := TPA.toATPA(10, 10);
ATPA.sortFromMidPoint(pt);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(mouseOverText) then
begin
TypeSend('1', false);
FastClick(Mouse_Left);
wait(randomRange(1500 + waitLow, 2000 + waitHigh));
Exit(True);
end
if i > 5 then
exit(false);
end
Exit(True);
end
else
begin
Exit(False)
end
end
//walks the gangplank
procedure walkGangPlank();
var
i, x, y: integer;
p: TPoint;
gangbox: TBox;
bankFinding: TTimeMarker;
TPA: TPointArray;
foundGP1, foundGP2: Boolean;
begin
if not isLoggedIn() then
exit;
//no minimap symbol means we aren't outside the boat
if not minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds()) then
begin
writeln('didnt find minigame symbol');
exit;
end
writeln(findDTM(colortextdtm, x, y, smallbox));
if findDTM(colortextdtm, x, y, smallbox) then
begin
writeln('we are inside the boat lol');
exit;
end
//double finding for consistency, if one fails it's ok; the odds of them both failing are miniscule given p(fail) is already low
foundGP1 := BoxFinder(['ross', 'ang', 'lan'], 250, 200, 10);
wait(randomrange(800, 1200));
foundGP2 := BoxFinder(['ross', 'ang', 'lan'], 250, 200, 10);
if ((not foundGP1) and (not foundGP2)) then
begin
minimap.clickCompass;
mainScreen.setAngle(MS_ANGLE_HIGH);
walkGangPlank();
end
end;
//looks for the pest control text, once it fails to find it we know we're in the game
procedure waitUntilGameStarts();
var
chatbounds: TBox;
begin
if not isLoggedin then
exit;
repeat
writeln('waiting for pest control game to start!');
wait(randomrange(800, 1100));
until (not findDTM(colortextdtm, x, y, smallbox));
end
//contains all of the pest control game logic
procedure walkToBottomOfPC();
var
btminipt, p: Tpoint;
TPA: TPointArray;
Coords: TBox;
begin
if not isLoggedin then
exit;
//if we haven't even boarded the boat then we aren't playing PC
if minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds()) then
begin
writeln('found minigame symbol in PC');
exit;
end
//coordinate based minimap walking, no door support etc tho
writeln('we are in PC, time to walk to bottom!');
btminipt.x := 680 + random(20);
btminipt.y := 170 + random(12);
Coords := mainscreen.getBounds();
mouse(btminipt, MOUSE_MOVE);
wait(randomRange(500, 800));
fastClick(MOUSE_LEFT);
writeln('did first click');
wait(randomRange(1000, 1500));
minimap.waitPlayerMoving();
fastClick(MOUSE_LEFT);
writeln('did 2nd click');
wait(randomRange(1000, 1500));
minimap.waitPlayerMoving();
//turn quick prayers on
quickprayericon.x := 300 + random(10);
quickprayericon.y := 395 + random(10);
mouse(quickprayericon, MOUSE_MOVE);
fastClick(MOUSE_LEFT);
writeln('turned on quick prayer!');
repeat
if not isLoggedin then
exit;
wait(randomRange(2000, 6000));
//if out of combat try to attack a torcher
if ((actionbar.getAdrenalinePercent < 30) and findColorsSpiralTolerance(x, y, TPA, torcherwingcolor, Coords, 20, colorSetting(2, 0.05, 0.52))) then
begin
p.x := x;
p.y := y;
writeln('trying to kill a torcher');
clickObject(torcherwingcolor, ['tack']);
end
//if out of combat try to attack a defiler
if ((actionbar.getAdrenalinePercent < 30) and findColorsSpiralTolerance(x, y, TPA, defilerbuttcolor, Coords, 20, colorSetting(2, 0.05, 0.52))) then
begin
p.x := x;
p.y := y;
writeln('trying to kill a defiler');
clickObject(defilerbuttcolor, ['tack']);
end
until minimap.findSymbol(p, MM_SYMBOL_MINIGAME, minimap.getBounds());
writeln('PC game ended!');
end

begin
clearDebug();
setupSRL();
declarePlayers();
setup();
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
walkGangPlank();
waitUntilGameStarts();
walkToBottomOfPC();
until (false);
end.

StickToTheScript

2015-05-31 14:50:38

I think the scripts look good! You show the use of TPA/ATPAs and even got your own clickObject funtion and a BoxFinder function!

Looks good!

Yes from me!

Incurable

2015-05-31 20:28:57

Active? Check.
Friendly? Check.
Good attitude? Check.
Knowledgeable? Check.

That's a yes from me. :)

Sin

2015-05-31 20:46:06

Yes.

#mathminorsquad

Lipcot

2015-05-31 23:22:27

yeap yeap yea!

King

2015-06-05 11:46:17

As others have stated, you mark all the criteria for myself as well. Good luck on the rest of the votes :)

cosmasjdz

2015-06-06 03:12:17

Yes

Justin

2015-06-13 08:39:55

I'd like to see the scripts in action, do you mind posting or PMing me the SPS maps?

The Mayor

2015-06-13 09:07:02

From: Justin
I'd like to see the scripts in action, do you mind posting or PMing me the SPS maps?


The Gains Goblin :p

J_R

2015-06-13 10:26:49

From: Justin
I'd like to see the scripts in action, do you mind posting or PMing me the SPS maps?


The only SPS map I use is this one for the thiever, name it "Prif.png" and put it in the Runescape Other folder:

[ATTACH=CONFIG]26131[/ATTACH]

crap idk why it automatically converted to jpg, I don't think it should make too much of a difference; but if it does I can upload it to imgur or something

also for the thiever, It implicitly depends on your previous lodestone location being prifidinas, and you get set the starting clan to whichever one of the 5 offered that you want to start at in setupMyVariables().

Hoodz

2015-06-13 14:27:24

From: J_R
The only SPS map I use is this one for the thiever, name it "Prif.png" and put it in the Runescape Other folder:

[ATTACH=CONFIG]26131[/ATTACH]

crap idk why it automatically converted to jpg, I don't think it should make too much of a difference; but if it does I can upload it to imgur or something

also for the thiever, It implicitly depends on your previous lodestone location being prifidinas, and you get set the starting clan to whichever one of the 5 offered that you want to start at in setupMyVariables().


dont do it! @Justin; is just going to leech your script :p

J_R

2015-06-13 15:16:44

From: hoodz
dont do it! @Justin; is just going to leech your script :p


Lol. It's more likely that he (and probably a good portion of the people here who try it) will notice and probably have an idea on how to fix the one thing that's slowing down my thieving script.

Justin

2015-06-13 20:46:33

Few things I've noticed in my short testing…

JRElfLarceny runs fine until it needs to move onto the next clan and then things start to get messy.

Most of the time the blindwalk will end up here:

If there's more than 2 banking icons on the minimap, it will mainly click the furthest one away from the player (causing more issues)

Pickpocket detection works well and seems stable but I'd add a didClick check to make sure we actually clicked on the NPC and not the 'Walk here' option if the NPC was to move.

I didn't run the script any longer then 20 minutes as I don't like risking my account with script I didn't create/heavily modify

J_R

2015-06-13 21:54:59

That's weird, I never had any problem with the blindwalking offscreen, maybe something might've changed in RS in the last two weeks to mess it up. In the 10hour run I ran it while writing it, it didnt seem to get lost in general (when I watched it for an hour, it visited all the clans properly). You might not have set your starting clan right, can't think of any other reasons it would go in the middle of nowhere. I uploaded the png version to imgur in case being converted to jpg by the forum caused problems.
http://i.imgur.com/ceMqxL0.png

After I get 120 agility from my other script, I'll probably work harder on this to fix it up.

I tried to resolve the double bank icon problem by sorting by y coordinate of the icon, but it was still being uncooperative (maybe I have it sorting the wrong way, was my first time needing to use sortTPAByY).

The main issue I struggled and ultimately failed at solving though with my script was fringe cases involving starting/ending of pickpocketing. The most prevalent ones included being caught immediately after clicking on the elf (no exp was gained, so I wouldn't think the pickpocketing actually started) and noting down a strike when the pickpocketing stopped due to environmental factors (sometimes, especially in meilyr, the worker walks somewhere and breaks the pickpocketing because you can't quite bend around the pillar or walk through magicians for some reason). I think your didClick idea would definitely help with this as there are definitely cases where the script moves on too early.

Together with detection of when the entire clan is alerted to your presence (I could never get a working dtm/color/other way to detect the small "don't steal from me" symbol above their heads), I feel like it would go from 230k/hr up to 330-350k/hr as that's where the bottleneck definitely was when I was writing / testing it.

Justin

2015-06-14 01:26:57

@J_R; Used the updated map and the blindwalk issue has been fixed.

I'm going to accept and close this application.

Congratulations!!