The Big 250m Scripting Competition RESULTS
Summary:
The Big 250m Scripting Competition has drawn to a close. It has been very successful, with fifteen high-quality entries (although one was unfinished). The 250 line limit forced each entrant to really understand their code; to find out what was relevant and what was not, and to only keep what was necessary. A number of these entrants have the scripting ability required for the SRL Member rank (albeit this isn’t the only requirement). Will we be seeing some more applications in the near future?
Many days and many hours went into making these scripts. Even though prizes are only awarded to the top 5, all the entrants should be recognised for the effort they have put in. Each script has been graded, and then discussed in the SSRL+ boards. The competition marks were very, very close, with single marks separating most. All of the scripts are presented below, with their respective grades tabulated at the top of the script. Read them, learn from them, and maybe one day you will also attain the SRL Competition Cup, and the many other goodies in the hidden sections of these forums.
At the end of the day, this competition has proved 3 things:
- You don’t have to write 1000 lines of code to make an amazing script
- Anybody can learn to code with the resources available to them, if they put their mind to it
- 250m is mere pocket change to The Mayor (jk I'm broke now)
The final results (marks out of 100):
.
- @Incurable: .... (83 | A-)
- @undorak7: .... (82 | A-)
- @akarigar: ...... (81 | A-)
- @Trollcrank: ... (76 | B+)
- @Lama: ............ (75 | B+)
- @Dr Clemsip: ...(74 | B)
- @agent007: .... (73 | B)
- @Torol: ............ (73 | B)
- @pipos1: ......... (69 | B-)
- @Wooty: ......... (68 | B-)
- @cosmasjdz: .. (68 | | B-)
- @arclight: ....... (66 | B-)
- @Cyanempire: (64 | C+)
- @PheteyGee: . (62 | C+)
- @Yuskie: ........ (48 | D)
Prizes:
- @Incurable: + 100m RS3 + $20 USD
- @undorak7: 60m RS3
- @akarigar: 40m RS3
- @Trollcrank: 30m RS3
- @Lama: 20m RS3
A big thanks to our donators: BMWxi (50m), Clarity (50m), Jake (50m), YoHoJo ($10), Home ($10), and myself (100m)
Please PM me, or send me a skype message to collect your prize (skype on my profile). Cup @Daniel
Entries (in order of results):
Incurable
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 249 | Legit |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 17/20 | A few bits and pieces (see comments) |
|------------------- --------- ------------------------------------------------|
| o Original Code | 7/10 | Sufficient |
|------------------- --------- ------------------------------------------------|
| o Presentation | 14/15 | Unused vars. Would like whitespace in mainloop |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 12/15 | See productionScreen |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 10/10 | You got it down, son |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 9/10 | Nice, although hard coded to 1 player |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 8/10 | Nice and simple |
|------------------- --------- ------------------------------------------------|
| o Comments | 5/5 | No issues |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 3/5 | Basic walkPath |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 85/100 |
|-----------------------------|
| ** Weighted at | 0.975 | ( Could have got mems before comp )
|------------------- ---------|
| FINAL GRADE: 83/100 (A-) |
|-----------------------------}
program Competition;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.simba}
{$I SRL-6/lib/misc/srlplayerform.simba}
const
VERSION = '1.0';
// Script Requirements - NO EXCEPTIONS: http://pastebin.com/AwGJgFGD
var
numSmelted, loadsDone, numOfBreaksDone, totalBreakTime, telesDone: integer;
pathLodeToBank, pathBankToFurn, pathFurnToBank: TPointArray;
breakTimer: TTimeMarker; (* ~TM - Ideally globals are distinguished with a Captial *)
procedure InitPlayerForm(); // Initiate the SRL Player Form
begin
with playerForm do
begin
name := 'Inc''s Lumby Smelter v' + toStr(VERSION); (* ~TM - But it is already a string *)
scriptHelpThread := ''; (* ~TM - Could remove if not used *)
editBoxLabels := ['Bars to Smelt', 'Bars per Pack', 'Profit per Bar', 'Time till Break', 'Break Time'];
editBoxDefaults := ['1000', '9', '250', '200', '30'];
editBoxHints := ['How many bars do you want to smelt? Must be <= number of bars you have the ore to smelt!', 'If unsure, check bar chart at top of script', 'Get from: http://runescape.wikia.com/wiki/Smelting_calculator'];
checkBoxLabels := ['Take Breaks'];
checkBoxDefaults := ['true'];
end;
end;
procedure DeclarePlayers(); // Declares the players to be used by the script
begin
players.setup(playerForm.players);
with players[0] do (* ~TM - What if I have more than 1 player *)
begin
world := - 1;
integers[0] := strToInt(playerForm.players[0].settings[0]);
integers[1] := strToInt(playerForm.players[0].settings[1]);
integers[2] := strToInt(playerForm.players[0].settings[2]);
integers[3] := strToInt(playerForm.players[0].settings[3]) * 60 * 1000;
integers[4] := strToInt(playerForm.players[0].settings[4]);
booleans[0] := strToBool(playerForm.players[0].settings[5]);
end;
end;
procedure SetupScreen(); // Sets mainScreen angle, height, and zoom to SRL standards
begin
if (not isLoggedIn()) then exit();
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
mainscreen.setZoom(true);
exitTreasure();
closePollWindow();
end;
procedure BreakHandler(); // Handle breaking using a TTimeMarker
var
breakTime: integer;
begin
if (not isLoggedIn()) then exit();
if (not players[0].booleans[0]) then exit();
if (players[0].integers[4] = 0) then exit();
if (breakTimer.getTime() < players[0].integers[3]) then exit();
breakTime := (players[0].integers[4] + randomRange( - 7, 17)) * 60 * 1000;
writeLn('BREAKHANDLER: Breaking for ' + toStr(breakTime / 60 / 1000) + ' minutes');
players[currentPlayer].logout();
wait(breakTime);
numOfBreaksDone += 1;
totalBreakTime += breakTime;
breakTimer.start();
players[currentPlayer].login();
SetupScreen();
end;
function lodeTele(location: integer): boolean; // Teleport to the given lodestone
begin
if (not isLoggedIn()) then exit();
result := lodestoneScreen.teleportTo(location);
if (result) then
begin
wait(gaussRangeInt(16000, 22000));
telesDone += 1;
end;
end;
function walkThePath(path: TPointArray): boolean; // Use SPS to walk the given path
begin
if (not isLoggedIn()) then exit();
result := SPS.walkPath(path);
if (result) then minimap.waitPlayerMoving();
end;
function useBank(): boolean; // Open the bank and deposit/withdraw ore with preset 1
var
bankTimer: TTimeMarker;
bankTimer2: TTimeMarker; (* ~TM - What is this marker used for? *)
begin
if (not isLoggedIn()) then exit();
bankTimer.start();
bankTimer2.start();
while ((bankTimer.getTime() < randomRange(15000, 20000)) and (not result)) do
begin
if (not bankScreen.open(BANK_CHEST_LUMBRIDGE)) then
sleepAndMoveMouse(randomRange(250, 2250))
else
begin
result := bankScreen.clickButton(BANK_BUTTON_PRESET_1);
if (result) then wait(gaussRangeInt(250, 450));
end;
wait(randomRange(50, 200));
end;
end;
function findFurnace(): boolean; // Locate and click on the furnace
var
i: integer;
p: TPoint; (* ~TM - What is this used for? *)
TPA: TPointArray;
ATPA: T2DPointArray;
begin
findColorsTolerance(TPA, 7967894, mainScreen.getBounds(), 5, colorSetting(2, 0.76, 0.32));
ATPA := splitTPAEx(TPA, 10, 10); (* ~TM - could use SRL-6's TPA.split(w, h) overload *)
sortATPAFromSize(ATPA, 0, false);
SmartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if (isMouseOverText(['melt'], gaussRangeInt(350, 650))) then
begin
fastClick(MOUSE_LEFT);
wait(randomRange(100, 500));
smallRandomMouse();
smartImage.clear();
minimap.waitPlayerMoving();
exit(true); (* ~TM - Might be best to return true if production screen is found *)
end;
end;
end;
function smeltOre(): boolean; // Smelt ore and perform antiban while waiting
var
waitTimer: TTimeMarker;
begin
if (not isLoggedIn()) then exit();
waitTimer.start();
repeat
mouseSpeed := gaussRangeInt(18, 22);
if (productionScreen.isOpen((gaussRangeInt(1750, 2250)))) then
begin (* ~TM - If production screen never opened, wait 45 sec? *)
productionScreen.clickStart();
repeat
wait(gaussRangeInt(100, 300));
mouseSpeed := gaussRangeInt(25, 30);
case (random(300)) of
0..30: sleepAndMoveMouse(randomRange(250, 2250));
31: pickUpMouse();
32: hoverSkill(SKILL_SMITHING);
33..40:
begin
mouseOffClient(OFF_CLIENT_LEFT);
if (random(50) = 0) then wait(randomRange(30000, 120000))
else wait(randomRange(3000, 12000));
end;
end;
until (not progressScreen.isOpen());
numSmelted += players[0].integers[1];
loadsDone += 1;
result := true;
end;
until ((tabBackpack.count <= players[0].integers[1] + 1) or (waitTimer.getTime > 45000));
end;
procedure ProgRep(); // Print a progress report to the Simba debug console
var
profit, profitPh, smeltedPh: integer;
begin
profit := (players[0].integers[2] * numSmelted);
profitPh := round(profit * 3600 / (getTimeRunning() / 1000));
smeltedPh := round(numSmelted * 3600 / (getTimeRunning() / 1000));
writeLn(#13#10 + '????????????????????????????????????');
writeLn(PadR('? Inc''s Lumby Smelter v' + VERSION, 37) + '?');
writeLn('????????????????????????????????????');
writeLn(PadR('? Loads done - ' + toStr(loadsDone), 37) + '?');
writeLn(PadR('? Smelted - ' + toStr(numSmelted), 37) + '?');
writeLn(PadR('? Smelted/hr - ' + toStr(smeltedPh), 37) + '?'); (* ~TM - Nice proggy ;) *)
writeLn(PadR('? Profit - ' + toStr(profit), 37) + '?');
writeLn(PadR('? Profit/hr - ' + toStr(profitPh), 37) + '?');
writeLn(PadR('? Recoveries - ' + toStr(telesDone), 37) + '?');
writeLn(PadR('? Breaks Taken - ' + toStr(numOfBreaksDone), 37) + '?');
writeLn(PadR('? Break Time - ' + toStr(msToTime(totalBreakTime, TIME_ABBREV)), 37) + '?');
writeLn(PadR('? Total Time - ' + timeRunning(TIME_ABBREV), 37) + '?');
writeLn('????????????????????????????????????' + #13#10);
end;
begin
ClearDebug();
pathLodeToBank := [Point(169, 258), Point(153, 226), Point(125, 192), Point(109, 155), Point(86, 117)];
pathBankToFurn := [Point(88, 118), Point(132, 125)];
pathFurnToBank := [Point(132, 125), Point(88, 118)];
smartEnableDrawing := true;
smartShowConsole := false; (* ~TM - I hate that console :D *)
disableSRLdebug := true;
InitPlayerForm();
RunPlayerForm();
if (not playerForm.isScriptReady) then exit;
DeclarePlayers();
SetupSRL();
ClearDebug();
SPS.setup('LUM_FUR_MAP', RUNESCAPE_OTHER);
spsAnyAngle := false; (* ~TM - False by default, could have saved a line *)
breakTimer.start();
while (true) do // Main loop, the infinite "true" loop is broken by line 245
begin
if (not isLoggedIn()) then players[currentPlayer].login();
SetupScreen();
if (not walkThePath(pathLodeToBank)) then lodeTele(LOCATION_LUMBRIDGE);
telesDone := 0; // Required else it will start at -1 recoveries done
if (walkThePath(pathLodeToBank)) then
repeat (* ~TM - Indentation *)
if (not useBank()) then
break();
if (not minimap.setAngle(gaussRangeInt(326, 330))) then
if (not walkThePath(pathBankToFurn)) then // Try walking
break();
wait(gaussRangeInt(200, 400));
if (not findFurnace()) then
break()
else if (not smeltOre()) then
break();
if (not minimap.setAngle(gaussRangeInt(10, 35))) then
if (not walkThePath(pathFurnToBank)) then // Try walking
break();
wait(gaussRangeInt(200, 400));
ProgRep();
BreakHandler();
until (numSmelted >= players[0].integers[0]) or (not isLoggedIn());
if (numSmelted >= players[0].integers[0]) then break();
end;
if (isLoggedIn()) then players[currentPlayer].logout();
ProgRep();
end.
Undorak7
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | A legit 250 lines |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 17/20 | A few bits and pieces (see comments) |
|------------------- --------- ------------------------------------------------|
| o Original Code | 7/10 | That equation though :o |
|------------------- --------- ------------------------------------------------|
| o Presentation | 10/15 | A few missing (), unused variables, capitals |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 12/15 | Unnecessary terminates in places |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 9/10 | That paint! |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 9/10 | Small error in checkBoxDefaults |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 10/10 | You got it down, son. |
|------------------- --------- ------------------------------------------------|
| o Comments | 4/5 | Adequate. Missing some credits? |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 4/5 | Blindwalk/walkToPos (could have used overload) |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 82/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: xx/100 (A-) |
|-----------------------------}
program UndoraksVeganFeeder5000;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
{--------------------------- Script Instructions ------------------------------}
{--------------------- Place the image in Simba/Scripts -----------------------}
{------------ To make the script faster, Start with Empty inventory -----------}
{-------------------------- Global Vars ---------------------------------------}
var
CabbagePicked, BarSetUp, scriptPaintBMP, BreaksTaken: integer; (* ~TM - Capital on ScriptPaintBMP *)
Breaktimer: TTimeMarker;
{------------------------------------------------------------------------------}
procedure initPlayerForm();
begin
with playerForm do
begin (* ~TM - Length checkBoxDefaults is 4 instead of 5 *)
name := 'SRL Player Form ~ UCabbage';
checkBoxLabels := ['Enable SRL debug', 'Draw on SMART', 'Eat Cabbages', 'Is Action bar Set Up?', 'Do Breaks?'];
checkBoxDefaults := ['False', 'False', 'False', 'False'];
checkBoxHints := ['print stuff on simba DEBUG?', 'Do you want do draw some debug information on SMART?', 'If we dont eat them, we bank them', 'Have you put a Cabbage on Actionbar Slot 1?', 'Do Breaks?'];
end;
end;
{------------------------------------------------------------------------------}
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
booleans[0] := strToBool(playerForm.players[i].settings[0]); {SRL Debug}
booleans[1] := strToBool(playerForm.players[i].settings[1]); {Draw On Smart}
booleans[2] := strToBool(playerForm.players[i].settings[2]); {Eat Cabbage}
booleans[3] := strToBool(playerForm.players[i].settings[3]); {Actionbar Set}
booleans[4] := strToBool(playerForm.players[i].settings[4]); {Do Breaks?}
end;
end;
{------------------------------------------------------------------------------}
procedure ProgressReport();
var
PickedPerHour: integer; (* ~TM - Local vars first letter lowercase please *)
begin
PickedPerHour := round((CabbagePicked * 60) / (getTimeRunning() / 60000));
if players[currentPlayer].booleans[0] then
Writeln('*****Progress Report*******') {We do this to separate the proggy from al the SRL debug crap}
else ClearDebug;
writeLn('Time Run: ' + timeRunning + ' Breaks Taken: ' + inttostr(breakstaken));
writeLn('Cabbages : ' + intToStr(CabbagePicked) + ' Per Hour: ' + intToStr(PickedPerHour));
smartImage.clear;
smartImage.drawBitmap(scriptPaintBMP, Point(3, 461));
smartImage.drawText(ToStr(TimeRunning), Point(132, 547), 'smallChars', true, clWhite);
smartImage.drawText(IntToStr(floor(cabbagepicked / Pow(10, 3 * Max(Min(Floor((log10(Max(cabbagepicked, 1)) - 1) / 3), 2), 0)))) + TCharArray([' ', 'K', 'M'])[Min(Floor((log10(Max(cabbagepicked, 1)) - 1) / 3), 2)], Point(134, 569), 'smallChars', true, clWhite);
smartImage.drawText(intToStr(PickedPerHour), Point(287, 569), 'smallChars', true, clWhite);
end;
{------------------------------------------------------------------------------}
procedure Antiban(rand: integer);
var
i: integer
begin
i := random(rand); (* ~TM - No need for 'i' here: case random(rand) of ... save 3 lines *)
case i of
0..12: smallRandomMouse(500 + random(150));
13..25: sleepAndMoveMouse(randomRange(600, 5500));
26..28: wait(randomRange(5000, 7000));
29..40: pickUpMouse();
end;
end;
{------------------------------------------------------------------------------}
procedure FreeBMP();
begin
freeBitmap(scriptPaintBMP);
end;
{------------------------------------------------------------------------------}
procedure Breaks();
begin
smartImage.drawText('Currently Breaking', point(2, 52), upChars, false, 16777215);
players[currentPlayer].logout();
inc(BreaksTaken);
Wait(randomrange(600000, 1200000)); {10-20 minutes}
breaktimer.reset();
Breaktimer.start();
end;
{------------------------------------------------------------------------------}
function UndorakObjectFinder(hue, sat: extended; W, H, colour, tolerance, clickType: integer; mouseOverText, chooseOptions: array of string): boolean;
var
x, y, i: integer;
p: Tpoint; (* ~TM - What is this for? *)
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then exit;
mainScreen.setAngle(MS_ANGLE_HIGH);
if minimap.waitPlayerMoving() then
begin
if not (findColorsSpiralTolerance(x, y, TPA, colour, mainScreen.getBounds(), tolerance, colorSetting(2, hue, sat))) then
exit(false);
ATPA := TPA.cluster(W, H);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
Antiban(1000);
if players[currentPlayer].booleans[1] then
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
if random(10) = 1 then (* ~TM - I like this ;) *)
missMouse(middleTPA(ATPA[i]), true)
else mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(mouseOverText, 500) then
begin
if random(20) = 4 then
begin
fastClick(MOUSE_RIGHT);
Result := chooseOption.select(chooseoptions);
break;
end;
fastClick(clickType);
result := True;
break;
end;
end;
if players[currentPlayer].booleans[1] then
smartImage.clearArea(mainscreen.getBounds());
Antiban(400);
tabBackPack.waitForShift(randomrange(3000, 4000));
claimSpinTicket();
closeAdWindow();
progressreport; (* ~TM - () () () *)
end;
end;
{------------------------------------------------------------------------------}
procedure PickUpCabbages;
var
pickTimer: TTimeMarker;
begin (* ~TM - Consistency with these 1 liners pl0x *)
if not isLoggedIn() then
exit; (* ~TM - could just use the overload that uses current pos as default 2nd param *)
if not sps.walkToPos(point(192, 185), sps.getPlayerPos()) then
begin
Writeln('Script Failed: Running To Cabbages, maybe we are not at lumbridge?');
TerminateScript; (* ~TM - Well that escalated quickly! *)
end;
picktimer.start;
repeat
if UndorakObjectFinder(0.28, 1.11, 5, 5, 7785658, 6, MOUSE_LEFT, ['abbage', 'Cabbage'], ['ick', 'Pick']) then
begin (* ~TM - No need for this begin/end *)
inc(CabbagePicked);
end else sps.walkToPos(point(192, 185), sps.getPlayerPos()); {Cabbage point}
until TabBackPack.isFull or (pickTimer.getTime() > 120000);
end;
{------------------------------------------------------------------------------}
procedure BankStuff;
var
x, y: integer; (* ~TM - What are these used for? *)
Banktimer: TTimemarker; (* ~TM - Local vars first letter lowercase please *)
begin
if not isLoggedIn() then
exit;
if not sps.blindWalk(point(309, 259)) then
begin
Writeln('Failed Running To Bank');
TerminateScript; (* ~TM - Well that escalated quickly! *)
end; (* ~TM - You should use bankScreen.open(BANK_CHEST_LUMBRIDGE) as it has some extra checks *)
if bankScreen.__openChest(BANK_CHEST_LUMBRIDGE) then
begin
bankTimer.start();
repeat
if bankscreen.isOpen(4000) then
begin
if (bankscreen.getPackCount() > 1) then
begin
wait(randomrange(500, 700));
bankScreen.quickDeposit(QUICK_DEPOSITBOX_INVENTORY);
Antiban(1000);
bankscreen.close; (* ~TM - () () () *)
end else bankscreen.close;
end else exit;
until (not isLoggedIn()) or (bankTimer.getTime() > 15000);
end;
end;
{------------------------------------------------------------------------------}
procedure setupBar;
begin
tabBackpack.mouseSlot(1, MOUSE_MOVE);
if isMouseOverText(['abbage', 'Cabbage'], 500) then
dragMouse(actionBar.getSlotBox(1).getRandomPoint) (* ~TM - Indentation *)
else exit;
actionBar.lock(); (* ~TM - What if it's locked at the start and you can't add items? *)
inc(BarSetUp);
end;
{------------------------------------------------------------------------------}
procedure EatCabbages();
var
EatTimer: TTimeMarker; (* ~TM - pls i crey evertim *)
begin
if not isLoggedIn() then exit;
if players[currentPlayer].booleans[3] or (BarSetUp >= 1) then
Writeln('Bar is already Set Up Sir !')
else SetupBar; (* ~TM - pls () *)
EatTimer.start; (* ~TM - pls () *)
if not (actionBar.isSlotEmpty(1)) then
repeat
wait(randomrange(200, 400));
antiban(3000);
sendKeys('1', 15 + RandomRange(150, 200), 20 + RandomRange(40, 50));
until tabBackPack.isEmpty() or (EatTimer.getTime() > 90000);
if not tabBackPack.isEmpty() then
tabBackpack.dropItems();
end;
{------------------------------------------------------------------------------}
procedure mainLoop();
begin
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune(); (* ~TM - exitTreasure() *)
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.clickCompass; (* ~TM - High angle after compass ;) *)
end;
if tabBackpack.isFull() then
begin
if players[currentPlayer].booleans[2] then
EatCabbages (* ~TM - pls () *)
else bankstuff; (* ~TM - pls pls () *)
end;
progressreport; (* ~TM - pls pls pls () *)
PickUpCabbages; (* ~TM - pls pls pls pls () *)
if breakTimer.getTime() >= (randomrange(3600000, 5400000)) then
breaks;
until (false);
end;
{------------------------------------------------------------------------------}
begin
SmartEnableDrawing := true;
scriptPaintBMP := loadBitmap(appPath + '/Scripts/VeganFeeder5000.png');
addOnTerminate('freeBMP');
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then exit;
setupSRL();
declarePlayers();
if players[currentPlayer].booleans[0] then
disableSrlDebug := False (* ~TM - But it's false by default, so no need for the else *)
else disableSrlDebug := True;
SPS.setup('CABBAGE_MAP', RUNESCAPE_OTHER);
Breaktimer.start();
mainLoop;
end.
Akarigar
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | A few 'borderline' lines |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 19/20 | You got it down! Player switching and all |
|------------------- --------- ------------------------------------------------|
| o Original Code | 10/10 | Some very unique solutions |
|------------------- --------- ------------------------------------------------|
| o Presentation | 13/15 | 1 line variable declarations :/ |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 15/15 | Nice ;) |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 8/10 | Could be a bit 'prettier' with food & xp/hour |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 10/10 | Nide and clean, made use of multiplayer |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 8/10 | Yes, nothing too fancy |
|------------------- --------- ------------------------------------------------|
| o Comments | 3/5 | Could have explained a few of the methods |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 4/5 | Walkpath with a blindwalk failsafe |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 90/100 | // Highest overall A+ ;)
|-----------------------------|
| ** Weighted at | 0.9 | (Worked for facebook,
|------------------- ---------| developed battlefield 3
| FINAL GRADE: 81/100 (A-) | and teaches at university)
|-----------------------------}
program NoobOMaticChef;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i srl-6/lib/misc/srlplayerform.simba}
{$i SPS/lib/sps-rs3.simba}
{* Set cooking range's default to correct food, set preset #1 to 28 raw food. *}
const
P_SAFE_LEVEL := 0;
P_XP_PER_ITEM := 1;
P_NEXT_BREAK := 2;
P_BREAK_COUNT := 3;
P_COOK_COUNT := 4;
P_LOAD_COUNT := 5;
FAIL_MAX := 25;
type TBoolFunction = function(): Boolean;
type TArea = record (* ~TM - Nice to see use of records *)
pathToBank, pathToObject: TPointArray;
objectText: TStringArray;
objectColorSetting: TColorSettings;
bankType, location, objectSymbol, objectColor, objectTol: Integer;
bankFunction, objectFunction: TBoolFunction;
end;
function TArea.loadLocation(location: Integer): Boolean; forward;
var area: TArea;
function getRandomPercentage(value: Integer; percentage: Extended = 0.1): Integer;
var delta: Integer; (* ~TM - Same line not exactly 'best practice' :p *)
begin
delta := Round(value * percentage);
Exit(RandomRange(value - delta, value + delta));
end;
procedure takeBreak();
begin
if isLoggedIn() then players[currentPlayer].exitToLobby();
players[currentPlayer].integers[P_NEXT_BREAK] := getRandomPercentage(3600000); // 1h * 60min/h * 60s/min * 1000ms/s
Inc(players[currentPlayer].integers[P_BREAK_COUNT]);
WriteLn('Taking a break for ~5 mins..');
Wait(getRandomPercentage(300000)); // 5mins * 60s/min * 1000ms/s
end;
function goCloser(symbol: Integer; dist: Integer = 10): Boolean;
var p: TPoint;
begin
if not minimap.findSymbol(p, symbol, minimap.getBounds()) then Exit(False);
if distance(p, minimap.getCenterPoint()) > dist then Exit(False);
mouse(p, mouse_Left);
Exit(minimap.waitPlayerMoving());
end
function walkTo(symbol: Integer; path: TPointArray): Boolean;
begin
Exit(sps.walkPath(path) or sps.blindWalk(path[high(path)]) or goCloser(symbol));
end;
function randomlyWait(min: Integer = 500; max: Integer = 1000): Boolean;
begin
Wait(RandomRange(min, max));
Exit(True);
end;
function loadPreset(): Boolean;
var i: Integer = 0;
begin
while (randomlyWait()) and (not bankScreen.open(area.bankType)) and (Inc(i) < FAIL_MAX) do;
if i >= FAIL_MAX then minimap.setAngle(MM_DIRECTION_WEST);
while (i >= FAIL_MAX) and (i < FAIL_MAX * 2) and (randomlyWait()) and (not bankScreen.open(area.bankType)) and (Inc(i) < FAIL_MAX) do;
if i >= FAIL_MAX * 2 then Exit(False);
i := 0;
while (randomlyWait()) and (not bankScreen.clickButton(BANK_BUTTON_PRESET_1)) and (Inc(i) < FAIL_MAX) do;
Exit((randomlyWait(750, 1000)) and (i < FAIL_MAX) and (tabBackpack.isFull()));
end;
function useObject(): Boolean;
var
i, x, y: Integer;
objectPoints: TPointArray;
matchingObjects: T2DPointArray;
begin
if not findColorsSpiralTolerance(x, y, objectPoints, area.objectColor, mainscreen.getBounds(), area.objectTol, area.objectColorSetting) then
Exit(False);
matchingObjects := objectPoints.toATPA(50);
matchingObjects.sortFromMidPoint(mainscreen.playerPoint);
(* ~TM - (not randomlyWait()) will always return false *)
for i:= 0 to high(matchingObjects) do // if you want to wait everytime, mouseOverText
begin // has a waitTime parameter *)
mouseBox(matchingObjects[i].getBounds());
if isMouseOverText(area.objectText) or (not randomlyWait()) then
begin (* ~TM - indentation *)
fastClick(mouse_Left);
Exit(randomlyWait() and minimap.waitPlayerMoving());
end;
end;
Exit(False);
end;
function cookFood(): Boolean;
var i, x, y: Integer = 0;
begin
while (randomlyWait()) and (not useObject()) and (Inc(i) < FAIL_MAX) do;
if i >= FAIL_MAX then Exit(False);
i := 0;
while (randomlyWait(1000, 1500)) and (not productionScreen.clickStart()) and (Inc(i) < FAIL_MAX) do;
if (i >= FAIL_MAX) or (not tabBackpack.waitSlotPixelChange(28, gaussRangeInt(110000, 1300000)))
then Exit(False); (* ~TM - 21 minute wait? *)
Inc(players[currentPlayer].integers[P_LOAD_COUNT]);
Inc(players[currentPlayer].integers[P_COOK_COUNT], tabBackpack.count() - 1);
if not findColor(x, y, 65535, tabBackpack.getBounds()) then Inc(players[currentPlayer].integers[P_COOK_COUNT]);
if (area.location = LOCATION_LUMBRIDGE) and (Random() > 0.75) and (randomlyWait()) and
(tabStats.getSkillLevel(SKILL_COOKING) >= players[currentPlayer].integers[P_SAFE_LEVEL]) then
Exit(area.loadLocation(LOCATION_AL_KHARID));
Exit(True);
end;
function goAndDo(symbol: Integer; path: TPointArray; toDo: TBoolFunction): Boolean;
begin
Exit(walkTo(symbol, path) and toDo());
end;
procedure doAntiBan();
var max: Integer = 7500;
begin
if minimap.isPlayerMoving() then max := 5000;
case Random(200) of
1..50: mouseOffClient(OFF_CLIENT_RANDOM);
51..80: sleepAndMoveMouse(gaussRangeInt(0, Round(max / 2)));
81..89: pickUpMouse();
90..100: hoverSkill(SKILL_COOKING)
end;
Wait(gaussRangeInt(0, max));
end;
function TArea.loadLocation(location: Integer): Boolean;
begin
if location = Self.location then Exit(True) (* ~TM - Getting a bit naughty here *)
else if not (lodestoneScreen.teleportTo(location) and randomlyWait(15000, 17000)) then Exit(False);
Self.bankFunction := @loadPreset;
Self.objectFunction := @cookFood;
Self.objectSymbol := MM_SYMBOL_COOKING_RANGE;
Self.location := location;
Self.objectText := ['Cook-at', 'ook', '-at', 'range'];
case location of
LOCATION_AL_KHARID:
begin
Self.bankType := BANK_NPC_GREEN;
Self.objectColor := 3029703;
Self.objectColorSetting := colorSetting(2, 0.17, 2.07);
Self.objectTol := 8;
Self.pathToBank := [Point(393, 179), Point(415, 179), Point(386, 238)];
Self.pathToObject := [Point(386, 238), Point(415, 179), Point(393, 179)];
end;
LOCATION_LUMBRIDGE:
begin
Self.bankType := BANK_CHEST_LUMBRIDGE;
Self.objectColor := 2451907;
Self.objectColorSetting := colorSetting(2, 0.35, 1.71);
Self.objectTol := 4;
Self.pathToBank := [Point(100, 264), Point(134, 263), Point(182, 263), Point(179, 216), Point(153, 187), Point(134, 166), Point(118, 122), Point(99, 100)];
Self.pathToObject := [Point(99, 100), Point(118, 122), Point(134, 166), Point(153, 187), Point(179, 216), Point(182, 263), Point(134, 263), Point(100, 264)];
end;
end;
Exit(True);
end;
function showProgress(): Boolean
begin
with players[currentPlayer] do
begin
WriteLn('NoobOMatic Chef: ', nickname, ' --- Finished loads: ', integers[P_LOAD_COUNT]);
WriteLn('Food burned/cooked: ', integers[P_LOAD_COUNT] * 28 - integers[P_COOK_COUNT], '/', integers[P_COOK_COUNT]);
WriteLn('XP Gained: ', integers[P_COOK_COUNT] * integers[P_XP_PER_ITEM], ' & Breaks Taken: ', integers[P_BREAK_COUNT]);
end;
Exit(True); (* ~TM - I crey evertim when i no c my xp hour ;( *)
end;
procedure runLoop();
var timer: TTimeMarker;
begin
SRL_Events[EVENT_ANTIBAN] := @doAntiBan;
while players.getActive() > 0 do
begin
if not isLoggedIn() then players[currentPlayer].login();
exitTreasure();
mainscreen.setAngle(MS_ANGLE_HIGH);
timer.start();
with players[currentPlayer] do
begin
if tabStats.getSkillLevel(SKILL_COOKING) >= integers[P_SAFE_LEVEL]
then isActive := area.loadLocation(LOCATION_AL_KHARID)
else isActive := area.loadLocation(LOCATION_LUMBRIDGE);
(* ~TM - very creative ;) *)
while isLoggedIn() and isActive and ((not booleans[0]) or (timer.getTime() <= integers[P_NEXT_BREAK])) do
isActive := showProgress() and
goAndDo(MM_SYMBOL_BANK, area.pathToBank, @area.bankFunction) and
goAndDo(area.objectSymbol, area.pathToObject, @area.objectFunction);
// If we're active so far, everything is good and we just need to take a break.
if players[currentPlayer].isActive then takeBreak()
else if players.getActive() > 0 then players.next(false);
end;
if isLoggedIn() then players[currentPlayer].logout();
timer.reset();
end;
end;
procedure declarePlayers();
var i: Integer;
begin
players.setup(playerForm.players);
for i := 0 to high(players) do
with players[i] do
begin
booleans[0] := StrToBool(playerForm.players[i].settings[2]);
integers[P_SAFE_LEVEL] := StrToInt(playerForm.players[i].settings[0]);
integers[P_XP_PER_ITEM] := StrToInt(playerForm.players[i].settings[1]);
integers[P_NEXT_BREAK] := getRandomPercentage(3600000); // 1h * 60min/h * 60s/min * 1000ms/s
end;
end;
procedure initPlayerForm();
begin
playerForm.name := 'Noob-O-Matic Chef Settings';
playerForm.editBoxLabels := ['Cooking level to stop burning', 'XP gained per item'];
playerForm.editBoxDefaults := ['32', '30'];
playerForm.editBoxHints := ['Use 0 if you wish to cook in Al Kharid or if the food you want to cook does not benefit from the Cook-o-matic', 'For progress reports'];
playerForm.checkBoxLabels := ['Take ~5 min breaks around every hour?'];
playerForm.checkBoxDefaults := ['True'];
playerForm.checkBoxHints := ['Should I take breaks after playing around an hour?'];
end;
begin
ClearDebug();
initPlayerForm();
runPlayerForm();
if not playerForm.isScriptReady then Exit;
declarePlayers();
sps.setup('NOOB_O_MATIC_CHEF', RUNESCAPE_OTHER);
if setupSRL() then runLoop();
end.
// THE END...
Trollcrank
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | Yes Sir! |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 15/20 | A few issues throughout (see comments) |
|------------------- --------- ------------------------------------------------|
| o Original Code | 8/10 | Bank to heal/universal search Box/breaks |
|------------------- --------- ------------------------------------------------|
| o Presentation | 13/15 | Very nice, with minor errors ;) |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 11/15 | Unnecessary termiantes |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 8/10 | All there. Could be 'fancier' with p/h |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 7/10 | Had SPF + consts. Don't need both |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 7/10 | Massive custom function (errors within) |
|------------------- --------- ------------------------------------------------|
| o Comments | 4/5 | Needed to explain getColor() |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 3/5 | Got the walkPath going |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 76/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 76/100 (B+) |
|-----------------------------}
program WarriorWar; //Kills Al Kharid Warriors.
{$DEFINE SMART} //Start with gear equiped in the Al Kahrid Bank.
{$i srl-6/srl.simba}
{$I SPS/LIB/SPS-RS3.simba}
{$i SRL-6/LIB/MISC/SRLPLAYERFORM.simba}
const
{Retreat if the script is stopped?}
RunForest = False;
(* ~TM - Not including these in the SPF defeats the purpose! *)
{Stop SRL message to the debug box?}
DisableSpam := True;
{Al Kharid Warrior Colors}
WarrColor = 9039084;
WarrTol = 3;
WarrHue = 0.22;
WarrSat = 1.41;
{DON'T TOUCH ANYTHING BELLLOW THIS//////////////////////////////////}
var
Kills: integer
procedure initPlayerForm();
begin //Strongly modeled off of Coh3n's guide.
with playerForm do
begin
name := 'WarriorWar';
scriptHelpThread := ''; //Link to a SRL Player Form setup guide.
editBoxLabels := ['Login World', 'Retreat health percent?', 'Max fighting time in seconds'];
editBoxDefaults := ['0', '60', '300'];
editBoxHints := ['0 selects the default world.', 'Run to heal at what health percent?', 'Extra failsafe to run that prevents infinite repeating.'];
end;
end;
procedure declarePlayers();
var //Strongly modeled off of Coh3n's guide.
i: integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
(* ~TM - Good stuff with the form, pitty you didn't include the consts *)
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]);
integers[2] := strToInt(playerForm.players[i].settings[2]);
end;
end;
procedure FindRandoms();
begin //Closes runescape pay extra money advertisements.
claimTicket();
exitTreasure();
end;
procedure Antiban(rate: Integer);
begin //A chance to execute measures to help decrease any ban rate.
case random(rate) of
15: pickUpMouse();
30: boredHuman(false);
45: mouseMovingObject();
60..63: sleepAndMoveMouse(randomRange(500,7000));
75: wait(RandomRange(1000,15000));
90: begin
mouseOffClient(Random(4)); (* ~TM - Could use the constant *)
wait(randomRange(1800, 12000));
end;
115: mouseBox([0, 0, 575, 386]);
end;
end;
procedure ProgressReport();
begin
clearDebug;
writeLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
writeLn('A total of: ' + intToStr(Kills) + ' warriors have died.');
writeLn('Experience gained: ' + intToStr(Kills*36) + ''); (* ~TM - Why the '' *)
writeLn('Roughly: ' + intToStr(Kills*12) + ' Constitution exp has been gained.'); (* ~TM - Would have liked per/h calcs *)
writeLn('Total Expience gained: ' + intToStr(Kills*48) + '');
writeLn('Time running: ' + MsToTime(getTimeRunning(), TIME_ABBREV) + '');
writeLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
end;
procedure ToBattle();
var //Walks to the soldiers.
PathToBattle: TPointArray;
begin (* ~TM -No need to assign the TPA to a variable here *)
if SPS.walkPath(PathToBattle := [Point(89, 291), Point(103, 285), Point(104, 265), Point(109, 250), Point(115, 230), Point(126, 224), Point(145, 222), Point(164, 222), Point(178, 231), Point(183, 247), Point(184, 270)]) then
minimap.waitPlayerMoving()
else
TerminateScript; (* ~TM - Well that escalated quickly *)
end;
function Fighting: boolean;
begin //Determines if fighting.
result := (getColor(33, 12) = 1675987); (* ~TM - What is at point(33, 12) ? Is this the lock? *)
end;
function ObjectFinder(SearchRange, LClickChance, col, tol: integer; hue, sat: extended; incSpeed, filter: boolean; mouseTxt, Roptions: array of string): boolean;
var //Custom object locater.
RR, o, i, x, y: integer;
TPA: TPointArray;
ATPA: T2DPointArray; //Example: ObjectFinder(1, 80, 354324, 5, 0.00, 0.00, true, true, ['Attack'], ['Al Khari','id warr']);
bounds: tbox; //search bounds, Left click rate, color, tolerance, hue, sat, increase mouse speed, filter colors, mouseovertext, Choose options
begin
RR := gaussRangeInt(1, 100); (* ~TM - would this be better if it was randomRange? *)
case SearchRange of
1: bounds:= [0, 0, 575, 387]; //Mainscreen, with smallest chatbox
2: bounds:= [582, 325, 795, 561]; //TabBackPack
3: bounds:= [576, 13, 796, 195]; //Minimap
4: bounds:= [3, 532, 557, 575]; //Chatbox, starts at above where the player types and bellow the chat filters.
end;
findColorsSpiralTolerance(x, y, TPA, col, bounds, tol, colorSetting(2, hue, sat));
if incSpeed then
mouseSpeed := 27 + random(15); (* ~TM - After doing this once, mouseSpeed will always be high (you never reset it) *)
if filter then
filterTPAsBetween(ATPA, 0, 10); (* ~TM - But you haven't made the ATPA yet ;) *)
ATPA := TPA.toATPA(25, 25);
case random(11) of
0..7: ;
8..10: ATPA.sortFromMidPoint(mainscreen.playerPoint);
end;
for i := 0 to high(ATPA) do (* ~TM - You do know that 0 <> o (o is 0 in this case because you didn't assign anything to it) *)
mouseBox(ATPA[o].getbounds, mouse_move); //o for object
(* ~TM - Object might not be first in the array *)
if (isMouseOverText(mouseTxt)) then
begin
Result := True;
if (RR) < (LClickChance) then
begin //if (RR = 1 to 100) is less than (LClickChance) then left click.
fastClick(MOUSE_LEFT);
writeLn('Left clicking object.');
end else
begin
fastClick(MOUSE_RIGHT);
wait(RandomRange(0,500));
if chooseOption.select(Roptions) then
writeLn('Found object, choosing option to continue.');
end;
end;
end;
procedure ClickClack();
var //Locates and initiates fighting, used in a loop.
TimeLimit: integer;
StopTimer: TTimeMarker; (* ~TM - First letter lowercase for local vars pls *)
begin
TimeLimit := (players[currentPlayer].integers[2] * 1000 + (randomRange(0, 6000))); //Miliseconds conversion
StopTimer.start();
repeat
if ObjectFinder(1, 80, WarrColor, WarrTol, WarrHue, WarrSat, true, true, ['Attack'], ['Al Khari','id warr']) then
inc(Kills);
repeat
minimap.waitPlayerMoving();
wait(randomRange(100, 800));
Antiban(161);
until (Not Fighting()) or (ActionBar.GetHPpercent() <= players[currentPlayer].integers[1]);
ProgressReport(); //Run at what % of hp
until (StopTimer.getTime() > TimeLimit) or (ActionBar.GetHPpercent() <= players[currentPlayer].integers[1]);
end;
function FullyHealed: boolean;
var //Checks if at full health. This is used while in a bank, health heals in banks.
HealthTimer: TTimeMarker;
begin
HealthTimer.start();
repeat
wait(randomRange(50, 1000));
Antiban(91);
Result := (ActionBar.GetHPpercent() >= 100)
until (ActionBar.GetHPpercent() >= 100) or (HealthTimer.getTime() > 13500);
end;
procedure Retreat();
var //Tatical exit to prevent a meeting with Death and heals at bank.
p: TPoint;
Tatics: TPointArray;
begin (* ~TM -No need to assign the TPA to a variable here *)
if SPS.walkPath(Tatics := [Point(161, 275), Point(190, 272), Point(174, 255), Point(172, 235), Point(161, 226), Point(149, 226), Point(138, 229), Point(128, 231), Point(116, 234), Point(113, 243), Point(105, 255), Point(108, 268), Point(108, 283), Point(88, 292)]) then
minimap.waitPlayerMoving()
else
TerminateScript; (* ~TM - No 2nd attempt at walking? *)
if FullyHealed then (* ~TM - () () () *)
ToBattle()
else begin
if (minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds())) then
begin
writeln('Failed to enter bank, running towards bank minimap symbol.');
mouse(p, MOUSE_LEFT);
minimap.waitFlag(10);
wait(randomRange(3500, 9500));
ToBattle();
end;
end;
end;
procedure RandomBreak();
begin //Human like pause, starts up again near the water trough and warriors.
case random(121) of //Estimated to activate 1 in 10 hours with the default max fighting time.
1: begin
players[currentPlayer].logout();
wait(gaussRangeInt(240000, 1080000)); //4-18 minute break.
end;
end;
end;
begin
ClearDebug();
initPlayerForm();
runPlayerForm();
declarePlayers();
SetupSRL();
if RunForest then (* ~TM - Nice ;) *)
AddOnTerminate('Retreat'); //Prevents death if in battle.
if DisableSpam then
DisableSRLDebug := True;
FindRandoms(); (* ~TM - You're not logged in yet *)
mainScreen.setAngle(MS_ANGLE_HIGH);
SPS.setup('RS Al Kahrid map', RUNESCAPE_OTHER);
ToBattle(); (* ~TM - You're not logged in yet *)
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
wait(randomRange(2000, 5000));
FindRandoms();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;
ClickClack();
Retreat();
ProgressReport();
RandomBreak();
until(false);
end.
Lama
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 16/20 | Could use some srl-6 functions (see comments) |
|------------------- --------- ------------------------------------------------|
| o Original Code | 6/10 | Sufficient |
|------------------- --------- ------------------------------------------------|
| o Presentation | 12/15 | Some naughty parts, but good overall |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 12/15 | Lacks isLoggedIn checks (will break on dc) |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 10/10 | Nice formatted text + smart image proggy |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 7/10 | A few issues in declare players |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 8/10 | Lacks TPA range check |
|------------------- --------- ------------------------------------------------|
| o Comments | 4/5 | Unnecessary SPF comments |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 0/5 | None |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 75/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 75/100 (B+) |
|-----------------------------}
program LamaClockworkAgility;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$i SRL-6/lib/misc/srlplayerform.simba}
const
SCRIPT = 'Lama''s Penguin Clicker';
VERSION = ' v1.0';
var
xpStart, xpCurrent, xpGained, xpPerHour, timeLeft, breakTime, paintBitmap, z, dumbInt: integer;
break, debugSRL, debugSMART, paintProggy: boolean;
progTime, scriptTime: TTimeMarker; (* ~TM - Capital first letter for globals pls *)
windHotK, releaseHotK: string; (* ~TM - Are all of these necessary? You seem to have doubled up with players bool/ints *)
procedure initPlayerForm(); // What is on the playerForm
begin
with playerForm do
begin
name := 'Lama''s Penguin Clicker'; // the title of the SPF, usually the name of your script
scriptHelpThread := 'https://villavu.com/forum/showthread.php?t=110594'; // a link to a help thread, if set to '' will link to my setup guide
editBoxLabels := ['Run Time', 'Break Time', 'Wind Penguin Hotkey', 'Release Penguin Hotkey', 'World'];
editBoxDefaults := ['180', '15', '8', '9', '0'];
editBoxHints := ['How long (in minutes) to run the script? (Before the end, or before each break, depending if you want to break)', 'How long should a break be?', 'Action Bar Hotkey for winding penguins', 'Action Bar Hotkey for releasing wound penguins', 'What world do you want to be on? (Leave at 0 for random)'];
checkBoxLabels := ['Break', 'Paint Proggy', 'SMART Debug', 'Debug SRL']; // same as editBoxLabels but for check boxes
checkBoxDefaults := ['true', 'false', 'false', 'false'];
checkBoxHints := ['Do you want to have breaks?', 'See a report for useful information?', 'Debug SMART?', 'Debug SRL?'];
end;
end;
procedure declarePlayers(); // Declare player and variables from playerForm
var
i: integer;
begin (* ~TM - (playerForm.players) is correct way to do this *)
players.setup(playerForm.playerNames, playerForm.playerFile); // load the SPF players from the SRL Player Manager
currentPlayer := 0; // player to use first
for i := 0 to high(players) do // set player attributes based on the settings from the form
with players[i] do
begin (* ~TM - These should be integers[0] and booleans[0], so you can have more than 1 player + avoid extra global vars *)
timeLeft := strToInt(playerForm.players[i].settings[0]); // How long to run script before ending/breaking
breakTime := strToInt(playerForm.players[i].settings[1]); // How long to break for if to break
windHotK := playerForm.players[i].settings[2]; // Hotkey assignment for winding penguins
releaseHotK := playerForm.players[i].settings[3]; // Hotkey assignment for releasing wound penguins
world := strToInt(playerForm.players[i].settings[4]);
break := strToBool(playerForm.players[i].settings[5]); // To break or not to break, that is the question
paintProggy := strToBool(playerForm.players[i].settings[6]); // Paint proggy image
debugSMART := strToBool(playerForm.players[i].settings[7]); // Debug SMART
debugSRL := strToBool(playerForm.players[i].settings[8]); // Debug SRL
end;
end;
function findNormalRandoms: boolean; // Exits out of common randoms
begin
result := exitSquealOfFortune or claimSpinTicket; (* ~TM - exitTreasure() + claimTicket() *)
end;
procedure antiban(); // Some basic antiban to spice things up
begin
case random(1000) of
0:
begin
tabStats.open(); (* ~TM - Could use hoverSkill(SKILL_AGILITY); *)
mouseBox(tabStats.getSkillBox(SKILL_AGILITY), MOUSE_MOVE);
wait(randomRange(1000, 2250));
tabBackpack.open();
end;
1..10: sleepAndMoveMouse(randomRange(100, 250));
end;
end;
procedure doPenguinStuff(); // Winds, releases, and catches clockwork penguins
begin
mouseOval(randomRange(287, 292), randomRange(190, 200), 3, 4, MOUSE_LEFT); // Moves and clicks randomly in an area around the players knees (where the penguins are)
wait(randomRange(85, 175));
typeSend(releaseHotK, false);
wait(randomRange(65, 100));
fastClick(MOUSE_LEFT);
case (random(20) + 1) of // For extra human-esque hotkeying and clicking, tried to be as spammy
1..5: // as possible
begin // [This area is where to tweak to speed up script, it can be faster]
typeSend(windHotK, false); // <-- Wind penguin
wait(randomRange(75, 145));
fastClick(MOUSE_LEFT);
end;
6..10:
begin
typeSend(releaseHotK, false); // -- Release wound penguin
wait(randomRange(75, 145));
fastClick(MOUSE_LEFT);
end;
11..15: fastClick(MOUSE_LEFT);
16..20:
begin
typeSend(windHotK, false);
wait(randomRange(60, 85));
typeSend(releaseHotK, false);
end;
end;
wait(randomRange(45, 105)); (* ~TM - Surely you could put this in a loop (even with random(..) ) *)
typeSend(windHotK, false);
wait(randomRange(65, 145));
fastClick(MOUSE_LEFT);
wait(randomRange(100, 150));
typeSend(releaseHotK, false);
end;
function penguinsLeft(): boolean; // Checks if there are penguins to pick up before breaking/ending
var
x, y: integer; (* ~TM - No need for this to be a function. Returns true no matter what *)
TPA: TPointArray;
ATPA: T2DPointArray;
begin
findColorsSpiralTolerance(x, y, TPA, 10005418, mainScreen.getBounds(), 14, colorSetting(2, 0.11, 0.45));
mainScreen.filterPointsPlayer(TPA);
if length(TPA) < 1 then
begin
mouseOval(randomRange(287, 292), randomRange(190, 200), 3, 4, MOUSE_MOVE);
result := isMouseOverText(['enguin'], 500);
if result then
fastClick(MOUSE_LEFT);
end else
result := true;
end;
procedure pickUpPenguins(); // Picks up remaining penguins before breaking/logging out
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
findColorsSpiralTolerance(x, y, TPA, 10005418, mainScreen.getBounds(), 14, colorSetting(2, 0.11, 0.45));
mainScreen.filterPointsPlayer(TPA); (* ~TM - You should exit if nothing found, so you don't run into errors *)
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
if debugSMART then
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE); (* ~TM - Why not ['ick, 'ake', enguin'] ? *)
if isMouseOverText(['ick', 'enguin'], 500) or isMouseOverText(['ake', 'enguin'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clearArea(mainScreen.getBounds());
break;
end;
end;
end;
procedure progressReport(); // Outputs a progress report with useful information
begin
if progTime.getTime < 20000 then exit;
smartImage.clear();
xpCurrent := chatbox.getXPBar();
xpGained := xpCurrent - xpStart;
xpPerHour := round(((xpCurrent - xpStart) * 60) / (getTimeRunning() / 60000));(* ~TM - you could use xpGained here, save a calculation *)
if paintProggy then
begin
paintBitmap := loadBitmap(appPath + '\Scripts\lamaPengProggy.png'); (* ~TM - Probably only need to load on start up *)
smartImage.drawBitmap(PaintBitmap, (point(4,426)));
smartImage.drawText((msToTime(getTimeRunning, TIME_ABBREV)), Point(413, 442), UpCharsEx, false, clWhite); // Draw time running
smartImage.drawText(groupDigits((round(xpGained / 12.5)), ',') + ' caught', Point(413, 481), UpCharsEx, false, 1268443); // Draw how many loads completed
smartImage.drawText(groupDigits(xpGained, ',') + ' (' + (groupDigits(xpPerHour, ',')) + ' P/H)', Point(413, 520), UpCharsEx, false, clYellow);
end;
clearDebug();
writeLn('|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|'); (* ~TM - Very nice ;) *)
writeLn('| ' + SCRIPT + VERSION + ' |');
writeLn('|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|');
writeLn(padR('| Time Running: ' + timeRunning, 52) + '|');
writeLn(padR('| Approx. Time Left: ' + msToTime((timeLeft * 60000) - scriptTime.getTime(), TIME_ABBREV), 52) + '|');
writeLn(padR('| Penguins Caught: ' + groupDigits((round(xpGained / 12.5)), ','), 52) + '|');
writeLn(padR('| XP Gained: ' + groupDigits(xpGained, ',') + ' (' + groupDigits(xpPerHour, ',') + ' P/H)', 52) + '|');
writeLn('|___________________________________________________|');
progTime.start();
end;
procedure setup(); // Sets up all preliminary necessaries
begin
clearDebug();
smartEnableDrawing := true;
if debugSMART then
smartShowConsole := true
else
smartShowConsole := false;
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
terminatescript;
declarePlayers();
setupSRL();
if not debugSRL then
disableSRLDebug:=true
else
disableSRLDebug:=false;
dumbInt := 0; // <-- Is used with breaking, see line 210
end;
procedure mainLoop(); // What the script actually does
begin
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
writeLn('Just logged in... waiting for a moment'); wait(randomRange(1000, 3500)); (* ~TM - Naughty *)
end;
if dumbInt < 1 then begin xpStart := chatBox.getXPBar(); dumbInt := 1; end; (* ~TM - Naughter *)
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
mainScreen.setZoom(true);
findNormalRandoms();
scriptTime.start(); // Accurate measurement of productive script runtime (* ~TM - players[currentPlayer].worked.getTime() *)
timeLeft := timeLeft + scriptTime.getTime();
while (scriptTime.getTime() < (timeLeft * randomRange(59000, 61000))) do
begin
progressReport();
doPenguinStuff();
fastClick(MOUSE_LEFT);
antiban();
end;
scriptTime.pause();
minimap.setAngle(MM_DIRECTION_EAST);
mainScreen.setZoom(true);
for z := 0 to 2 do // <-- Stupid Failsafe
repeat
writeLn('Checking for penguins [' + toStr(z + 1) + '/3]');
pickUpPenguins();
wait(randomRange(500, 1000));
until not penguinsLeft();
wait(randomRange(1000, 2000));
progressReport();
players[currentPlayer].exitToLobby();
end;
begin
setup();
if break then (* ~TM - Surely you could call this boolean something else (confusing with reserved word break) *)
begin
while (players.getActive() > 0) do // If to break, will log back in after break time is done
begin
mainLoop();
writeLn('Breaking ...');
wait(breakTime * randomRange(55000, 70000));
scriptTime.reset();
end;
end; (* ~TM - else mainLoop(); *)
if not break then // If not to break, will run until timeLeft runs out, then logs out for good
mainLoop();
writeLn('Logging out ...');
end.
Dr Clemsip
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | Legit 250 lines |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 15/20 | Sufficient |
|------------------- --------- ------------------------------------------------|
| o Original Code | 6/10 | Good use of the basics |
|------------------- --------- ------------------------------------------------|
| o Presentation | 11/15 | Very nice white space! Indent issues though |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 13/15 | No infinite loops. Would like walking failsafe |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 10/10 | Smart paint + text + hour stats. Got it all ;) |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 8/10 | Nice. Some unused variables |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 7/10 | Nice work. Need length(ATPA) check |
|------------------- --------- ------------------------------------------------|
| o Comments | 2/5 | None but didn't really need any (simplicity) |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 3/5 | Some simple walkPaths |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 75/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 75/100 (B+) |
|-----------------------------}
program WheatHarvesterByDrClemsip;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
//\\Start Script At Taverly Bank//\\
var
LoadsDone: integer;
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Wheat Harvester by Dr Clemsip';
scriptHelpThread := '';
scriptSettingsPath := ''; (* ~TM - Could remove these if not using *)
editBoxLabels := ['Minutes to run', 'Minutes before breaking'];
editBoxDefaults := ['0', '120'];
editBoxHints := ['Scripit runtime (in minutes).', 'How much wheat to pick.', 'Time till break (in minutes).'];
checkBoxLabels := ['Save SRL log', 'Draw on SMART'];
checkBoxDefaults := ['True', 'False'];
checkBoxHints := ['Save SRL debug to a log file (recommended)?', 'Do you want do draw debug information on SMART?'];
end;
end;
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
// integers
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
// booleans
booleans[0] := strToBool(playerForm.players[i].settings[3]);
end;
end;
procedure runToWheat();
var
pathToWheat: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToWheat := [Point(105, 161), Point(133, 168), Point(160, 172), Point(190, 204), Point(162, 237)];
if SPS.walkPath(pathToWheat) then (* ~TM - would like walking failsafes *)
minimap.waitPlayerMoving()
else
writeLn('Failed to walk to the wheat feild.');
exit; (* ~TM - No need for this, it's the end of the procedure *)
end;
procedure pickWheat();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
wheatTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
wheatTimer.start();
repeat (* ~TM - intentation *)
findColorsSpiralTolerance(x, y, TPA, 5489583, mainScreen.getBounds(), 8, colorSetting(2, 0.10, 1.35));
if (Length(TPA) < 1) then
exit; (* ~TM - intentation *)
ATPA := TPA.toATPA(20, 20);
ATPA.filterBetween(0, 10); (* ~TM - Need a length(ATPA) check here, you could have filtered out all the TPAs *)
ATPA.sortFromMidPoint(mainscreen.playerPoint);
//smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ick'], 200) then
begin
fastClick(MOUSE_LEFT);
//smartImage.clear;
break;
end;
end;
tabBackpack.waitForShift(1000); (* ~TM - Long enough? What if you have to walk a bit *)
claimSpinTicket(); (* ~TM - claimTicket() should be used instead *)
until tabBackpack.isFull() or (wheatTimer.getTime() > 300000);
end;
procedure runToBank();
var
pathToBank: TPointArray;
begin
if not isLoggedIn() then
exit;
pathToBank := [Point(143, 215), Point(116, 173), Point(90, 162)];
if SPS.walkPath(pathToBank) then
minimap.waitPlayerMoving()
else
writeLn('Failed to walk to the Bank.');
end;
procedure findBanker();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
findColorsSpiralTolerance(x, y, TPA, 7156017, mainScreen.getBounds(), 5, colorSetting(2, 0.12, 1.18));
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA); (* ~TM - You don't clear this here *)
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['anker'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
end;
end;
procedure depositWheat();
var
bankTimer: TTimeMarker;
begin
if bankScreen.isOpen(3000) then
begin
bankTimer.start();
repeat
if (bankscreen.getPackCount() > 0) then (* ~TM - intentation *)
begin
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
end; (* ~TM - no need for this begin..end *)
if bankscreen.getPackCount() < 3 then
begin
bankscreen.close();
sleepAndMoveMouse(randomRange(750, 1100)); (* ~TM - It's good to include things like this ;) *)
end;
until (bankTImer.getTime() > 2500) or (not isLoggedIn()); (* ~TM - 2.5 sec is very short. What if I lag? *)
inc(LoadsDone);
end;
end;
procedure progressReport();
var
wheatPicked, profit, profitPerHour: integer;
begin
wheatPicked := LoadsDone * 28;
profit := (wheatPicked * 72);
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));
writeLn('=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=');
writeLn('Dr Clemsip''s Wheat Harvester!');
writeLn('Time Run: ' + timeRunning);
writeLn('Wheat Picked: ' + intToStr(wheatPicked));
writeLn('Loads Done: ' + intToStr(loadsDone));
writeLn('Profit Made: ' + intToStr(profit));
writeLn('Per Hour: ' + intToStr(profitPerHour));
writeLn('=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=');
smartImage.clear(); (* ~TM - Nice, smart paint + text *)
smartImage.drawText('Dr Clemsip''s Wheat Harvester!', point(10, 290), upchars, true, clWhite);
smartImage.drawText('Profit/hr: ' + intToStr(profitPerHour) + 'gp', point(10, 320), upchars, true, clWhite);
smartImage.drawText('Current Profit: ' + intToStr(profit) + 'gp', point(10, 335), upchars, true, clWhite);
smartImage.drawText('Loads/Collected: ' + intToStr(loadsDone) + '/' + intToStr(wheatPicked), point(10, 350), upchars, true, clPink);
smartImage.drawText('Time running: ' + timeRunning, point(10, 365), upchars, true, clPink);
end;
//Main Loop
begin
clearDebug();
smartShowConsole := false; (* ~TM - YES! *)
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
exit;
smartEnableDrawing := true;
disableSRLDebug := true;
setupSRL();
declarePlayers();
SPS.setup('WHEAT_MAP', RUNESCAPE_OTHER);
repeat (* ~TM - intentation *)
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitTreasure();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
if tabBackpack.isFull() then
(* ~TM - Getting messy here *)
begin
runToBank();
findBanker();
depositWheat();
end;
progressReport();
runToWheat();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
pickWheat();
until(false);
end.
Agent007
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | Y | |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 16/20 | Got the basics down! |
|------------------- --------- ------------------------------------------------|
| o Original Code | 5/10 | Good, but not much beyond tutorial code |
|------------------- --------- ------------------------------------------------|
| o Presentation | 10/15 | Quite a few indentation problems |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 12/15 | A few timers and breaks (see walking comment) |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 9/10 | Looks good ;) Could have added padding |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | /10 | Some unnecessary booleans |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 7/10 | Good, but lacking a range check |
|------------------- --------- ------------------------------------------------|
| o Comments | 3/5 | Sufficient |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 3/5 | Walkpath, but no backup |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 73/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 73/100 (B+) |
|-----------------------------}
//////////////////////// Agent007 - Coal Miner - ///////////////////////////////
program CoalMiner;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i srl-6/lib/misc/srlplayerform.simba}
{$I SPS/lib/SPS-RS3.Simba}
var
LoadsDone: integer;
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players); // loads SPF players from Player Manager
currentPlayer := 0;
// array pulls data from FORM to match with player settings
for i := 0 to high(players) do
with players[i] do
begin
// booleans
booleans[0] := strToBool(playerForm.players[i].settings[0]);
booleans[1] := strToBool(playerForm.players[i].settings[1]);
// strings
strings[0] := playerForm.players[i].settings[2];
end;
end;
procedure debugSPFSettings();
var (* ~TM - Getting a bit messy here *)
i: integer;
begin
writeln('');// adds a blank line
for i := 0 to high(players) do
begin
writeln('Is active?: ', players[i].booleans[0]);
writeln('Is Member?: ', players[i].booleans[1]);
writeln('Coal Type: ', players[i].strings[2]); (* ~TM - you never assigned strings[2] *)
writeln(''); // adds a blank line
end;
end;
/////////////////////////// player form
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Agent007 - Coal Miner'; // form title
scriptHelpThread := ''; // update this after OFFICIAL release
// starts check box options
checkBoxLabels := ['Player is active: ', 'Player is member: ']; (* ~TM - players has it's own isActive boolean *)
checkBoxDefaults := ['True', 'True'];
checkBoxHints := ['Is this character active?', 'Is this a members account?'];
// starts drop down selection
comboBoxLabels := ['Ore Type: '];
comboBoxDefaults := ['Coal'];
comboBoxHints := ['Choose the type of tree you want to chop.'];
// this needs to be done for every element in the comboBoxLabels array
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['Coal']; // options for dropdown -- only coal for now
end;
end;
/////////////////////// Mine Rocks
procedure mineRocks();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
pathToMine: TPointArray; (* ~TM - could be on TPA line *)
mineTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
mineTimer.start();
pathToMine := [Point(89, 112), Point(173, 113)];
if SPS.walkPath(pathToMine) then (* ~TM - A failsafe would be nice *)
minimap.waitPlayerMoving() // You would keep looking for rocks
else // for 13 min if none are on screen *)
writeLn('We failed to walk to the coal!');
repeat
findColorsSpiralTolerance(x, y, TPA, 2040354, mainScreen.getBounds(), 10, colorSetting(2, 0.00, 0.42));
if (Length(TPA) < 1) then (* ~TM - Indentation *)
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
(* ~TM - After the filterBetween( ), length(ATPA) could be 0 *)
for i := 0 to high(ATPA) do // so you could run into a error here *)
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Coal', 'oal'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clear;
break;
end;
end;
tabBackpack.waitForShift(15000); // wait time for mining the ore
until tabBackpack.isFull() or (mineTimer.getTime() > 800000);
end;
//////////////////////////// go to Deposit Box
procedure findDepositBox();
var (* ~TM - Indentation *)
pathToDeposit: TPointArray;
x, y, i: integer;
begin
if not isLoggedIn() then
exit;
pathToDeposit := [Point(173, 113), Point(89, 112)];
if SPS.walkPath(pathToDeposit) then (* ~TM - Again, you will still look for deposit box *)
minimap.waitPlayerMoving() // if you failed to walk there *)
else
writeLn('We failed to walk to the bank!@!');
repeat
mainscreen.findObject(x, y, 6913160, 5, colorSetting(2, 0.16, 1.02), mainscreen.playerPoint, 30, 50, 50, ['eposit', 'box'], MOUSE_LEFT);
wait(randomRange(1000, 2000));
inc(i);
until depositBox.isOpen() or (i >= 15);
end;
///////////////////////// deposit coal VIA deposit box
procedure depositCoal();
var
bankTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
if depositBox.isOpen() then
begin (* ~TM - Indentation *)
bankTimer.start();
repeat
if (depositBox.count > 0) then
begin (* ~TM - Indentation *)
depositBox.quickDeposit(QUICK_DEPOSITBOX_INVENTORY);
wait(gaussRangeInt(500, 750));
end;
until(depositBox.isEmpty()) or (not isLoggedIn()) or (bankTimer.getTime() > 10000);
inc(LoadsDone);
end;
depositBox.close(); (* ~TM - Will always attempt to close, even if it was never open *)
end; // You could put in the above begin .. end *)
/////////////////////////// progress report
procedure progressReport();
var
expPerHour, totExp, oreMined, profit, profitPerHour: integer;
begin
oreMined := LoadsDone * 28;
profit := (oreMined * 250); //price per coal--- manually update to match GE
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));
totExp := oreMined * 50;
expPerHour := round((totExp * 60) / (getTimeRunning() / 60000));
writeLn('========================================================');
writeLn('Agent007 - Coal Miner');
writeLn('========================================================');
writeLn('Time Running: ' + timeRunning);
writeLn('Ores Mined: ' + intToStr(oreMined)); (* ~TM - Nice *)
writeLn('Loads Done: ' + intToStr(loadsDone));
writeLn('Total Exp: ' + intToStr(totExp));
writeLn('Exp/Hour: ' + intToStr(expPerHour));
writeLn('Profit Made: ' + intToStr(profit));
writeLn('Profit/Hour: ' + intToStr(profitPerHour));
writeLn('========================================================');
end;
{Main Loop}
begin
clearDebug();
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then (* ~TM - Indentation *)
exit;
declarePlayers();
debugSPFSettings();
smartEnableDrawing := true;
setupSRL();
SPS.setup('Falador_Dung_001', RUNESCAPE_OTHER, 5, 300, 0.0);
SPSAnyAngle := False;
repeat (* ~TM - Indentation *)
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;
if tabBackpack.isFull() then
begin
findDepositBox();
depositCoal();
end;
progressReport();
mineRocks(); (* ~TM - Would have been better to have walking to rock *)
// seperate. If not findRocks() then walkToRocks() etc..
until(false);
end.
Torol
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | #2Legit2Quit #SoLegit #MrLegit250 |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 16/20 | Bits and pieces (see comments) |
|------------------- --------- ------------------------------------------------|
| o Original Code | 9/10 | Original shopScreen methods ;) |
|------------------- --------- ------------------------------------------------|
| o Presentation | 11/15 | Indentation errors + some clutter |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 12/15 | Good. No walking failsafes though |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 9/10 | Good stuff. Padding would make it pretty |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 0/10 | None, unfortunately |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 9/10 | Missing a few checks, but a nice 2-step method |
|------------------- --------- ------------------------------------------------|
| o Comments | 4/5 | Excellent (apart from tutorial comments) |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 3/5 | Simple walkPaths |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 73/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 73/100 (B) |
|-----------------------------}
program scriptTemplate;
{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files
var // Globals
flourBought, moneyPaid, loadsDone, flourDTM: integer; (* ~TM - First letter capital for global - easier to see what's happening *)
stopper: boolean;
procedure declarePlayers(); { -Please read the requirements before starting!- }
begin
setLength(players, 1);
with players[0] do
begin (* ~TM - Indentation *)
loginName := 'loginName';
password := 'password';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end; (* ~TM - You really need spaces between methods - It looks like it's one big procedure! *)
procedure findBank(); { -Search for banking options inside the bank- }
var
x, y, i, RotateCameraTrys, r: integer;
bTPA: TPointArray;
bATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
repeat
wait(randomRange(400, 800));
r := random(2); // 0 - find Banker; 1 - find Counter
case r of
0: findColorsSpiralTolerance(x, y, bTPA, 5845038, mainScreen.getBounds(), 9, colorSetting(2, 0.20, 1.78));
1: findColorsSpiralTolerance(x, y, bTPA, 12243139, mainScreen.getBounds(), 11, colorSetting(2, 0.40, 1.06));
end;
inc(RotateCameraTrys);
if (Length(bTPA) < 1) then // If banking opportunity not found, rotate camera
randomCompass(140, 250, false);
until(Length(bTPA) > 0) or (RotateCameraTrys > 3); (* ~TM - I like this bank/counter option ;) *)
if (Length(bTPA) < 1) then
exit;
bATPA := bTPA.toATPA(30, 30);
bATPA.sortFromMidPoint(mainscreen.playerPoint);
FilterTPAsBetween(bATPA,1,20); (* ~TM - You could be left with no TPAs after filtering, then run into an error below *)
for i := 0 to high(bATPA) do
begin (* ~TM - Indentation *)
mouse(middleTPA(bATPA[i]), MOUSE_MOVE); (* ~TM - Only 'ank', 'ounter' required, the rest are redundant *)
if isMouseOverText(['Bank', 'ank', 'Banker', 'anker', 'Counter', 'ounter'], 500) then
begin
fastClick(MOUSE_LEFT); // Open bankscreen
break;
end;
end;
end;
procedure bankScr(); { -Depositing items- }
var
bankTimer: TTimeMarker;
x,y: Integer; (* ~TM - What are these used for? *)
begin
wait(randomRange(3000, 4000)); (* ~TM - You could just put the wait inside isOpen(..) *)
if not isLoggedIn() then
exit;
if(BankScreen.isOpen()) then
begin
bankTimer.start();
repeat
if (BankScreen.getPackCount > 0) then
begin
if(BankScreen.getPackCountDTM(flourDTM) > 0) and (BankScreen.getPackCountDTM(flourDTM) < 28) then
stopper := true;
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
inc(loadsDone);
wait(gaussRangeInt(800, 1000));
end;
until(bankScreen.isPackEmpty) or (not isLoggedIn()) or (bankTimer.getTime() > 15000);
end;
bankScreen.close(); (* ~TM - Will attempt to close even if it isn't open in the first place - should be before the above end. *)
end;
procedure findRamsey(); { -Search for trader, open shop interface through conversation- }
var
x, y, i, i2, r2, continueDTM, RotateCameraTrys: integer; // Note: here I made my own ConversationBox.continue() (with blackjack and hookers.. and DTM Editor)
sTPA, rTPA: TPointArray; // The reason can be found here:
sATPA, rATPA: T2DPointArray; // https://villavu.com/forum/issue.php?issueid=355#note1528
signPoint, ramseyPoint: TPoint;
ramseyBox: TBox;
begin
if not isLoggedIn() then
exit;
repeat
wait(randomRange(400, 800)); // Search for the blue sign above Ramsey (the trader) ?
findColorsSpiralTolerance(x, y, sTPA, 10652019, mainScreen.getBounds(), 10, colorSetting(2, 0.06, 0.62));
sATPA := sTPA.toATPA(9,9);
FilterTPAsBetween(sATPA,1,20);
sATPA.sortFromMidPoint(mainscreen.playerPoint);
if (Length(sATPA) < 1) then
randomCompass(140, 250, false); (* ~TM - Whitespace is nice in code mash parts like this ;) *)
inc(RotateCameraTrys);
until(Length(sATPA) >= 1) or (RotateCameraTrys > 3);
if(Length(sTPA) < 1) then
exit;
signPoint := middleTPA(sATPA[0]);
ramseyBox := intToBox(signPoint.x-7, signPoint.y-3, signPoint.x+7, signPoint.y+35); // TBox which includes Ramsey
findColorsSpiralTolerance(x,y,rTPA,13299175, ramseyBox, 14,colorSetting(2, 1.43, 3.63));
if (Length(rTPA) < 1) then // Search for Ramsey in that box ^
exit;
rATPA := rTPA.toATPA(5,5);
rATPA.sortFromMidPoint(signPoint);
for r2 := 0 to high(rATPA) do
begin (* ~TM - Indentation *)
ramseyPoint := middleTPA(rATPA[r2]);
mouse(ramseyPoint.x, ramseyPoint.y, 2, 2, MOUSE_MOVE); (* ~TM - Half of strings in this array are redundant *)
if isMouseOverText(['Talk to', 'alk to', 'Mess', 'ess', 'Sergeant', 'ergeant', 'Ramsey', 'amsey']) then
break;
end;
if isMouseOverText(['Talk to', 'alk to', 'Mess', 'ess', 'Sergeant', 'ergeant', 'Ramsey', 'amsey']) then
begin
fastClick(MOUSE_LEFT); // Conversation start
wait(randomRange(5000, 6000));
if(not conversationBox.isOpen()) then
exit;
continueDTM := DTMFromString('mbQAAAHicY2VgYDBiYmCwAGININYEYhsgTgLiGCDOhtIZQNy5eD2DhKo2g4CkLIO0thHDgUmCDJJA/eiYEQsGAwAHGAfk');
repeat
if findDTM(continueDTM, x, y, chatbox.getBounds()) then
begin
mouse(x, y, 10, 4, MOUSE_MOVE);
fastClick(MOUSE_LEFT); (* ~TM - Did the spacebar not work either? Could have saved a lot of code *)
end
inc(i2);
until(findDTM(continueDTM, x, y, chatbox.getBounds()) or (conversationBox.findOption(['I need cookinq supplies.'])) or i2 > 4);
if(not findDTM(continueDTM, x, y, chatbox.getBounds())) then
conversationBox.continue(true,true);
if(not conversationBox.isOpen()) then
exit;
repeat
wait(randomRange(500, 800));
conversationBox.selectOption(['I need cookinq supplies.']);
inc(i);
until(conversationBox.selectOption(['I need cookinq supplies.'])) or (not conversationBox.isOpen()) or (i >= 5);
end; // Shop open ^
end;
procedure shopScreen(); { -Buy Pot of flour by right click, close shop- }
var
closeDTM, x, y, i, r: integer;
buyStr: string;
begin
if not isLoggedIn() then
exit;
closeDTM := DTMFromString('mbQAAAHicY2VgYFBjZmBQgGIdKJ4AFJ8KxJ1QDGL/2WLKYMnIwJDJww7GILYkAyZmxILBAAABuQdy'); // Note: I didn't find SRL functions
repeat // for shop interfaces
if findDTM(flourDTM, x, y, mainScreen.getBounds()) then
begin
mouse(x, y, 9, 9, MOUSE_MOVE);
if isMouseOverText(['Info', 'nfo', 'Pot', 'of', 'flour', 'lour']) then
begin (* ~TM - Indentation *)
fastClick(MOUSE_RIGHT);
wait(randomRange(500, 1000));
r := random(3);
case r of
0: buyStr := 'Buy All'; (* ~TM - I like it ;) *)
1: buyStr := 'Buy 500';
2: buyStr := 'Buy 50';
end;
if chooseOption.select([buyStr]) then
begin
wait(randomRange(500, 1500));
if findDTM(closeDTM, x, y, mainScreen.getBounds()) then
begin
mouse(x, y, 5, 5, MOUSE_MOVE);
wait(randomRange(200, 500));
fastClick(MOUSE_LEFT); // Shop close
i := TabBackpack.countDTM(flourDTM);
flourBought := flourBought + i;
moneyPaid := moneyPaid + (i*14);
exit;
end;
end;
end;
end; (* ~TM - Hmm. (TPA,int) when it takes (TPoint,boolean) parameters. I'm surprised this compiles *)
mouseScroll(middleTPA(mainScreen.getBounds().createTPA), 5); // In case flourDTM not found, scroll down
until(false);
end;
procedure progressReport();
var
wikiaPage, priceString: string;
result: integer;
begin
wikiaPage := getPage('http://runescape.wikia.com/wiki/Exchange:Pot_of_flour');
priceString := between('GEPrice">', '</span>', wikiaPage);
result := strToIntDef(extractFromStr(priceString, numbers), -1);
writeLn('========================================================');
writeLn('TAVERLEY POT OF FLOUR AUTOBUYER by Torol');
writeLn('Time Run: ' + timeRunning); (* ~TM - Nice *)
writeLn('Bought: ' + inttoStr(flourBought) + ' Pot of flour');
writeLn('Spent: ' + inttoStr(moneyPaid) + ' coins');
writeLn('Profit Made: ' + inttoStr(((result*flourBought)-moneyPaid)) + ' coins');
writeLn('Loads Done: ' + inttoStr(loadsDone));
writeLn('========================================================');
end;
procedure pathToRamsey(); { -Run from bank to tavern- }
var
ramseyPath: TPointArray;
begin
if not isLoggedIn() then
exit;
ramseyPath := [Point(93, 225), Point(122, 174), Point(122, 122), Point(170, 124)];
if SPS.walkPath(ramseyPath) then
minimap.waitPlayerMoving()
end;
procedure pathToBank(); { -Run from tavern to bank- }
var
bankPath: TPointArray;
begin
if not isLoggedIn() then
exit;
bankPath := [Point(160, 115), Point(122, 131), Point(118, 178), Point(88, 217)];
if SPS.walkPath(bankPath) then
minimap.waitPlayerMoving()
end;
begin // main loop
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
setupSRL(); // Load the SRL include files
declarePlayers(); // Set up your username/pass
SPS.setup('TAVERLEY', RUNESCAPE_OTHER);
flourDTM := DTMFromString('mggAAAHicY2NgYDgAxZuBeD8Qnwbic0DMycjAwATE7EAsBsTCQMwBxOUhpgy7N4NUM6FgSSAJwuiAEQeGAAAg0Ag8');
repeat
if not isLoggedIn() then // If player isn't logged in then
begin
players[currentPlayer].login(); // Log them in
exitSquealOfFortune(); // Exit squeal if found
minimap.setAngle(MM_DIRECTION_NORTH); // Make compass north and angle high
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
if(TabBackpack.isEmpty) then (* ~TM - You could have deleted the tut comments ;) *)
begin (* ~TM - A few messy indents here *)
pathToRamsey();
findRamsey();
shopScreen();
end; (* ~TM - Indentation *)
if(not TabBackpack.isEmpty) then (* ~TM - Could just be an else *)
begin
pathToBank();
findBank();
bankScr();
progressReport();
if(stopper = true) then (* ~TM - Nice out of cash failsafe ;) *)
break;
end;
until(loadsDone > 18); // <-- You can lower this if you want
players[currentPlayer].logout(); (* ~TM - Could have been a constant at the top *)
end.
pipos1
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | 2Legit2Quit |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 16/20 | Could use srl6 for a few things (see comments) |
|------------------- --------- ------------------------------------------------|
| o Original Code | 8/10 | Location check/getPrice, some nice stuff here |
|------------------- --------- ------------------------------------------------|
| o Presentation | 12/15 | A few messy places |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 11/15 | Can get stuck in a few loops |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 8/10 | XP would be nice #DemGainz #SnapCity |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 8/10 | Hints mixed up + unused variable |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 7/10 | Good, but missing a few range checks |
|------------------- --------- ------------------------------------------------|
| o Comments | 2/5 | Gave some credits. Told me it was mainloop :p |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 5/5 | walkPath + location checker ;) |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 69/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 69/100 (B-) |
|-----------------------------}
//made by pipos1\\credits to Ross for checkLocation and IsInArea and big thanks for your help :D and credits to TheMayor for your help too :D
program DwtIronMiner;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
const
LOGIN_WORLD = 0; (* ~TM - You should state these are 'internal' so user doesn't change login world here :p *)
LOADS_TO_DO = 1;
MINUTES_TO_RUN = 2;
var
LoadsDone, Ironint : integer;
p, Iron : string; (* ~TM - 'p' and 'Iron' should be local vars in 'getPrice()' *)
LOCATION_BOX: TBox := intToBox(140, 150, 360, 340);
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'DwtIronMiner';
scriptHelpThread := ''; (* ~TM - Could have saved a line ;) *)
editBoxLabels := ['Login world', 'Loads to do','Minutes to run'];
editBoxDefaults := ['-1', '1000', '600']; (* ~TM - I think you got these hints mixed up son :p *)
editBoxHints := ['How long to run (in minutes)?', 'how many loads you want to mine?', 'How many iron ores do you want to mine?'];
comboBoxLabels := ['Ore Type'];
comboBoxDefaults := ['Iron'];
comboBoxHints := ['Choose the type of ore you want to mine.'];
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['Iron', 'I will add copper', 'and tin later :)'];
end;
end;
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
integers[LOGIN_WORLD] := strToInt(playerForm.players[i].settings[0]);
integers[LOADS_TO_DO] := strToInt(playerForm.players[i].settings[1]);
integers[MINUTES_TO_RUN] := strToInt(playerForm.players[i].settings[2]);
world := integers[LOGIN_WORLD];
end;
end;
procedure RunToMine();
var
p: TPoint; (* ~TM - What is this TPoint for? *)
RunToMine: TPointArray;
begin
if not isLoggedIn() then
exit;
gameTabs.openTab(TAB_BACKPACK); (* ~TM - That indentation though *)
RunToMine := [Point(230, 216), Point(185, 188), Point(152, 148), Point(142, 96), Point(120, 48)];
SPS.walkPath(RunToMine);
end;
function isInArea(): boolean;
var
pos: TPoint;
begin
pos := SPS.getPlayerPos(); (* ~TM - Could have saved 3 lines here pointInBox(sps.getPlayerPos(), LOCATION_BOX) *)
result := pointInBox(pos, LOCATION_BOX);
end;
procedure checkLocation();
begin (* ~TM - very useful *)
if not isInArea() then
SPS.walkToPos(LOCATION_BOX.getGaussPoint());
end;
procedure MineIron();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
repeat
findColorsSpiralTolerance(x, y, TPA, 2042958, mainScreen.getBounds(), 8, colorSetting(2, 0.04, 0.27));
if (Length(TPA) < 1) then
checkLocation; (* ~TM - () () () () () *)
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10); (* ~TM - What if all your TPAs got filtered out and length(ATPA) = 0? *)
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Iron'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clear();
break;
end;
end;
tabBackpack.waitForShift(5000); (* ~TM - That indent though *)
until tabBackpack.isFull(); (* ~TM - What if I disconnect during this procedure? I'll be stuck here forever :p *)
end;
procedure TeleToClanCamp();
var
p: TPoint; (* ~TM - Indentation *)
ClickVexillum, ClickYes: TBox;
begin
if not isLoggedIn() then
exit;
begin (* ~TM - Indentation :/ *)
gameTabs.openTab(TAB_EQUIPMENT);
mouse(628, 441, 8, 8, MOUSE_MOVE);
if isMouseOverText(['lan', 'exillum']) then
begin
fastClick(MOUSE_RIGHT);
if chooseOption.select(['Tele']) then
begin (* ~TM - begin..end not needed here *)
repeat
wait(randomRange(250, 500));
ClickYes := intToBox(255, 495, 323, 504);
mouseBox(ClickYes, MOUSE_LEFT); (* ~TM - Can't you just conversationBox.selectOption(1) *)
wait(randomRange(4000, 4500));
until (not isLoggedIn()) or (minimap.findSymbol)(p, MM_SYMBOL_BANK, minimap.getBounds());
end; (* ~TM - Something is up with that findSymbol statement :p *)
end;
end;
end;
procedure RunToChest();
var
p: TPoint; (* ~TM - What's this *)
RunToChest: TPointArray;
begin
if not isLoggedIn() then
exit;
RunToChest := [Point(265, 261), Point(249, 234), Point(233, 212)];
SPS.walkPath(RunToChest); (* ~TM - You could even chuck the TPA striaght into walkPath([point(1,1)]) *)
end;
procedure FindChest();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
repeat
findColorsSpiralTolerance(x, y, TPA, 7243438, mainScreen.getBounds(), 3, colorSetting(2, 0.21, 0.74));
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10); (* ~TM - Again, need a range check here. You can't loop through an empty array *)
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clear();
wait(randomRange(2500, 3000));
break;
end;
end;
until bankScreen.isOpen(); (* ~TM - What if the bank isn't even visible on screen? You b stuck! *)
end;
procedure DepositIron();
begin
if not isLoggedIn() then
exit;
if bankScreen.isOpen() then
begin (* ~TM - begin..end not needed*)
repeat
if bankScreen.getPackCount() > 0 then
bankScreen.quickDeposit (QUICK_DEPOSIT_INVENTORY);
wait (randomRange(500, 750));
inc(LoadsDone);
bankScreen.close()
until bankScreen.getPackCount() = 0 or (not isLoggedIn()); (* ~TM - What if you have a spin ticket :s *)
end;
end;
procedure GetPrice();
begin
p := getPage('http://runescape.wikia.com/wiki/Iron_ore');
Iron := between('GEItem"><span>', '</span>', p);
Ironint := StrToInt(Iron);
end;
procedure ProgressReport();
var
IronOreMined, profit, profitPerHour: integer;
begin
IronOreMined := LoadsDone * 28;
profit := (IronOreMined * Ironint);
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));
Writeln('****************************************************************');
Writeln('*/////////---------- Dwt iron miner by pipos1 ----------\\\\\\\*');
Writeln('****************************************************************');
writeLn('================================================================');
writeLn('Time Run: ' + timeRunning);
writeLn('Iron Ores Mined: ' + intToStr(IronOreMined)); (* ~TM - Nice ;) XP would be cool *)
writeLn('Loads Done: ' + intToStr(LoadsDone));
writeLn('Profit Made: ' + intToStr(Profit));
writeLn('Per Hour: ' + intToStr(ProfitPerHour));
writeLn('================================================================');
end;
//main loop
begin
clearDebug();
GetPrice(); (* ~TM - Should prolly come after the form. Save grabbing stuff if player exits form *)
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
begin
terminatescript;
end; (* ~TM begin..end not needed - *)
smartEnableDrawing := true;
declarePlayers();
SetupSRL;
SPS.setup('DwtIronMiner', RUNESCAPE_OTHER);
begin (* ~TM - begin..end not needed, but this should be in your repeat loop *)
players[currentPlayer].login();
exitSquealOfFortune();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;
repeat
if tabBackpack.isFull() then (* ~TM - Indentation issues*)
begin
TeleToClanCamp();
RunToChest();
FindChest();
DepositIron();
end;
ProgressReport;
RunToMine();
MineIron();
until(false); (* ~TM - Won't log back in if you lag out/6hourFix *)
end.
Wooty
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | Quite a bit of 'boarderline' code though |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 18/20 | Used a lot of the include. Nice job ;) |
|------------------- --------- ------------------------------------------------|
| o Original Code | 8/10 | Quite a few cool things! |
|------------------- --------- ------------------------------------------------|
| o Presentation | 9/15 | Squeezing too much in! Cluttered, no space! |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 10/15 | A few Major infinite loops in main loop |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 6/10 | Didn't read, too cluttered! (sorry sore brain) |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 0/10 | None. Forfeited critical points here |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 9/10 | Good work filtering out the bones |
|------------------- --------- ------------------------------------------------|
| o Comments | 5/5 | Well explained |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 3/5 | Basic walkPath usage |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 68/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 68/100 (B-) |
|-----------------------------}
program CowsToBootsConverter;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
var
bootsMade, hidesTanned, tripsFinished, leatherDTM, threadDTM, bootsDTM: Integer;
makeBoots: Boolean; (* ~TM - Global variables should start with a capital letter to distnguish them *)
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'username';
password := 'password';
bankPIN := '****';
isActive := True;
isMember := True;
world := -1; (* ~TM - Could be booleans[0] to avoid another global variable + have each player unique settings *)
makeBoots := True; //Set to True if you want to craft the hard leathers into hard leather boots after finishing each trip. Set to False if you just want to bank the hard leathers.
end
currentPlayer := 0;
end;
procedure setStatus(status: String)
begin
smartImage.clear(); (* ~TM - Wow this is a massive cluster of code. I nearly crey, but not distim ;) *)
smartImage.drawRoundBox(intToBox(actionBar.x1, actionBar.y1, actionBar.x2, actionBar.y2), 15, True, clGreen);
smartImage.drawText('STATUS: ' + status, point(actionBar.x1 + 5, actionBar.y1 + 10), 'UpChars', True, clWhite);
if makeBoots then smartImage.drawText('BOOTS MADE: ' + toStr(bootsMade) + ' (' + toStr(tripsFinished) + ' trips)', point(actionBar.x1 + 5, actionBar.y1 + 25), 'UpChars', True, clWhite) else smartImage.drawText('HIDES TANNED: ' + toStr(hidesTanned) + ' (' + toStr(tripsFinished) + ' trips)', point(actionBar.x1 + 5, actionBar.y1 + 25), 'UpChars', True, clWhite);
if makeBoots then smartImage.drawText('BOOTS/H: ' + toStr(round(bootsMade * (3600 / (GetTimeRunning() / 1000)))), point(actionBar.x1 + 5, actionBar.y1 + 40), 'UpChars', True, clWhite) else smartImage.drawText('HIDES/H: ' + toStr(round(hidesTanned * (3600 / (GetTimeRunning() / 1000)))), point(actionBar.x1 + 5, actionBar.y1 + 40), 'UpChars', True, clWhite);
smartImage.drawText('TIME RUNNING: ' + toStr(msToTime(getTimeRunning(), TIME_FORMAL)), point(actionBar.x1 + 5, actionBar.y1 + 55), 'UpChars', True, clWhite);
if makeBoots then smartImage.drawText('MONEY MADE IF ALCHED: ' + toStr((bootsMade * 600) / 1000) + 'K (' + toStr((round(bootsMade * (3600 / (GetTimeRunning() / 1000))) * 600) / 1000) + 'K/H)', point((actionBar.x1) + 315, actionBar.y1 + 10), 'UpChars', True, clWhite) else smartImage.drawText('We are not crafting boots!', point((actionBar.x1) + 410, actionBar.y1 + 10), 'UpChars', True, clWhite);
smartImage.drawText('~Wooty', point((actionBar.x1) + 515, actionBar.y1 + 55), 'UpChars', True, clWhite);
end;
procedure antiBan();
var
i: Integer;
begin
if not isLoggedin() then exit();
i := random(100);
case i of (* ~TM - case random(100) of ... just saved you 3 lines *)
1..12: pickUpMouse();
13..18: randomRClickItem();
19..26: sleepAndMoveMouse(random(2000) + 750);
27..32: smallRandomMouse();
33..50: mouseOffClient(OFF_CLIENT_RANDOM);
86..90: hoverRandomSkill();
end;
end;
procedure bankBoots();
begin
if not isLoggedIn() then exit();
if not tabBackpack.isEmpty() then bankScreen.open(BANK_TABLE_BURTHORPE);
wait(gaussRangeInt(1000, 2000));
if (makeBoots) and (bankScreen.getPackCountDTM(leatherDTM) > 0) then //Only if makeBoots is set to True
begin
setStatus('Widrawing thread and leathers...');
if bankScreen.isOpen(2500) then (* ~TM - Ideally you would check this before counting the DTMs *)
begin
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
if not bankScreen.isOpen(gaussRangeInt(1500, 2500)) then tabBackpack.mouseSlot(random(2, 28), MOUSE_LEFT);
wait(gaussRangeInt(750, 1250));
if (toolScreen.isOpen(2500)) then toolScreen.select('Needle'); //First trip only
if productionScreen.isOpen(1500) then
begin
if productionScreen.getSelectedBoxText() <> 'Hard leather boots' then productionScreen.selectBox(9);
wait(1250 + random(250));
productionScreen.clickStart();
setStatus('Crafting boots...');
end;
while not (progressScreen.getPercentDone() = 100) do wait(100);
progressScreen.findButton(PROGRESS_BUTTON_DONE, gaussRangeInt(500, 1000), True);
gaussRangeInt(1000, 1500);
if makeBoots then bootsMade := bootsMade + tabBackpack.countDTM(bootsDTM);
inc(tripsFinished);
bankScreen.open(BANK_TABLE_BURTHORPE);
gaussRangeInt(750, 1250);
end;
end;
if bankScreen.isOpen(2500) then
begin
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(gaussRangeInt(1000, 2000));
setStatus('Closing the bank...');
bankScreen.close();
wait(gaussRangeInt(500, 1000));
end;
end;
procedure walkToCows();
var
pathToCows, pathToBank: TPointArray; (* ~TM - What is path to bank doing here? *)
p: TPoint; (* ~TM - What is p for? *)
begin
if not isLoggedIn() then exit();
setStatus('Walking to the cows...');
pathToCows := [Point(167, 131), Point(177, 167), Point(161, 209), Point(137, 255), Point(141, 303), Point(149, 324)];
if SPS.walkPath(pathToCows) then minimap.waitPlayerMoving();
end;
procedure lootHides();
var
x, y, i: Integer; (* ~TM - What is i for? *)
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then exit();
minimap.waitPlayerMoving();
findColorsSpiralTolerance(x, y, TPA, 14607600, mainScreen.getBounds(), 6, colorSetting(2, 1.06, 3.40));
if (Length(TPA) < 1) then exit;
setStatus('Looting!');
ATPA := TPA.toATPA(20, 20);
ATPA.filterBetween(0, 62); //Filters out loot piles that only have bones left (already been looted)
ATPA.sortFromMidPoint(mainScreen.playerPoint);
smartImage.debugATPA(ATPA);
if Length(ATPA) > 0 then mouse(middleTPA(ATPA[0]), MOUSE_MOVE);
if isMouseOverText(['ake']) then
begin
fastClick(MOUSE_RIGHT);
if chooseOption.select(['ake Cowhide', 'Cowhide'], 250) then
begin
smartImage.clearArea(mainScreen.getBounds());
tabBackpack.waitForShift(2000);
end;
end;
end;
procedure killCows();
var
x, y, i, j, count, targetCow: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
lootTimer: TTimeMarker;
begin
if not isLoggedIn() then exit();
count := random(0, 3);
if (count + 1) > (28 - tabBackpack.count()) then count := (28 - tabBackpack.count()) - 1; //Limits the amount of kills when the backpack is nearly full
setStatus('Killing ' + toStr(count + 1) + ' cows...');
for i := 0 to count do //Cow-killing Loop
begin
minimap.waitPlayerMoving();
findColorsSpiralTolerance(x, y, TPA, 7567762, mainScreen.getBounds(), 26, colorSetting(2, 0.15, 0.22));
if Length(TPA) < 1 then exit;
ATPA := TPA.toATPA(50, 50);
ATPA.filterBetween(0, 200);
ATPA.sortFromMidPoint(mainScreen.playerPoint);
smartImage.debugATPA(ATPA);
if i < high(ATPA) then
begin
if i < 3 then targetCow := i else targetCow := 0; //Avoid clicking a cow that is already been killed (during dying animation)
mouse(middleTPA(ATPA[targetCow]), MOUSE_MOVE);
if isMouseOverText(['ttack']) then multiClick(middleTPA(ATPA[targetCow]), 10 + random(5), 2); //10-15% chance to spam-click twice
end;
smartImage.clearArea(mainScreen.getBounds());
wait(gaussRangeInt(500, 1500));
end;
for j := 0 to count do //Cowhide-looting Loop
begin
lootTimer.start();
if (tabBackpack.count() < 28) and (lootTimer.getTime() < 20000) then lootHides();
end;
end;
procedure walkToTanner();
var
pathToTanner: TPointArray;
begin
if not isLoggedIn() then exit();
setStatus('Walking to the tanner...');
pathToTanner := [Point(149, 327), Point(143, 301), Point(164, 262)];
if SPS.walkPath(pathToTanner) then minimap.waitPlayerMoving();
end;
procedure tanHides();
var
x, y : Integer;
begin
if not isLoggedIn() then exit;
setStatus('Tanning the hides...');
if mainscreen.findObject(x, y, 3169567, 9, colorSetting(2, 0.30, 0.62), mainscreen.playerPoint, 3, 5, 10, ['alk', 'to'], MOUSE_RIGHT) then
begin
chooseOption.select(['an hide', 'Tan', 'hide']);
wait(gaussRangeInt(2000, 3000));
if productionScreen.isOpen(10000) then
begin
if productionScreen.getSelectedBoxText() <> 'Hard leather' then productionScreen.selectBox(2);
productionScreen.clickStart();
if not makeBoots then hidesTanned := hidesTanned + tabBackpack.countDTM(leatherDTM);
if not makeBoots then inc(tripsFinished);
end;
end;
end;
procedure walkToBank();
var
pathToBank: TPointArray;
begin
if not isLoggedIn() then exit;
setStatus('Walking to the bank...');
pathToBank := [Point(159, 263), Point(159, 219), Point(173, 183), Point(175, 155), Point(171, 129)];
if SPS.walkPath(pathToBank) then minimap.waitPlayerMoving();
end;
procedure FreeTheDTMs();
begin
FreeDTM(leatherDTM); (* ~TM - freeDTMs([leatherDTM, bootsDTM, threadDTM]); *)
FreeDTM(bootsDTM);
FreeDTM(threadDTM);
end;
procedure setupPlayer();
begin
players[currentPlayer].login();
setStatus('Initializing script...');
exitTreasure();
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
end;
procedure mainLoop();
begin
mousespeed := random(28, 32); (* ~TM - What if you're not logged in? You will keep trying to bank boots/kill cows for ever. *)
repeat bankBoots() until not tabBackpack.isFull(); (* ~TM - Not exactly correct standards :/ *)
if tabBackpack.isEmpty() then walkToCows();
repeat killCows() until tabBackpack.isFull(); (* ~TM - Now i crey evertim *)
walkToTanner();
tanHides();
antiBan(); //Very limited! More will be added after the competition :)
walkToBank();
end;
begin
clearDebug();
disableSRLDebug := True;
smartEnableDrawing := True;
declarePlayers(); //Did not use the player login form UI since I didn't have enough lines left :P (will add after the competition)
smartPlugins := ['d3d9.dll']; //DirectX for better performance.
setupSRL();
SPS.setup('LEATHER_MAP', RUNESCAPE_OTHER);
leatherDTM := DTMFromString('mrAAAAHic42BgYFjExMAwG4inAvE6IN4IxKuAeAUQzwfi1YxAGojXA/EmIF4GxPOAeAcQbwNiDRVpoClMOLEkA37ASADDAADsjQs2');
threadDTM := DTMFromString('mggAAAHicY2NgYNjNxMCwGYjXA/F+ID4KxMeB+DEjA8NDIH4PxB+B+DkQXwfiST09QF1MUMwIxUwMkgzYASMODAEAgN4LtA==');
bootsDTM := DTMFromString('mggAAAHicY2NgYFBnY2CQBWJdIDaHYmUg/sLIwPAHiJmYIPgNkP0KiK2ERIC6mKCYEc6WZMAOGHFgCAAADXAFhw==');
addOnTerminate('FreeTheDTMs'); //Release memory
if not isLoggedIn then setupPlayer();
while players.getActive > 0 do mainLoop();
end.
cosmasjdz
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 250 | Some 'fishy' looking 1 liners |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 17/20 | OK, a lot of repetitive code |
|------------------- --------- ------------------------------------------------|
| o Original Code | 9/10 | Creative TPA solution for eggs |
|------------------- --------- ------------------------------------------------|
| o Presentation | 8/15 | Pretty messy throughout, ambiguous variables |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 12/15 | Terminate far too often, instead of try again |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 7/10 | Would like to see profit and per hour stats |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 0/10 | I crey evertim |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 9/10 | Very nice. Some cool clearTPAfrom() code |
|------------------- --------- ------------------------------------------------|
| o Comments | 2/5 | Some not needed, some in another language :/ |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 4/5 | walkPath, and some fancy mmToMs code ;) |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 68/100 |
|-----------------------------|
| ** Weighted at | 1.0 | (Has experience, but I let you off)
|------------------- ---------|
| FINAL GRADE: 68/100 (C+) |
|-----------------------------}
program CosmasJdzEggs;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$I SPS/lib/SPS-RS3.Simba}
var
p, a, ks, x, y, h, m, s, i, ht, mt, st: integer; (* ~TM - Very ambiguous variable names! *)
tt, ttt: ttimemarker;
trd: integer:=0;
procedure DeclarePlayers(); // Setup player
begin
SetLength(players, 1);
with players[0] do (* ~TM - But I want to use 2 players. I crey evertim *)
begin
loginName := 'Cosmas JDZ'; // Enter Player name
password := 'MyEggs'; // Enter Player password
isMember := true;
world := -1;
end
end;
procedure Statusas(); //Prints proggy (* ~TM - I see big spaces between your methods (not) *)
begin
ConvertTime((ttt.gettime()), h, m, s);
ConvertTime((tt.gettime()), ht, mt, st); (* ~TM - What about #Dat Profit #Dem Gainz *)
Writeln('////////////////////////////////////////////////////////////');
Writeln(' Cosmas JDZ Super eggs v.1.0 ');
Writeln(' Last trip time: '+ (tostr(mt)+'m '+ toStr(s)+ 's')+ ' Trips done: '+ tostring(trd));
Writeln(' Time running: '+ (toStr(h)+ 'h ' + toStr(m)+ 'm ' + toStr(s)+ 's'));
Writeln('////////////////////////////////////////////////////////////');
end;
procedure MiniAntiban(); //Antiban
begin
case random(8457) of (* ~TM - CamelCaps? Hard to read *)
0..515: Minimap.setAngle(trunc(minimap.getangledegrees())+gaussrangeint(-90,90));
516..525: Hoverskill(random(1,28));
526..614: Hoverskill(skill_summoning);
end;
end;
procedure Bank(); //Banking procedure (* ~TM - Thanks for clarifying ;) *)
var
x, y, i : integer;
TPA: TPointArray;
ATPA: T2DPointArray;
btm: ttimemarker;
begin
Minimap.clickCompass();
Minimap.setAngle(135+random(-7, 7));
FindColorsSpiralTolerance(x, y, TPA, 10673123, mainScreen.getBounds(), 2, colorSetting(2, 0.26, 2.06));
ATPA:= TPA.toATPA(20, 20);
ATPA.filterBetween(0, 6);
if length(atpa)<1 then terminatescript; (* ~TM - That escalated quickly! *)
for i:= 0 to high(ATPA) do
begin (* ~TM - Indentation *)
Mouse(middleTPA(ATPA[i]), Mouse_move); (* ~TM - CAPS for constants pls *)
if isMouseOverText(['Donate', 'odwill', 'ell'], 500) then
begin
Fastclick(Mouse_right);
Chooseoption.isOpen(random(457, 785));
ChooseOption.select(['Bank', 'Open Bank']);
if Bankscreen.isopen(5000)= true then break else terminatescript; (* ~TM - Naughty naughty 1 liner *)
end (* ~TM - = true is redundant *)
else Break; (* ~TM - Surely you could look again instead of terminate *)
end;
BankScreen.clickButton(BANK_BUTTON_PRESET_1);
BankScreen.close(); (* ~TM - Redundant if preset is used *)
Mainscreen.setAngle(ms_angle_high); (* ~TM - CAPS pls *)
inc(trd); // increase trips done integer for proggy
end;
function SBar():integer; //Gets Special move bar leftover, needed to determine if to drink summ pot
var
x, y, i: integer;
begin
result:= -1; (* ~TM - Indentation *)
for i:= 0 to 27 do
begin
if FindColorTolerance(x, y, 9662746, inttobox(174-(5*i), 161, 174-(5*i), 167), 11, colorSetting(2, 0.01, 2.6)) then
begin
result:= 28- i; (* ~TM - could return this on exit *)
exit;
end;
end;
end;
function _filter(Spalva: integer; Box: Tbox; Tol: integer; ColSettings: TColorSettings ): tbox;
var
x, y: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
FindColorsSpiralTolerance(x, y, TPA, Spalva, Box, Tol, ColSettings);
ATPA:= TPA.toATPA(20, 20);
result:=GetATPABounds( atpa); // Tbox of colors i need to filter out
end;
function RastiEggs(): tbox; // Finds eggs by filtering out spider and bank out of atpa
var
x, y, i: integer;
tpa: TPointArray;
atpa: T2DPointArray;
begin
FindColorsSpiralTolerance(x, y, TPA, 9342998, inttobox(194, 105, 412, 272), 10, colorSetting(2, 4.99, 1.08));
tpa:= clearTPAFromTPA(tpa, TPAFromBox(_filter(2930118, inttobox(212, 119, 360, 260),20,colorSetting(2, 0.23, 1.83)))); // Spider
tpa:= clearTPAFromTPA(tpa, TPAFromBox(_filter(10260030, inttobox(212, 119, 360, 260),5,colorSetting(2, 0.08, 0.15)))); // Bank
if length(TPA)< 1 then exit; (* ~TM - Very nice. You could use TPA := TPA.clearTPAFrom(_filter(..)) *)
atpa:= clustertpa(tpa, 4);
atpa.filterBetween(0, 4); //4
atpa.sortFromMidPoint(mainscreen.playerPoint); (* ~TM - This should really come after your length(ATPA) check *)
SmartImage.debugATPA(atpa);
if Length(atpa)< 1 then Exit;
if GetTPABounds(atpa[0]).x1= 0 then Exit; // if no atpa is found gives 0 (* ~TM - Necessary with above line? *)
result:= GetTPABounds(atpa[0]); // closest atpa
ks:= length(atpa);
end;
procedure Paimti(); //Picks up Eggs
begin
if ((tabbackpack.isFull()) or (rastieggs().x1=0)) then exit;
Smartimage.clear();
case random(3874) of
0..1274: begin
Wait(random(253, 412));
Mousebox(Rastieggs(), mouse_move);
if Ismouseovertext(['Spirit', 'Interact', 'pirit', 'pirit spider']) then minimap.setAngle(Trunc(minimap.getangledegrees())+ Random(30, 45)); // Mousebox(Rastieggs(),mouse_left);
if Ismouseovertext(['eggs', 'ggs']) then
begin
Fastclick(mouse_left);
Tabbackpack.waitForShift(2000);
Wait(550);
end;
end; (* ~TM - Whole bunch of repetitive code here. You could make the click random, and leave the rest *)
1275..3874: begin
Mousebox(Rastieggs(), mouse_right);
ChooseOption.isOpen(random(475, 987));
if Ismouseovertext(['Spirit', 'Interact', 'pirit', 'pirit spider']) then minimap.setAngle(Trunc(minimap.getangledegrees())+Random(30, 45));
if ChooseOption.optionsExist(['eggs','ggs'])then
begin
Chooseoption.select(['eggs', 'ggs']);
Tabbackpack.waitForShift(2000);
Wait(550);
end
else ChooseOption.close();
end;
end;
end;
procedure Spausti(); //Spamclicks special move button
begin
if 2>= Sbar() then Exit; (* ~TM - Could you simply implement multiClick(...) *)
case random(4500) of
0..1274: begin
Wait(gaussrangeint(150, 450));
Mousebox(inttobox(24, 132, 35, 141), mouse_left);;
Wait(gaussrangeint(150, 450));
end;
1275..3499: begin
Mousebox(inttobox(24, 132, 35, 141), mouse_left);
for i:= 0 to gaussrangeint(0, 5) do
begin
Fastclick(Mouse_left);
case random(27) of
0..7: Wait(Gaussrangeint(500, 700));
8..11: Wait(Random(150, 174));
end;
end;
end;
3500..4499: begin
Wait(gaussrangeint(1500, 2450));
Mousebox(inttobox(24, 132, 35, 141), mouse_left);
Wait(gaussrangeint(850, 1450));
end;
end;
end;
procedure Summ(); // determines if needed and summons spider, also drinks summ pot if needed
var
x, y: integer;
begin
if not FindColorTolerance(x, y, 660871, inttobox(16, 51, 173, 116),40) then // if no spider is alive
begin (* ~TM - Indentation *) //VVVV And is potion in invy VVVV (findColorTolerance(x, y, 12828188, inttobox(421, 445, 432, 450), 10)))
if (ActionBar.getSummoningPercent()< 35) then mousebox(tabbackpack.getslotbox(2), mouse_left);
if FindColorTolerance(x,y,10137010,inttobox(455, 433, 477, 452),20) then // if there is spiuder pouch in a bag
begin
Wait(random(356, 742));
Mousebox(tabbackpack.getslotbox(3),mouse_left);
wait(random(587,2145)); // presses the spider pouch
end;
end;
end;
procedure Spec(); //Clicks special movie button, also drinks summ pot if neccesary
begin
Summ(); (* ~TM - Massive line *)
if ((3>=Sbar()) and (FindColorTolerance(x, y, 12828188, inttobox(421, 445, 432, 450), 10))) then mouseBox(TabBackpack.getSlotBox(2), MOUSE_LEFT); //Drinks summ pot
repeat
p:= Sbar();
Spausti();
a:= Sbar();
if 2>= Sbar() then Exit;
until (a<>p);
end;
Procedure Main(); //main procedure
var
t,tl: ttimemarker;
tmmm, pries: integer;
res: tpoint;
begin
tl.start();
pries:= TabBackpack.count();
repeat
Paimti();
MiniAntiban();
if tl.getTime()> 75000 then
begin (* ~TM - Indentation - don't actually need this begin *)
if TabBackpack.count()<= pries then Terminatescript else Break;
end;
until ((TabBackpack.isfull()) or (ks<=1));
Minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
if (PointInBox(sps.getplayerpos(), inttobox(126, 114, 138, 134)))= false then
begin (* ~TM - Indentation *)
Sps_PosToMM(point(130 ,126), sps.getplayerpos(), res ); (* ~TM - Google translate didn't work :( *)
if PointInBox(minimap.pointstomainscreen([res])[0], inttobox(185, 1, 575, 388)) then mouse(minimap.pointstomainscreen([res])[0], mouse_left) else //jei telpa dotas i boxa jei ne tada minimap walk.
begin (* ~TM - Might as well just use the walkPath overload *)
Sps.walkPath([sps.getplayerpos(), point(130+ random(-4, 4), 126+ random(-4, 4))]);
wait(random(450,786));
Minimap.waitPlayerMoving(random(758, 1257));
end;
end;
if TabBackpack.isfull() then exit;
if TabBackpack.count()>= 23 then tmmm:= gaussrangeint(5500, 11000) else tmmm:= gaussrangeint(15000, 23000);
t.start();
repeat
Spec();
until t.gettime()> tmmm;
end;
procedure Mainloop();
begin
tt.start();
repeat
if not Isloggedin() then players[0].login();
Summ();
Main();
until tabbackpack.isFull();
Bank();
if tt.getTime()> 360000 then terminatescript; //6 mins given for a trip as FS
Statusas(); //proggy
end;
begin
SmartEnableDrawing:= true;
SetupSRL();
DeclarePlayers();
SPS.setup('ge', Runescape_other);
ttt.start();
repeat
Mainloop(); (* ~TM - Y no 6 hour fix ;( *)
until ((not isloggedin()) or (ttt.gettime()>= 21600000)); //6hours
end.
arclight
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 248 | 2 lines to spare! |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 16/20 | Got the basics. Some parts repetitive |
|------------------- --------- ------------------------------------------------|
| o Original Code | 7/10 | I like the random click/hover |
|------------------- --------- ------------------------------------------------|
| o Presentation | 11/15 | A but messy in places |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 11/15 | Lacks failsafe when finding bank |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 6/10 | Items got cracked me up. Would like to see XP |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 7/10 | Left in all the tut comments + unused vars :/ |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 1/10 | None, but used ms.findObject like a BOSS |
|------------------- --------- ------------------------------------------------|
| o Comments | 4/5 | Tried to make sense of the mainloop clutter |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 3/5 | A simple walkPath |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 66/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 66/100 (B-) |
|-----------------------------}
program ArclightGemRockMiner;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
//Author: Arclight
//Start script zoomed out and near gem rocks, be on empty world (no one else mining gem rocks) and hope no one trys to steal your spot
//Chance of exiting if you mine too fast, but you can increase wait timeouts and stuff if necessary
var
Timer : TTimeMarker;
// From thread on topic of SRL forms
// initiates the SRL player form (you aren't restricted to the procedure name; it can be whatever you want)
procedure initPlayerForm();
begin
with playerForm do (* ~TM - OMG ALL THESE WORDS! *)
begin
name := 'Gemstone Miner Elf Area'; // the title of the SPF, usually the name of your script
scriptHelpThread := ''; // a link to a help thread, if set to '' will link to my setup guide (* ~TM - Why have it if leaving it blank? *)
editBoxLabels := ['Minutes to run', 'Minutes before breaking', 'Minutes of break']; // edit boxes are created for each array element
editBoxDefaults := ['0', '0', '0']; // optional default values for each edit box; array length must equal editBoxLabel length
// optional hints for each edit box; hints are shown when the user holds the mouse over the component
editBoxHints := ['How long to run (in minutes), 0 disables timer?', 'Run for this amount of time (in minutes) before breaking.', 'How long you want that break?'];
end;
end;
// again, not restricted to the procedure name, although it's recommended
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players); // load the SPF players from the SRL Player Manager
currentPlayer := 0; // player to use first
// set player attributes based on the settings from the form
for i := 0 to high(players) do
with players[i] do
begin
// convert the integers
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
integers[2] := strToInt(playerForm.players[i].settings[2]);
end;
end;
function clickRock(): Boolean;
var
x, y, action: integer;
found : boolean;
point: TPoint;
begin
found := false;
case random(100) of
0..70 :
begin
action := MOUSE_LEFT; (* ~TM - No need for these begins and ends *)
end;
71..95 :
begin
action := MOUSE_RIGHT;
end;
96..100 :
begin
action := MOUSE_NONE;
end;
end;
//find a place to mine based on three different colors
//the first color is easier to find than the second (* ~TM - Nice, but a wee bit repetitive *)
found := mainscreen.findObject(x, y, 9240446, 8, colorSetting(2, 0.67, 0.01), mainScreen.getCenterPoint, 2, 2, 1, ['Gem rock'], action);
if(not found) then
found := mainscreen.findObject(x, y, 5399036, 11, colorSetting(2, 0.06, 0.31), mainScreen.getCenterPoint, 4, 4, 1, ['Gem rock'], action);
if(not found) then
found := mainscreen.findObject(x, y, 16425287, 9, colorSetting(2, 0.5, 0.66), mainScreen.getCenterPoint, 4, 4, 1, ['Gem rock'], action); ; //saphire, sort of buggy with the amount of blue in the elf place
if(action = MOUSE_RIGHT) then
begin
Wait(GaussRangeInt(100,500));
chooseOption.select(['Mine']);
end;
if((action = MOUSE_NONE) and found) then (* ~TM - Is this just to hover? *)
found := false;
result := found; (* ~TM - You could get away without this found boolean *)
end;
procedure AntiBan(); (* ~TM - Spaces between procedures! *)
begin
case random(10000) of
0..25 :
begin
hoverSkill(Skill_Mining);
Wait(GaussRangeInt(500,1000));
end;
150..160 :
begin
randomGameTab(true);
end;
300..320 :
begin (* ~TM - No need for these begins and ends - save them lines! *)
randomRClickItem();
end;
900..1200 :
begin
Minimap.setAngle(180 - gaussRangeInt(0,360));
end;
1300..1400 :
begin
Wait(GaussRangeInt(1000,5000));
end;
1500..1800 :
begin
randomCameraAngle(MS_ANGLE_HIGH);
end;
1900..2200 :
begin
randomCameraAngle(MS_ANGLE_LOW);
end;
end;
end;
procedure breakNow(length : integer);
var
breakTimer : TTimeMarker;
begin
if not IsLoggedIn then (* ~TM - It's good practice to use () on function calls *)
Exit;
if(length > 0) then
begin
breakTimer.reset;
length = length + GaussRangeInt(round(length/2),length*2);
writeln('Going to break for ' + intToStr(round(length/60000)) + ' minutes');
players[CurrentPlayer].logout;
breakTimer.start;
while(length > breakTimer.getTime) do
begin
wait(30000);
writeln('Break left: ' + intToStr(round((length - breakTimer.getTime)/60000)));
end;
writeln('Break over, logging in');
Players[CurrentPlayer].Login;
end;
end;
procedure ReportStats(currentTime, items: Integer);
begin
writeln('-------------------------');
writeln('Items Got: ' + intToStr(items)); (* ~TM - Very simple. XP would be nice. Could use timeRunning() *)
writeln('current run time: ' + intToStr(round(currentTime/1000)));
writeln('-------------------------');
end;
//try to bank, it terminates script automatically if it can't. This should probably use a state engine or something to make it not as static
procedure Bank;
var
x, y: integer;
path: TPointArray;
begin
path := [Point(179, 124), Point(174, 167)];
if SPS.walkPath(path) then begin
minimap.waitPlayerMoving;
end else
TerminateScript;
Minimap.setAngle(gaussRangeInt(175, 185));
mainscreen.setAngle(MS_ANGLE_HIGH);
mainscreen.findObject(x, y, 1151196, 42, ['Bank '], MOUSE_LEFT);
wait(gaussRangeInt(4000,6000));
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY); (* ~TM: What if findObject didn't find the bank :s *)
wait(gaussRangeInt(1000,2000));
bankScreen.close;
path := [Point(179, 128), Point(200, 128)];
if SPS.walkPath(path) then begin
minimap.waitPlayerMoving;
end else
TerminateScript;
end;
procedure MainLoop;
var
lastBreak, itemsGot, invSize, marker, failure: Integer;
nextMine: boolean;
begin
If Not Players[CurrentPlayer].Login Then
TerminateScript;
failure := 0;
marker := 0;
Timer.start;
lastBreak := 0;
itemsGot := 0;
invSize := tabBackpack.count;
Wait(GaussRangeInt(1000,4000));
nextMine := true;
while(Players[CurrentPlayer].Integers[0] = 0 or ((Players[CurrentPlayer].Integers[0] * 60000) > Timer.gettime)) do
begin
if(((Timer.getTime - marker) > 60000) and (not nextMine)) then begin //might want to make this longer based on lag
failure := failure + 1; //timeout happened
nextMine := true; //maybe we aren't actually mining?
marker := Timer.getTime;
end;
if(failure > 3) then
TerminateScript;
if(nextMine) then
begin (* ~TM - Good to see failsafes, but it seems a bit cluttered to me *)
if(clickRock()) then
begin
nextMine := false;
marker := Timer.getTime;
failure := 0;
minimap.waitPlayerMoving;
end
else
begin
Wait(GaussRangeInt(1000,5000));
minimap.setAngle(gaussRangeInt(1,5));
failure := failure + 1; //reuse timeout variable to see if we rotate the camera it helps
if(failure = 2) then //we are pretty slow at mining, so we should be okay
Minimap.setAngle(gaussRangeInt(140,220)); //
end;
end
else
begin
AntiBan;
if(tabBackpack.isFull) then
bank;
if(not (tabBackpack.count = invSize)) then
begin
invSize := tabBackpack.count;
itemsGot := itemsGot + 1;
marker := Timer.getTime;
failure := 0;
nextMine := true;
end;
end;
ReportStats(Timer.getTime, itemsGot);
if((not (players[CurrentPlayer].integers[1] = 0)) and ((players[CurrentPlayer].integers[1] * 60000 + gaussRangeInt(1,5000)) <= Timer.getTime - lastBreak)) then
begin
breakNow(players[CurrentPlayer].integers[2] * 60000);
lastBreak := Timer.getTime;
nextMine := true;
failure := 0;
marker := Timer.getTime;
end;
Wait(GaussRangeInt(3000,6000));
end;
writeln('ending script');
end;
begin
ClearDebug;
smartPlugins := ['OpenGL32.dll'];
SPS.setup('gem_rocks', RUNESCAPE_OTHER);
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
exit;
declarePlayers();
SetupSRL;
MainLoop;
end.
Cyanempire
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 122 | You could have doubled your script ;) |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 15/20 | Okay. No declarePlayers or progressScreen |
|------------------- --------- ------------------------------------------------|
| o Original Code | 7/10 | One TPA for all the walking ;) |
|------------------- --------- ------------------------------------------------|
| o Presentation | 12/15 | Capitals, could have used more spacing |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 12/15 | Had a few timers, but a few missing |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 5/10 | Very basic, but it's there nonetheless |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 0/10 | Could have added this, had lines to burn :p |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 8/10 | Nice, lacking a range check though |
|------------------- --------- ------------------------------------------------|
| o Comments | 1/5 | Told me where to write my username :D |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 4/5 | walkPath, one sps path but inverted it :D |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 64/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 64/100 (C+) |
|-----------------------------}
// []CyanEmpire`s Grand Tree Cooker[]
//Player Setup is at Line 94
// Enjoy Cooking!
program CyanEmpiresGTCooker;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
var
loadsDone: integer; (* ~TM - Ideally global vars would start with a capital *)
scriptTimer: TTimeMarker;
(* ~TM - This TTimeMarker is not really necessary. getTimeRunning() *)
procedure OpenBank();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
timeout: TTimeMarker;
begin
findColorsSpiralTolerance(x, y, TPA, 11322821, mainScreen.getBounds(), 15, colorSetting(2, 0.00, 0.84));
atpa := tpa.split(20);
atpa.filterBetween(0, 100); (* ~TM - Lacking a length(ATPA) < 1 check here *)
for i := 0 to high(ATPA) do
begin
atpa[i].getbounds().mouse(MOUSE_MOVE);
if isMouseOverText(['ank']) then
fastclick(Mouse_Left); (* ~TM - Keep const CAPS *)
timeout.reset();
timeout.start();
atpa[i].getbounds().mouse(MOUSE_LEFT);
while (not bankScreen.isOpen) and (timeout.getTime < 10000) do (* ~TM - bankScreen.isOpen(10000) *)
wait(random(100));
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
timeout.reset();
timeout.start();
while (bankScreen.isOpen) and (timeout.getTime < 10000) do
wait(random(100));
wait(randomRange(250, 1500)); (* ~TM - A bit cluttered up, could space it out a bit *)
inc(loadsdone);
end;
end;
procedure SPSWalking(toStove: boolean = true);
var
pathtoStove: TPointArray;
begin
if not isLoggedIn() then
exit;
pathtoStove := [Point(198, 241), Point(200, 242), Point(211, 241), Point(222, 241), Point(227, 235), Point(226, 213), Point(228, 197), Point(227, 174), Point(224, 163)];
if (not toStove) then
pathToStove.invert(); (* ~TM - Very nice ;) *)
if SPS.walkPath(pathtoStove) then
minimap.waitPlayerMoving()
else
writeLn('Failed to walk to stove');
end
function FindStove(): TBox;
var
x, y: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
findColorsSpiralTolerance(x, y, TPA, 1062327, mainScreen.getBounds(), 10, colorSetting(2, 0.14, 0.18));
atpa := tpa.split(20);
atpa.filterBetween(0, 5);
if (length(atpa) < 1) then
exit;
wait(2000); (* ~TM - Why do you need to wait (espesh spatic) before returning this TBox? *)
result := atpa[random(length(atpa))].getBounds();
end
procedure CookFish();
var
StoveBox: Tbox;
timeout: TTimeMarker;
begin
tabBackPack.mouseSlot(randomRange(12, 28), MOUSE_LEFT);
stoveBox := FindStove(); (* ~TM - Not needed here - findStove().mouse(..) *)
stoveBox.mouse(MOUSE_LEFT);
timeout.start();
while (not productionScreen.isOpen) and (timeout.getTime < 10000) do
wait(random(100));
productionScreen.clickstart();
wait(65000); (* ~TM - What if you never clicked start due to lag, gg 1 minute of your bots life :p - *)
while (productionScreen.isOpen) and (timeout.getTime < 70000) do (* ~TM - could have used progressScreen.isOpen() etc. ;) *)
wait(random(100));
wait(randomRange(250, 1500));
end
begin
SetupSRL();
spsAnyAngle := true;
SPS.setup('GrandTree2F', RUNESCAPE_OTHER);
currentPlayer := 0;
setLength(players, 1); (* ~TM - Probs not a good idea to put details all the way at the bottom *)
players[currentPlayer].loginName := 'Username'; // Player setup here
players[currentPlayer].password := 'Password';
players[currentPlayer].world := - 1;
players[currentPlayer].isActive := true;
players[currentPlayer].isMember := true;
players[currentPlayer].login();
scriptTimer.start();
minimap.clickCompass();
mainscreen.setangle(MS_ANGLE_HIGH);
repeat
OpenBank();
if (tabBackpack.count() <> 28) then
terminateScript;
SPSWalking(true);
FindStove();
CookFish();
SPSWalking(false);
if (random(10)<3) then
begin
mouseOffClient(OFF_CLIENT_LEFT); //Simple Antiban
wait(10000) (* ~TM - I wouldn't keep that static :s *)
end;
writeln(loadsDone, ' loads done. ', loadsDone * 28, ' items cooked, ', (loadsDone * 28) / (scriptTimer.getTime() / 1000 / 60 / 60), ' items per hour.'); //Proggy Report.
until (false); (* ~TM - Best proggy I've ever seen! *)
end.
PheteyGee
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 221 | Lines to spare ;) |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 15/20 | A bit repetitive. See comments re: proc/func |
|------------------- --------- ------------------------------------------------|
| o Original Code | 6/10 | Would like to see universal finding function |
|------------------- --------- ------------------------------------------------|
| o Presentation | 13/15 | Pretty good. Could have spaced it out a bit |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 11/15 | Needed failsafes (espesh w/ mainLoop structure)|
|------------------- --------- ------------------------------------------------|
| o Progress Report | 8/10 | Nice, but calculation error |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 0/10 | No SPF. I was close to crey but i didn't |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 8/10 | Some fancy sorting. Bit repetitive throughout |
|------------------- --------- ------------------------------------------------|
| o Comments | 1/5 | Gave some credits |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 0/5 | No SPS (could have done some location checks) |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 62/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 62/100 (C+) |
|-----------------------------}
program PheteyGeeColourCosher;
{$Define SMART}
{$I SRL-6/SRL.simba}
{Thank-you WU-TANG for the idea regarding coshing... completely reWrote for better use}
const
COL = 3940459;
TOL = 4;
HUE = 0.09; (* ~TM - ZOMG where do I put my details, I hate logging in manually I crey evertim *)
SAT = 0.28;
PAINT_ON_SMART = true;
STATUS_COLOUR = 109433;
var (* ~TM - First letter capital for global vars *)
XP, EXPperHour, startingEXP, antiBansPerformed, antiBanHammerNum, levelAtScriptStart: integer;
(* ~TM - Some of these should also be local to your progress report procedure *)
procedure paintStatus(status: string); //creditsTo TheMayor (Edited by me - PheteyGee)
begin
if PAINT_ON_SMART then
begin
smartImage.clear();
smartImage.drawText('Status: ' + status, point(mainscreen.X2 - 570, mainscreen.Y2 - 19), SmallChars, true, STATUS_COLOUR);
end;
end;
function antiBan: boolean; //Credits to theMayor (Edited by me - PheteyGee)
var
i: integer;
begin
i := random(500);
if i < 66 then
begin
writeln('Engaging in antiban');
inc(antiBansPerformed);
case i of
1..4: boredHuman(false);
5..20:
begin
wait(gaussRangeInt(1500, 3200));(* ~TM - Could have saved 3 lines! *)
end;
21..23: mouseMovingObject();
24..34: sleepAndMoveMouse(randomRange(100, 6000));
35..45:
begin
mouseOffClient(Random(4));
wait(randomRange(2000, 15000));
end;
46..50:
begin
hoverSkill(SKILL_THIEVING);
wait(randomRange(1000, 2000));
end;
51..55:
begin
randomCompass(0, 360, True);
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
56..66: pickUpMouse();
end;
end;
end;
function findVolunteer: Boolean; (* ~TM - It's goot practive to have parentheses () on function/procedure calls (lape's auto-invoke) *)
var
i, highestATPA: Integer;
volunteerTPA: TPointArray;
volunteerATPA: T2DPointArray;
p: Tpoint;
begin
paintStatus('Finding Volunteer');
FindColorsTolerance(volunteerTPA, COL, MainScreen.GetBounds, TOL, ColorSetting(2, HUE, SAT));
if (Length(volunteerTPA) < 1) then
begin
paintStatus('Nope, Can' 't Find Him... Trying again :)');
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH); (* ~TM - What is this for? I don't see how chooseOption will open *)
chooseOption._select(['Cancel', 'ancel'], MOUSE_LEFT, true, 1.00, 300);
findVolunteer;
Exit;
end;
wait(randomRange(200, 300));
volunteerATPA := volunteerTPA.ToATPA(20, 20); (* ~TM - you could mainScreen.playerPoint.rand(..) *)
SortATPAFromMidPoint(volunteerATPA, Point(randomRange(mainscreen.playerpoint.x - 50, mainscreen.playerpoint.x + 50), mainscreen.playerpoint.y));
highestATPA := High(volunteerATPA); (* ~TM - There really is no need for an extra variable here *)
for i := 0 to highestATPA do
begin
if (Length(volunteerATPA[i]) < 25) then
paintStatus('Found Him - Luring'); (* ~TM - It's probably cleaner to just mosueBox(..) the TPA bounds *)
Mouse(volunteerATPA[i][random(High(volunteerATPA[i]))], MOUSE_MOVE, MOUSE_HUMAN);
if IsMouseOverText(['alk', '-to', 'vance', 'dvance', 'ickpock'], 500) then (* ~TM - 'dvance' is redundant here, 'vance' will cover it *)
begin
fastclick(mouse_right); (* ~TM - Constants capital pls *)
Wait(randomRange(400, 700));
chooseOption._select(['ure', 'Lure'], MOUSE_LEFT, true, 1.00, 300); (* ~TM - Did 50ms (250->300) really make a difference here? *)
end;
end; (* ~TM - The result (boolean) is never assigned here - could be a procedure *)
end;
procedure spaceThroughChat;
begin
if (conversationBox.areTalking()) then
paintStatus('Going through his boring chat');
conversationBox.continue(true, true);
Wait(randomrange(300, 550));
conversationBox.continue(true, true);
Wait(randomrange(500, 700));
end;
function knockOutVolunteer: Boolean; (* ~TM - Very similar to findVolunteer, could you combine them? *)
var
i, highestATPA: Integer;
knockOutTPA: TPointArray;
knockOutATPA: T2DPointArray;
begin
paintStatus('Knocking Volunteer Out');
FindColorsTolerance(knockOutTPA, COL, MainScreen.GetBounds, TOL, ColorSetting(2, HUE, SAT));
if (Length(knockOutTPA) < 1) then
begin (* ~TM - don't need this begin/end *)
Exit;
end;
knockOutATPA := knockOutTPA.ToATPA(20, 20);
SortATPAFromMidPoint(knockOutATPA, Point(randomRange(mainscreen.playerpoint.x - 50, mainscreen.playerpoint.x + 50), mainscreen.playerpoint.y));
highestATPA := High(knockOutATPA);
for i := 0 to highestATPA do
begin
if (Length(knockOutATPA[i]) < 75) then
Mouse(knockOutATPA[i][random(High(knockOutATPA[i]))], MOUSE_MOVE, MOUSE_HUMAN);
if IsMouseOverText(['alk', '-to', 'vance', 'dvance', 'ickpock'], 500) then
fastclick(mouse_right);
Wait(randomRange(400, 700));
chooseOption._select(['nock', '-out'], MOUSE_LEFT, true, 1.00, 300);
end;
end; (* ~TM - The result (boolean) is never assigned here - could be a procedure *)
procedure lootThrice;
var
i, highestATPA, num: integer;
lootingTPA: TPointArray;
lootingATPA: T2DPointArray;
begin
paintStatus('Looting');
Wait(200);
num := random(1); (* ~TM - Not sure what is going on here: random(1) will return 0, always *)
if num = 1 then
begin
num := random(1);
end;
FindColorsTolerance(lootingTPA, COL, MainScreen.GetBounds, TOL, ColorSetting(2, HUE, SAT));
if (Length(lootingTPA) < 1) then
begin (* ~TM - don't need this begin/end *)
Exit;
end;
lootingATPA := lootingTPA.ToATPA(20, 20);
SortATPAFromMidPoint(lootingATPA, Point(randomRange(mainscreen.playerpoint.x - 50, mainscreen.playerpoint.x + 50), mainscreen.playerpoint.y));
highestATPA := High(lootingATPA);
for i := 0 to highestATPA do
begin
if (Length(lootingATPA[i]) < 70) then
repeat
Mouse(lootingATPA[i][random(High(lootingATPA[i]))], MOUSE_MOVE, MOUSE_HUMAN);
if IsMouseOverText(['alk', '-to', 'vance', 'dvance', 'ickpock'], 50) then
fastclick(mouse_right);
Wait(randomRange(20, 40));
(chooseOption.select(['oot']));
inc(num);
until (num = 3);
end;
end;
procedure progressReport;
var
levelsGained: integer;
begin
XP := (chatBox.getXPBar - startingEXP);
EXPperHour := round(XP * (3600.0 / (getTimeRunning / 1000.0)));
levelAtScriptStart := tabStats.getSkillLevel(Skill_Thieving); (* ~TM - But this will be recalculated each time this is called *)
levelsGained := tabStats.getSkillLevel(Skill_Thieving) - levelAtScriptStart; (* ~TM - will always return 0 *)
writeln('|======================================|');
writeln('| PheteyGee Coshing Progress |');
writeln('|______________________________________|');
writeln(padR('| Running For: ' + timeRunning, 39) + '|');
writeln(padR('| Exp Earned: ' + InttoStr(XP), 39) + '|');
writeln(padR('| Exp/Hour: ' + InttoStr(EXPperHour), 39) + '|');
writeln(padR('| Anti-BanHammers: ' + InttoStr(antiBansPerformed), 39) + '|');
writeln(padR('| Levels Gained: ' + InttoStr(levelsGained), 39) + '|');
writeln('|______________________________________|');
end;
procedure setupStuff;
begin
smartPlugins := ['d3d9.dll'];
disableSRLDebug := true;
smartEnableDrawing := true;
SetupSRL();
startingEXP := chatBox.getXPBar; (* ~TM - LevelAtStartUp should be calculated here! *)
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
progressReport;
end;
begin
setupStuff;
repeat
antiBanHammerNum := random(70);
FindVolunteer;
Wait(randomrange(300, 700));
spaceThroughChat; (* ~TM - If one of these fails, it will continue to the next method regardless *)
Wait(randomrange(200, 550));
knockOutVolunteer;
Wait(randomRange(20, 70));
lootThrice;
wait(randomRange(200, 300));
clearDebug();
progressReport;
Wait(randomrange(1800, 2400));
if (antiBanHammerNum > 30) then
begin
antiBan();
end;
until (False); (* ~TM - Would be nice to see 6 hour fix! *)
end.
Yuskie
Simba Code:{------------------------------------------------------------------------------|
| CRITERIA | MARKS | COMMENTS |
|------------------- --------- ------------------------------------------------|
| o 250 Lines | 123 | |
|------------------- --------- ------------------------------------------------|
| o Use of SRL-6 | 10/20 | Good start, but largely unfinished |
|------------------- --------- ------------------------------------------------|
| o Original Code | 5/10 | Nothing really unique as incomplete |
|------------------- --------- ------------------------------------------------|
| o Presentation | 12/15 | Not bad actually ;) |
|------------------- --------- ------------------------------------------------|
| o Failsafes | 3/15 | A few isLoggedIn() checks, nothing more |
|------------------- --------- ------------------------------------------------|
| o Progress Report | 4/10 | Base is there, but incomplete |
|------------------- --------- ------------------------------------------------|
| o SRL Player Form | 9/10 | A wee bit messy with tutorial comments |
|------------------- --------- ------------------------------------------------|
| o TPAs/ATPAs | 0/10 | None |
|------------------- --------- ------------------------------------------------|
| o Comments | 3/5 | Adequate |
|------------------- --------- ------------------------------------------------|
| o Use of SPS | 2/5 | Custom TSPSArea, but unfinished |
|------------------- --------- ------------------------------------------------|
|-----------------------------|
| ** Total Marks | 48/100 |
|-----------------------------|
| ** Weighted at | 1.0 |
|------------------- ---------|
| FINAL GRADE: 48/100 (D) |
|-----------------------------}
program new;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
procedure initPlayerForm();
var
telesDone: Integer; (* ~TM - These variables are not needed here :) *)
action : String;
begin
with playerForm do
begin
name := 'Slayer - Beta (for edgeville)'; // the title of the SPF, usually the name of your script
scriptHelpThread := ''; // a link to a help thread, if set to '' will link to my setup guide
editBoxLabels := ['Minutes to Rest for', 'Minutes before Resting']; // edit boxes are created for each array element
editBoxDefaults := ['20', '90']; // optional default values for each edit box; array length must equal editBoxLabel length
end;
end; // again, not restricted to the procedure name, although it's recommended
procedure declarePlayers(); (* ~TM - You had space to burn, you should've spaced these out *)
var
i: integer;
begin
players.setup(playerForm.players); // load the SPF players from the SRL Player Manager
currentPlayer := 0; // player to use first
// set player attributes based on the settings from the form
for i := 0 to high(players) do
with players[i] do
begin
// convert the integers
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
end;
end;
procedure runToEdgeDunge(); // goes from lorde to yew/trap door area
var
pathToEdge: TPointArray;
x, y : integer; (* ~TM - What are 'x' and 'y' used for? *)
map_above_ground: TSPSArea;
begin
map_above_ground.setup('Slayer_Edgeville', RUNESCAPE_OTHER); (* ~TM - Ideally you would setup your map at the start*)
if not isLoggedIn() then exit;
pathToEdge:=[Point(191, 164), Point(219, 175), Point(258, 206), Point(278, 242), Point(292, 273), Point(292, 303)];
if map_above_ground.walkPath(pathToEdge) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the start');
end;
procedure teleToEdge(); // from EvergreenChopBank
var
result : boolean; (* ~TM - Not quite what a result is, and not really needed here *)
begin
if not isLoggedIn() then exit;
result := lodestoneScreen.teleportTo(LOCATION_EDGEVILLE);
if (result) then (* ~TM - if lodestoneScreen... then ... *)
begin
wait(gaussRangeInt(18000, 22000));
//minimap.setAngle(MM_DIRECTION_NORTH);
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
end;
end;
procedure walkToGate(); // This should work once I get pathing corrected
var // it walks to the first gate in the edge dungeon from edge
pathToGate: TPointArray;
map_underground: TSPSArea;
begin
map_underground.setup('edge', RUNESCAPE_OTHER);
if not isLoggedIn() then exit;
pathToGate := [Point(161, 260), Point(164, 238), Point(165, 220), Point(162, 195), Point(161, 163), Point(161, 125), Point(167, 101), Point(181, 99)];
if map_underground.walkPath(pathToGate) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to gate');
end;
procedure goToDunge(); // tries to go to dunge by opening trapdoor and climbing down
var
x,y : integer;
begin
mainscreen.findObject(x, y, 2834004, 2, colorSetting(2, 0.31, 0.86), mainscreen.playerPoint, 30, 50, 50, ['pen', 'door'], MOUSE_LEFT);
wait(randomRange(5000,10000));
mainscreen.findObject(x, y, 3421217, 9, colorSetting(2, 5.30, 1.11), mainscreen.playerPoint, 30, 50, 50, ['limb', 'ladder'], MOUSE_LEFT);
wait(randomRange(5000,10000));
end;
procedure progressReport();
var
expGained, tasksCompleted : integer;
begin
(* ~TM - Seems somewhat unfinished :( *)
writeLn('========================================================');
writeLn('The Slayer Beta - by Yuskie');
writeLn('Current action:');
writeLn('Time Run: ');
writeLn('Experience gained: ');
writeLn('Tasks Done: ');
writeLn('Exp Per Hour: ');
writeLn('========================================================');
end;
begin
clearDebug();
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
exit;
declarePlayers();
setupSRL(); // Sets up login for player
while not isLoggedIn() do
begin
players[currentPlayer].login();
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
claimTicket();
exitTreasure();
closeAdWindow();
end;
teleToEdge();
runToEdgeDunge();
goToDunge();
writeLn(sps.getPlayerPos());
//walkToGate(); //not included since position isn't recognized.
progressReport(); (* ~TM - So it walks to the trapsoor and climbs down the ladder :p *)
end.
Until next time!