SRL Archive - Archive

buttdestroyr - SRL Member Application


Camel

2014-09-26 23:54:38

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


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
I'm moderately experienced in C#, Java, and Visual Basic.


Are you a member of any other communities?
No


Tell us about yourself…
From: buttdestroyr
My name is Jack. I'm a student at Oklahoma State University majoring in chemical engineering. My interests are computer programming, and writing and recording music.

As for the music, I play drums and a bit of guitar and keys, I spend a lot of my free time generating various kinds of melodies or rhythms, then I try to compile several of these ideas into one recording. It's essentially like I make a bunch of jigsaw puzzle pieces and attempt to complete the puzzle.

Computer programming has been a "sleeping" hobby of mine since I took AP computer science in high school. This class went over Java. To be honest, I don't actually remember what I learned in that class but according to the test results I passed. After the class I didn't really do any programming for 3 years.

Then one day last summer I decided that I wanted to bot runescape again. (I had done it earlier using various various other bots). One way or another I ended up here. I lurked around the forums for a few days and decided that I wanted to give scripting for runescape a shot. So I read through The Mayors tutorial and I felt like I picked up everything pretty quickly as I've seen most of it before and made a very bad Air rune crafter. Over the past 3 months I've been here, I've been consistently updating this script to the best of my ability and I think it may finally be complete (maybe). This is the script I will be submitting.



Please show us one (or multiple) of your scripts.
//The actually script includes a very long bitmapFromString for the progress report, I cut it out in this submission
program AirCrafter;

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

var
TakeBreaks, Debug, Preset, Antiban, UseTele : Boolean;
World, runsToDo, PresetNumber : Integer;
RunsDone, RunesMade, EssPrice, RunePrice,x,y, Recoveries, LawRunePrice: Integer;
EssDTM, AltarDTM, StaffShopDTM : Integer;
PathToAltarA,PathToAltarB,PathToBankA,PathToBankB, PathToBankC, PathToBankD, RecoverPath : TPointArray;
BankBox,AltarBox : TBox;
proggyBmp:integer;
BreakTime : Integer;
spsMain, spsRecovery: TSPSArea;
LeaveAltar: procedure();
procedure stopScript(reason : String);
begin
writeLn('Stopping script');
writeLn(reason);
if isLoggedIn() then
writeLn('Logging out');
players[currentPlayer].logout();
if not Preset then
freeDTM(EssDTM);
freeDtm(AltarDTM);
freeDtm(StaffShopDTM);
freeBitmap(proggyBmp);
writeLn('Done');
end;
procedure LoadProggie();
begin
// very long bmpToFromStr call
end;

procedure JagexRetardation;
begin
exitTreasure;
claimTicket;
end;
procedure Antipattern;
var
i: integer;
begin
if not Antiban then
exit;

i := random(3000);
if i < 60 then
begin
writeLn('Doing antiban');
case i of
1..4: begin
writeLn('Taking Mini-break');
wait(gaussRangeInt(300000,420000));
if not isLoggedIn() then
begin
players[currentPlayer].login();
wait(gaussRangeInt(300,2000));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
JagexRetardation;
end;
end;
5..18: begin
hoverSkill(SKILL_RUNECRAFTING);
wait(gaussRangeInt(1500,5000));
gameTabs.openTab(TAB_BACKPACK);
end;
19..21: mouseMovingObject();
22..34: sleepAndMoveMouse(randomRange(100,6000));
35..45: begin
mouseOffClient(Random(4));
Wait(gaussRangeInt(10000,15000));
end;
46..53: Wait(gaussRangeInt(1000,1500));
54..60: pickUpMouse();
end;
writeLn('Antiban done');
end;

end;
procedure Recover;
begin
lodestoneScreen.teleportTo(LOCATION_VARROCK);
SmallRandomMouse(40);
wait(gaussRangeInt(15500,17500));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
spsRecovery.WalkPath(RecoverPath);
Recoveries := Recoveries + 1;
end;
procedure GetBreakTime();
begin
// 60000 = 1 min
BreakTime := getSystemTime()
+ gaussRangeInt(gaussRangeInt(45,160) * 60000, gaussRangeInt(161,350) * 60000);
end;
procedure takeBreak();
var
H, M, S, HH, MM, SS, breakFor, timeLeft: integer;
breakStartTimer: TTimeMarker;

begin // Essentially taken from The Mayor's VEB
if not TakeBreaks then
exit;
if (getSystemTime() >= BreakTime) then
begin
if random(2) = 0 then
players[currentPlayer].logout()
else
players[currentPlayer].exitToLobby();
breakFor := gaussRangeInt(25 * 60000, 100 * 60000);
convertTime(breakFor, H, M, S);
writeLn('You are breaking for: ' + toStr(H)+ 'h ' + toStr(M)+ 'm ' + toStr(S)+ 's');
breakStartTimer.start();
repeat
timeLeft := breakFor - breakStartTimer.getTime();
convertTime(timeLeft, HH, MM, SS);
writeLn('Ending break in: ' + toStr(HH)+ 'h ' + toStr(MM)+ 'm ' + toStr(SS)+ 's');
wait(25000 + random(4000));
until breakFor < breakStartTimer.getTime();
GetBreakTime();
players[currentPlayer].login();
wait(gaussRangeInt(1500, 3500));
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
mainscreen.setZoom(true);
JagexRetardation;
end;
end;
function getGEPrice(itemString: string): integer;
var
wikiaPage, priceString: string;
begin // from The Mayor's VEB
wikiaPage := getPage('http://runescape.wikia.com/wiki/Exchange:' + itemString);
priceString := between('GEPrice">', '</span>', wikiaPage);
result := strToIntDef(priceString, -1);
writeLn('-- ' + itemString + ' price: '+ toStr(result) + ' gp');
end;
function SlotOfAirRunes() : integer;
var
i,x,y : integer;
boxes : TBoxArray;
begin
boxes := tabBackpack.getSlotBoxes();
for i:=0 to high(boxes) do
begin
if(findColorTolerance(x,y,13816539,boxes[i],15,colorSetting(1, 0.00, 0.00))) then
begin
result := i+1;
exit;
end;
end;
// defaults to one because its probably there
result := 1;
end;
function timeUntilBreak(): string;
var
breakFromNow, H, M, S: integer;
begin
breakFromNow := BreakTime - getSystemTime();
convertTime(breakFromNow, H, M, S);
result := (toStr(H)+ 'h ' + toStr(M)+ 'm ' + toStr(S)+ 's');
end;
function IsInAltar(waitTime: integer) : Boolean;
var
t: TTimeMarker;
DTM,x,y: Integer;
begin
result := false;
if not isLoggedIn() then
exit;
t.start();
repeat
if(findDTM(AltarDTM,x,y,minimap.getBounds())) then
result := true;
wait(gaussRangeInt(30,120));
until (t.getTime() > waitTime) or (result);
end;
Procedure TeleToVarrock;
var
x,y :Integer;
timer : TTimeMarker;
timer2 : TTimeMarker;
Begin
timer.start()
repeat
if Actionbar.clickSlot(1) then
RunesMade := RunesMade - 3;
if(gaussRangeInt(2,5)= 3) then
SmallRandomMouse(40);
timer2.Start();
repeat
wait(gaussRangeInt(40,200));
until(not IsInAltar(100)) or (timer2.getTime() > 5000);
wait(gaussRangeInt(400,1100));
until (FindDTM(StaffShopDTM,x,y,minimap.getBounds()) = true) or (timer.getTime > 30000);
end;
procedure CraftRunes();
var
x,y,i : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
timer : TTimeMarker;
firstRun: Boolean;
begin
smartImage.DrawEllipse(Point(368,102),40,33,false,5);
timer.start();
firstRun := True;
repeat
// Try Oval first run through, color if it fails
if(firstRun) then
begin
mouseOval(368,102,40,33);
if isMouseOverText(['raft', 'Craft', 'Craft-rune'], 500) then
begin
if gaussRangeInt(0,8) = 4 then
begin
fastClick(MOUSE_RIGHT);
chooseOption.select(['raft','raft-rune','Altar']);
end else
begin
fastClick(MOUSE_LEFT);
end;
if (gaussRangeInt(0,5) = 3) then
smallRandomMouse(50 + random(100));
end;
end else
begin
findColorsSpiralTolerance(x, y, TPA, 9140353, mainScreen.getBounds(), 11, colorSetting(2, 0.39, 0.30));
if (Length(TPA) < 1) then
begin
Exit;
end;
ATPA := TPA.toATPA(45, 45);
ATPA.sortBysize(true);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['raft', 'Craft','-runes'], 500) then
begin
if gaussRangeInt(0,8) = 4 then
begin
fastClick(MOUSE_RIGHT);
chooseOption.select(['raft','Craft']);
end else
begin
fastClick(MOUSE_LEFT);
end;
if (gaussRangeInt(0,5) = 3) then
smallRandomMouse(50 + random(100));
break;
end;
end; // forloop end
end;
smartImage.clearArea(mainScreen.getBounds);
tabBackpack.waitForShift(randomRange(3000,4500));
wait(gaussRangeInt(700,1000));
if Conversationbox.isOpen then // in case pack.count messes up (never)
begin
Conversationbox.continue(false,false);
exit;
end;
firstRun:= False;
until (tabBackpack.count < 3) or (timer.getTime > 20000) or (not isLoggedIn());
if timer.getTime < 20000 then
begin
JagexRetardation;
RunsDone := RunsDone + 1;
RunesMade := RunesMade + getItemAmount(tabBackpack.getSlotBox(SlotOfAirRunes()));
Exit;
end;
Recover;
end;
Function isInBank() : Boolean
var
pos: TPoint;
begin
pos := spsMain.getPlayerPos();
result := pointInBox(pos, BankBox);
end;
procedure WalkToBank();
var
walkTimer: TTimeMarker;
WalkPath : TPointArray;
begin
walkTimer.start();
if not minimap.isRunEnabled() then
minimap.toggleRun(true);
repeat
if not isLoggedIn() then
exit;
if isInBank() then
exit;
if walkTimer.getTime() > 90000 then
begin
Recover;
end;
if not UseTele then
begin
if(random(2) = 0 ) then
WalkPath := pathToBankA
else
WalkPath := pathToBankB;
end else
begin
if(random(2) = 0 ) then
WalkPath := pathToBankC
else
WalkPath := pathToBankD;
end;
if not UseTele then
begin
if not spsMain.walkPath(WalkPath) then
begin
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
end else
begin
// walks player right outside of bank
// spsMain is used to walk inside the bank
if not spsRecovery.walkPath(WalkPath) then
begin
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
// sps main is more accurate, puts the player somewhere in the bank
spsMain.walkToPos(Point(356+gaussRangeInt(-3,3), 149-random(5)));
end;
until walkTimer.getTime() > 300000;
StopScript('Failed to walk to the bank');
end;
function IsNextToAltar() : Boolean
var
pos: TPoint;
begin
pos := spsMain.getPlayerPos();
result := pointInBox(pos, AltarBox);
end;
procedure WalkToAltar();
var
walkTimer: TTimeMarker;
WalkPath : TPointArray;
begin
walkTimer.start();

if not minimap.isRunEnabled() then
minimap.toggleRun(true);
repeat
if not isLoggedIn() then
exit;
if isNextToAltar() then
exit;
if walkTimer.getTime() > 90000 then
begin
Recover;
end;
if(random(2) = 0 ) then
WalkPath := pathToAltarA
else
WalkPath := pathToAltarB;
if not spsMain.walkPath(WalkPath) then
begin
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
until walkTimer.getTime() > 300000;
StopScript('Failed to walk to the Altar');
end;
procedure OpenBank;
var
x, y, i,j: integer;
TPA, Temp: TPointArray;
ATPA: T2DPointArray;
timer : TTimeMarker;
sorted : Boolean;
begin
if not isLoggedIn() then
exit;
timer.start();
repeat
findColorsSpiralTolerance(x, y, TPA, 5582399, mainScreen.getBounds(), 9, colorSetting(2, 0.32, 0.83));
if (Length(TPA) < 1) then
begin
Exit;
end;
mainScreen.filterPointsPlayer(TPA);
ATPA := TPA.toATPA(15, 15);
FilterTPAsBetween(ATPA,1,25);
//Sort Each found banker by differnce between the Y value of the banker from the Y value of the player
//Using Bubble sort because efficieny is stupid
Sorted := False;
while (Sorted = False) do
begin
Sorted := True;
for j := 1 to high(ATPA) do
begin
if((Abs(middleTPA(ATPA[j-1]).y - mainscreen.playerPoint.y)) > (Abs(middleTPA(ATPA[j]).y - mainscreen.playerPoint.y))) then
begin
Temp := ATPA[j];
ATPA[j] := ATPA[j-1];
ATPA[j-1] := Temp;
Sorted := False;
end;
end;
end;
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank', 'Bank','nk B'], 500) then
begin
if gaussRangeInt(0,8) = 4 then
begin
fastClick(MOUSE_RIGHT);
chooseOption.select(['ank','Bank']);
end else
begin
fastClick(MOUSE_LEFT);
end;
if (gaussRangeInt(0,5) = 3) then
smallRandomMouse(50 + random(100));
smartImage.clearArea(mainScreen.getBounds);
break;
end;
end;
until (Bankscreen.isOpen(5000)) or (Pinscreen.isOpen(5000)) or (not isLoggedIn()) or (timer.getTime() > 20000);
end;
procedure EnterAltar();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
timer : TTimeMarker;

begin
if not isLoggedIn() then
exit;
timer.start();
repeat
findColorsSpiralTolerance(x, y, TPA, 12691328, mainScreen.getBounds(), 9, colorSetting(2, 0.33, 1.74));
if (Length(TPA) < 1) then
begin
Exit;
end;
mainScreen.filterPointsPlayer(TPA);
ATPA := TPA.toATPA(50, 50);
ATPA.sortBysize(true);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['nter My', 'Enter Myster','yster','Myster','yste'], 500) then
begin
if gaussRangeInt(0,8) = 4 then
begin
fastClick(MOUSE_RIGHT);
chooseOption.select(['nter','Enter']);
end else
begin
fastClick(MOUSE_LEFT);
end;
if (gaussRangeInt(0,5) = 3) then
smallRandomMouse(50 + random(100));
smartImage.clearArea(mainScreen.getBounds);
break;
end;
end;
until (IsInAltar(5000)) or (not isLoggedIn()) or (timer.getTime() > 20000);
end;
procedure LeaveAltarPortal();

var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
timer : TTimeMarker;
timer2 : TTimeMarker;
begin
if not isLoggedIn() then
exit;
timer.start();
repeat
findColorsSpiralTolerance(x, y,TPA ,6727080, mainScreen.getBounds(), 24, colorSetting(2, 0.04, 0.47));
if (Length(TPA) < 1) then
begin
exit;
end;
mainScreen.filterPointsPlayer(TPA);
ATPA := TPA.toATPA(25, 25);
FilterTPAsBetween(ATPA,1,30);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['nter Portal', 'Enter Portal','ortal','Por','tal','nter P'], 500) then
begin
if gaussRangeInt(0,8) = 4 then
begin
fastClick(MOUSE_RIGHT);
chooseOption.select(['nter','Enter']);
end else
begin
fastClick(MOUSE_LEFT);
end;
if (gaussRangeInt(0,5) = 3) then
smallRandomMouse(50 + random(100));
smartImage.clearArea(mainScreen.getBounds);
timer2.Start();
repeat
wait(gaussRangeInt(40,200));
until(not IsInAltar(100)) or (timer2.getTime() > 6000);
break;
end;
end;
until (not IsInAltar(100)) or (not isLoggedIn()) or (timer.getTime() > 30000);
if (timer.getTime() > 30000) then
Recover;

end;
procedure DepositRunes();
var
bankTimer: TTimeMarker;
begin
if bankScreen.isOpen(3000) or pinScreen.isOpen(3000) then
begin
bankTimer.start();
repeat
if (bankscreen.getPackCount() > 0) then
begin
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(gaussRangeInt(1100, 1750));
end;
if(bankscreen.getPackCount() = 0) then
exit;
until (bankTImer.getTime() > 45000);
end;
end;
procedure WithdrawEss();
var
i: Integer;
begin
if(bankScreen.isOpen()) then
begin
repeat
if(bankscreen.withdraw(EssDTM,-1)) then
begin
wait(gaussRangeInt(500,1000));
if(bankscreen.getPackCount() > 0) then
begin
wait(gaussRangeInt(200,400));
bankscreen.close();
exit();
end;
end;
inc(i);
until i > 15
if (i> 15) then
StopScript('Failed to withdraw ess');
end;
end;
procedure UseBank();
var
timer : TTimeMarker;
begin
if Bankscreen.isOpen(3000) or Pinscreen.isOpen(2999) then
begin
if pinScreen.isOpen() then
pinScreen.enter(Players[currentPlayer].bankPin);
timer.start();
repeat
if Preset then
begin
bankscreen.ClickButton(PresetNumber + 2);
wait(gaussRangeInt(100,300));
end else
begin
DepositRunes();
WithdrawEss();
end;
until (not Bankscreen.isOpen) or (not isLoggedIn()) or (timer.getTime >30000);
end;
end;
procedure checkForImages(path, link, item: string);
var // Taken from The Mayor's VEB miner.
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
begin
writeLn('NOTIFICATION: ' + item + ' already exists!');
exit;
end;
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 initPlayerForm();
begin
with playerForm do
begin
name := 'Buttdestroyr''s Aircrafter V3';

editBoxLabels := ['World','Runs To Do'];
editBoxDefaults := [ '0', '100'];
checkBoxLabels := ['Take Breaks', 'Debug','Use Preset','Antiban','Use Tele to Varrock (Preset Only)'];
checkBoxDefaults := ['True','False','False','True','False'];

comboBoxLabels := ['Preset Number'];
comboBoxDefaults := ['1'];


setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['1', '2'];
end;
end;

procedure setup();
var
i : Integer;
begin
smartEnableDrawing := true;
PresetNumber := -1;
Recoveries := 0;
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
terminatescript;

players.Setup(playerForm.playerNames, playerForm.playerFile);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
World := strToInt(playerForm.players[i].settings[0]);
players[currentPlayer].world := World;
RunsToDo := strToInt(playerForm.players[i].settings[1]);
Debug := strToBool(playerForm.players[i].settings[3]);
TakeBreaks := strToBool(playerForm.players[i].settings[2]);
Preset := strToBool(playerForm.players[i].settings[4]);
Antiban := strToBool(playerForm.players[i].settings[5]);
UseTele := strToBool(playerForm.players[i].settings[6]);
if Preset then
PresetNumber := strToInt(playerForm.players[i].settings[7]);
end;
smartPlugins := ['d3d9.dll'];
setupSRL();
disableSRLDebug := not Debug;
checkForImages('Includes/SPS/img/runescape_surface/recovery_path.png', 'http://i.imgur.com/kmeBd97.png', 'Recovery map');
checkForImages('Includes/SPS/img/runescape_surface/air_altar_path.png', 'http://i.imgur.com/eFDFsbD.png', 'Main map');
spsMain.setup('air_altar_path', RUNESCAPE_SURFACE);
spsRecovery.setup('recovery_path',RUNESCAPE_SURFACE);
BankBox := intToBox(330,119,380,162);
AltarBox := intToBox(98,258,140,297);
RecoverPath := [Point(171, 292), Point(171, 272), Point(171, 247), Point(171, 224), Point(169, 197), Point(168, 159), Point(163, 136), Point(156, 110), Point(124, 110), Point(91, 104), Point(75, 105)];
pathToAltarA := [Point(355, 148), Point(354, 164), Point(351, 182), Point(338, 187), Point(315, 190), Point(284, 195), Point(271, 205), Point(262, 215), Point(255, 224), Point(239, 230), Point(222, 239), Point(203, 239), Point(175, 237), Point(156, 237), Point(136, 245), Point(135, 255), Point(123, 287)];
pathToAltarB :=[Point(353, 185), Point(333, 184), Point(311, 189), Point(286, 194), Point(271, 202), Point(261, 217), Point(234, 218), Point(218, 227), Point(195, 237), Point(156, 237), Point(136, 241), Point(126, 267), Point(127, 277)];
pathToBankA :=[Point(134, 259), Point(137, 243), Point(155, 236), Point(179, 237), Point(218, 236), Point(236, 231), Point(252, 223), Point(269, 209), Point(289, 191), Point(304, 188), Point(330, 188), Point(353, 184), Point(356, 149)];
pathToBankB :=[Point(130, 243), Point(152, 237), Point(193, 245), Point(217, 238), Point(244, 226), Point(267, 216), Point(274, 200), Point(301, 191), Point(327, 189), Point(327, 189), Point(346, 186), Point(352, 155)];
// Tele To Varrock Paths
pathToBankC := [Point(155, 107), Point(121, 107), Point(102, 101), Point(69, 101)];
pathToBankD := [Point(157, 117), Point(145, 107), Point(121, 107), Point(93, 105), Point(67, 101)];
if UseTele then
begin
LeaveAltar := @TeleToVarrock;
LawRunePrice := getGEPrice('Law_rune');
end else
begin
LeaveAltar := @LeaveAltarPortal;
end;
AltarDTM := DTMFromString('m6wAAAHic42ZgYChnZmDYB8Q7gXg7EM8C4mogLgTiLCCuhLJBco6MDAy2QCwNxP+Bej8A8XMgZgXyhYDYC4i9gdgAiGMCjIjGckAziMWMJGAkAAAbhRWV');
StaffShopDTM := DTMFromString('mbQAAAHicY2VgYAhjYWAIAeIAII5lgfDbgOL1QNwCxK1A3A/EC1siGTaf+cawZN8bhvm7XjGU9x9lYAWKo2NGLBgMALg7DtE=');
if not Preset then
EssDTM := DTMFromString('mWAAAAHicY2FgYMhmhuAYIK4AYm1GBgZLRgitC8QuTo5AVUxwzMWAChjRMAgAAN/AA1Y=');
RunesMade :=0;
//LoadProggie;
RunePrice := getGEPrice('Air_rune');
EssPrice := getGEPrice('Rune_essence');
addOnTerminate('stopScript');
end;
procedure PaintProgress();
var
RunesPerHour : Integer;
RunsPerHour : Integer;
ExperienceGained : Integer;
ExperiencePerHour : Integer;
ProfitGained : Integer;
ProfitPerHour : Integer;
begin
RunesPerHour := round((RunesMade) * (3600.0 / (GetTimeRunning / 1000.0)));
RunsPerHour := round((RunsDone) * (3600.0 / (GetTimeRunning / 1000.0)));
ExperienceGained := RunsDone * 140;
ProfitGained := ( (RunesMade*RunePrice) - ((RunsDone*28) * EssPrice) );
if UseTele then
begin
// compensate statistics for the law rune and all
ProfitGained := (ProfitGained - (RunsDone * LawRunePrice));
ProfitGained := ProfitGained - (EssPrice * RunsDone);
ExperienceGained := ExperienceGained - (RunsDone * 5);
end;
ExperiencePerHour := round((ExperienceGained) * (3600.0 / (GetTimeRunning / 1000.0)));
ProfitPerHour := round((ProfitGained) * (3600.0 / (GetTimeRunning / 1000.0)));
smartImage.clearArea(chatbox.getBounds);
//smartImage.drawBitmap(proggyBmp, point(2, 462));
smartImage.drawClippedText('Time Ran: ' + msToTime(getTimeRunning(), TIME_SHORT) + '', point(90, 520), 'UpChars07', true, clWhite);
smartImage.drawClippedText('XP Gained: ' + toStr(ExperienceGained) + '', point(90, 540), 'UpChars07', true, clWhite);
smartImage.drawClippedText('XP per Hour: ' + toStr(round(ExperiencePerHour)) + '', point(90, 560), 'UpChars07', true, clWhite);
smartImage.drawClippedText(': ' + toStr(ProfitGained) + ' ('+toStr(ProfitPerHour)+' PH)', point(350, 525), 'UpChars07', true, clYellow);
smartImage.drawClippedText(': ' + toStr(RunesMade) + ' ('+toStr(RunesPerHour)+' PH)', point(350, 555), 'UpChars07', true, clWhite);
end;
procedure MainLoop();
begin
if tabBackpack.count > 2 then
begin
if IsInAltar(400) then
begin
craftRunes();
end else
begin
WalkToAltar();
EnterAltar();
end;
end else
begin
if IsInAltar(400) then
begin
LeaveAltar();
end else
begin
WalkToBank();
OpenBank();
UseBank();
end;
end;
PaintProgress;
Antipattern;
TakeBreak;
if TakeBreaks Then
writeln('Next Break: ' + timeUntilBreak());
end;
begin
clearDebug();
setup();
GetBreakTime();
if isLoggedIn() then
begin
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
mainscreen.setZoom(true);
JagexRetardation;
end;
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
wait(randomRange(1500, 3000));
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
mainscreen.setZoom(true);
JagexRetardation;
end;
mainLoop;
until RunsDone > RunsToDo;
end.

The Mayor

2014-09-27 00:27:08

Very hard to read with all of your procedures and functions joined together, you should L2 space them out a bit :p

Wetish

2014-09-27 11:27:10

A lot of redundancy with isMouseOverText

'nter My', 'Enter Myster','yster','Myster','yste'
If it doesn't find 'nter My', then it won't be able to find 'Enter Myster'

Same thing here
'raft', 'Craft', 'Craft-rune'
'raft','raft-rune','Altar'
'ank', 'Bank','nk B'
'ank','Bank'
'nter','Enter'
'nter Portal', 'Enter Portal','ortal','Por','tal','nter P'

Unless there is something different that I am missing with isMouseOverText than IsUpTextMultiCustom.

Camel

2014-09-27 16:39:54

Well it doesn't take a statistician to see the trend the votes are taking, guess I shouldn't have applied… Regardless, thanks for the feedback, I definitely overlooked the really simple things. While I have a significant majority against this application, it's not unanimous. So why did one person say yes? Also, what major components is my script missing that made this application receive a no? I do admit the script is very simplistic. For example, it does not use any camera rotations. I'm just curious on how I can further improve this script, and my abilities in general.

Anyways, thanks for the feedback given, I'll keep working on things.

The Mayor

2014-09-27 17:50:08

I haven't actually voted yet, but I'm leaning towards a yes. Those no votes without comment are probably people that don't even want to look at your code because it's one big mass :p and you're relatively unknown around here.

slacky

2014-09-27 17:59:58

I simply voted no because all of your procedures are bundled together which is very messy, and makes it a lot harder to go through. There is also a lack of comments, like a good habit to have is to have a comment-header over each method, and an empty space of +/-2 rows between each method.

You also have an extensive use of global variables, which i really do not like, this is much because of this makes for harder maintenance. Globals should be avoided, but are acceptable when ever it's the best solution, which isn't really that often. I get that people do this, as it might for some be simpler to create it that way. These global vars might be the best way out, but as it's now, the script just looks to messy to do a some decent analysis.
It would take me _much_ longer to properly go through your script than for any other script which has proper standards, with decent commenting, empty rows where needed etc, so I simply wont.

Camel

2014-09-27 18:17:08

Yeah, that makes complete sense. I'm used to looking at the code in simba, where it draws a convenient dividing lines between each procedure/function. If I ever apply again, I'll ensure its not painful to look at.

slacky

2014-09-27 18:28:05

From: buttdestroyr
Yeah, that makes complete sense. I'm used to looking at the code in simba, where it draws a convenient dividing lines between each procedure/function. If I ever apply again, I'll ensure its not painful to look at.

I think you should apply again if this comes to a "negative poll". I see potential from what you have written. Just be sure to clean up the script (quite a bit :P) before next time, as this is an important part of both the application and scripts in general.

I also must mention that stuff that does not belong in one procedure, and/or can be separated out, should be. Take for example your "SortATPAByMiddleY" bubblesort (Ref: line 397), it should be it's own procedure. This way it can be easily be seen what's going on, and if it for example shows to be a bottleneck, you, or anyone else can easily update it/replace it, it can also be reused other places in the script if ever needed, people can also simply take the method and use it in their own scripts.

—-
Also regarding that sorting function, not that it matters if it's "fast enough". It just scares me:
It's as inefficient as it can possibly be: O(n²) performance (swaps), plus the fact that you recompute the middle two times in each inner loop, instead of computing all the middles first, then sorting the data.

[spoiler=More shit regarding your bubblesort]
Example scenario:
[INDENT]If the average size of each TPA in the ATPA is say 5, and the ATPA it self is 1000 elements long, it will in worst case reach 1000*1000*10 iterations (Detail: 1000 outer iterations, and then the inner loop: 1000 iterations * 2xMiddleTPA [5 iterations for MiddleTPA on avg - calling middle twice]), and 1 million swaps. In comparison to any n*log(n) sorting function with precomputed middles this example case is doing HUNDREDS of times more work[/INDENT]

But I guess since you have chosen bubblesort, that the data being sorted is very small.

However, here is a tweak to make your implementation of the bubblesort it self less inefficient, it's simply done by decreasing the inner loop by 1 each outer iteration, this is because after one iteration over the array the largest element found is always placed in the end, this is just how bubblesort works.

...
Sorted := False;
k := High(ATPA);
while not(Sorted) do
begin
Sorted := True;
for j := 1 to k do
begin
if((Abs(middleTPA(ATPA[j-1]).y - mainscreen.playerPoint.y)) >
(Abs(middleTPA(ATPA[j]).y - mainscreen.playerPoint.y))) then
begin
Swap(ATPA[j], ATPA[j-1]);
Sorted := False;
end;
end;
Dec(k);
end;
[/spoiler]

Ross

2014-09-27 22:32:19

I'm new so this may be improper procedure, but if you don't change the code at all I would edit OP with better formatting. At this point you could still salvage the app!

I've used your script before and looked at the code to edit for myself. I like the procedure you use for the altar a lot, and you have solid scripting knowledge. You also update in a relatively short amount of time after bug reports.

Clean up the formatting and you would get a yes from me. :)

Turpinator

2014-09-28 02:53:45

From: Ross
Clean up the formatting and you will get a yes from me. :)


Psst. Youre not supposed to vote for a few weeks after being accepted into the club.

ANNNYWAYY…
From: buttdestroyr
Well it doesn't take a statistician to see the trend the votes are taking, guess I shouldn't have applied…

Buut. buut. some people havent even voted! like i have yet to vote. (and i can always abstain) and some people might not till later. DONT LOSE HOPE!