SRL Archive - First Scripts

First script: Bronze bar maker from scratch. BETA (Multi-Skilled).


Baba

2015-01-12 13:27:38

Bronze bar maker v1.2


This script mines 14 copper and tin, then makes bronze bars.

Extra features added:
  • Some sort of "antiban"(needs improvements).
  • Progress report.
  • Status report.

Requirements:
  1. Best pickaxe in toolbelt or wielded(currently will bank if in inventory).
  2. Level 1 Mining.
  3. Level 1 Smithing.
  4. Unlocked Lumbridge lodestone.

Setup:
  • Use default SRL settings.
  • Add BARMAKER_MAP to simba/includes/sps/img/runescape_other
  • Start: Anywhere between lumbridge mine and lodestone; Or at Lumbridge chest bank;

Known bugs:
Sometimes misclicks ore when trying to mine(very random so left like antiban).

Credits:
@The Mayor; for his tutorials(took some antiban from your VEBminer :D ).

Change log:
[BarMaker v1.0] 2015-01-13 19:44
[BarMaker v1.1] 2015-01-15 20:47
[BarMaker v1.2] 2015-01-17 23:17
[INDENT]-| By Baba |-[/INDENT]

Zef Style

2015-01-12 14:44:32

your RS account password is in the script, you are going to want to change that.., I am sending you a PM to let you know also

Baba

2015-01-12 14:51:33

Oh lol forgot to delete. Thank you very much!

The Mayor

2015-01-12 15:11:55

I actually wanted to make a script like this! Looks good ;)


program bronzeBar; //Vyc? G?jus

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

var
loadsDone: integer;

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'un'; //Fill your details
password := 'pw'; //Fill your details
isActive := true;
isMember := false; //true if member
end
currentPlayer := 0;
end;

procedure paintStatus(status: String);
begin
{$IFDEF SMART}
try
smartImage.clear();
smartImage.drawText('Status: ' + status, point(chatbox.x2 - 320, chatbox.y2 - 19), smallChars, false, 255);
except
end;
{$ENDIF}
end;


procedure antiBan(ran: Integer; walking: Boolean = false); // ~TM you probably don't need the 'walking' boolean now ;)
var
i: Integer;
xpPopup: TBox;
begin
if not isLoggedIn() then
exit;
i := random(ran);
if i < 63 then
begin
paintStatus('Doing "antiban"');
case i of
0..4: mouseMovingObject();
5..20: begin
xpPopup := intToBox(383, 8, 417, 44);
mouseBox(xpPopup, MOUSE_MOVE);
wait(randomRange(400, 1000));
end;
21..23: mouseMovingObject();
24..34: sleepAndMoveMouse(randomRange(100, 900));
35..45: begin
mouseOffClient(random(4));
wait(randomRange(2000, 3000));
end;
46..50: wait(randomRange(648, 1576));
51..55: randomCameraAngle(MS_ANGLE_HIGH);
56..63: pickUpMouse();
63..66: hoverRandomSkill();
67..72: pickUpMouse();
end;
end;
end;

procedure compassButton(); //Can't find in SRL // ~TM minimap.clickCompass();
var
compassButton: TBox;
begin
compassButton := intToBox(588, 23, 609, 46);
mouseBox(compassButton, MOUSE_LEFT);
wait(randomRange(400, 1000));
end;

procedure doubleCheck; // ~TM good practice to put () at end of proc/func
begin
if bankScreen.isOpen then
begin // ~TM indent
paintStatus('Banking');
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(400, 1000));
bankScreen.close();
wait(randomRange(400, 1000));
end;
end;

procedure checkForBank();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin // ~TM indent
paintStatus('Checking for bank chest');
repeat
findColorsSpiralTolerance(x, y, TPA, 9667964, mainScreen.getBounds(), 10, colorSetting(11, 0.11, 0.34));
if (Length(TPA) < 1) then
exit; // ~TM indent
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(1, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
doubleCheck; // ~TM ()
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Bank chest', 'ank chest'], 500) then
begin
smartImage.clear; // ~TM ()
exit;
end; // ~TM Why not open the bank here too? So opening bank is not split over multiple procedures
end;
until isMouseOverText(['Bank chest', 'ank chest'], 500); // ~TM This is actually an infinite loop. What if bank not visible?
end;

procedure teleToLumbridge();
var
p: TPoint;
begin
if not isLoggedIn() then
exit;
doubleCheck; // ~TM indent
lodestoneScreen.teleportTo(LOCATION_LUMBRIDGE);
antiBan(1000);
wait(randomRange(1000, 2000));
repeat // ~TM indent
mouse(point(-20 + (randomRange(-1, -30)) , -20 + (randomRange(-1, -30))));
paintStatus('Teleporting to Lumbridge');
wait(randomRange(14581, 16054));
until (not isLoggedIn()) or minimap.findSymbol(p, MM_SYMBOL_LODESTONE, minimap.getBounds());
wait(randomRange(1000, 2000));
end;


procedure checkLocation; //Need help to fix (should check if bank is open, then bank all the items close the bank and check for the Bank symbol in MM if true teleport to Lumbridge)
var
myPoint: TPoint;
begin // ~TM indent
if not isLoggedIn() then
exit;
paintStatus('Checking location');
doubleCheck;
if minimap.findSymbol(myPoint, MM_SYMBOL_BANK, minimap.getBounds()) then
begin
teleToLumbridge;
end;
end;

procedure runToMine();
var // ~TM indent
pathToMine: TPointArray;
begin
if not isLoggedIn() then
exit;
paintStatus('Running to the mine');
pathToMine := [Point(195, 192), Point(199, 217), Point(201, 239), Point(202, 256), Point(204, 277), Point(213, 283), Point(237, 295), Point(236, 331), Point(222, 360), Point(215, 398), Point(212, 433), Point(189, 471), Point(169, 494)];
if SPS.walkPath(pathToMine) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the mine');
end;

procedure mineCopper();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
mineTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
if tabBackpack.isItemInSlot(14) then
exit;
minimap.setAngle(80+(randomRange(1, 20)));
mainScreen.setAngle(MS_ANGLE_HIGH);
mineTimer.start();
repeat
findColorsSpiralTolerance(x, y, TPA, 11919098, mainScreen.getBounds(), 16, colorSetting(15, 0.09, 0.82));
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Copper ore rock', 'opper ore rock'], 500) then
begin
fastClick(MOUSE_LEFT);
wait(randomRange(1618, 1865));
smartImage.clear;
break;
end;
end;
if not tabBackpack.isItemInSlot(13) then // ~TM Why have you got the same code twice? It's already in a loop
findColorsSpiralTolerance(x, y, TPA, 11919098, mainScreen.getBounds(), 16, colorSetting(15, 0.09, 0.82));
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(1, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 1 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Copper ore rock', 'opper ore rock'], 500) then
begin
tabBackpack.waitForShift(randomRange(5153, 6482));
fastClick(MOUSE_LEFT);
break;
end;
end;
paintStatus('Mining copper');
wait(random(300));
antiBan(300);
tabBackpack.waitForShift(randomRange(5153, 6482));
claimSpinTicket();
until tabBackpack.isFull() or tabBackpack.isItemInSlot(14) or (mineTimer.getTime() > 600000);
end;


procedure mineTin();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
mineTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
minimap.setAngle(75 + (randomRange(1, 20)));
mainScreen.setAngle(MS_ANGLE_HIGH);
if not tabBackpack.isItemInSlot(28) then
wait(randomRange(300, 400));
mineTimer.start();
repeat
findColorsSpiralTolerance(x, y, TPA, 13417934, mainScreen.getBounds(), 20, colorSetting(12, 0.79, 0.48));
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Tin ore rock', 'in ore rock'], 500) then
begin
fastClick(MOUSE_LEFT);
wait(randomRange(1618, 1865));
smartImage.clear;
break;
end;
end; // ~TM Why not mine copper until pack.count() = 14, then mine tin until pack.isFull()

if not tabBackpack.isItemInSlot(27) then
begin
findColorsSpiralTolerance(x, y, TPA, 13417934, mainScreen.getBounds(), 20, colorSetting(12, 0.79, 0.48));
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(1, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 1 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Tin ore rock', 'in ore rock'], 500) then
begin
tabBackpack.waitForShift(randomRange(5153, 6482));
fastClick(MOUSE_LEFT);
smartImage.clear;
break;
end;
end;
end;
paintStatus('Mining tin');
wait(random(300));
antiBan(300);
tabBackpack.waitForShift(randomRange(5153, 6482));
claimSpinTicket();
until tabBackpack.isFull() or (mineTimer.getTime() > 600000);
end;


procedure runToFurnace();
var // ~TM Indent
pathToMine: TPointArray;
begin
if not isLoggedIn() then
exit;
paintStatus('Running to the furnace ');
pathToMine := [Point(188, 169), Point(180, 151), Point(167, 129), Point(165, 108), Point(166, 87), Point(166, 70)];
if SPS.walkPath(pathToMine) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the furnace');
end;

procedure makeBars();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
repeat
paintStatus('Trying to make bars');
findColorsSpiralTolerance(x, y, TPA, 1121977, mainScreen.getBounds(), 10, colorSetting(2, 0.04, 0.54));
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Furnace', 'urnace'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clear;
break;
end;
end;
wait(randomRange(1000, 2000));
until productionScreen.isOpen; // ~TM Indent
productionScreen.selectBox(1);
productionScreen.clickStart();
wait(random(2000));
antiBan(1000);
antiBan(1000);
antiBan(1000);
paintStatus('Repositioning for bank chest');
compassButton;
wait(random(600));
typeByteWait(VK_RIGHT, 150 + random(100));
wait(random(600));
checkForBank;
paintStatus('Waiting for bars');
repeat // ~TM You should def check out the progressScreen for this
wait(1000+random(300));
until (not tabBackpack.isItemInSlot(26) );
wait(randomRange(12000, 13000));
inc(LoadsDone);
end;

procedure bankBars();

begin
if not isLoggedIn() then
exit;

paintStatus('Trying to bank'); // ~ TM Getting a bit messy here
repeat
if not isMouseOverText(['Use Bank chest', 'Bank chest'], 500) then
checkForBank;
until isMouseOverText(['Use Bank chest', 'Bank chest'], 500) or (not tabBackpack.isItemInSlot(28)) or bankScreen.isOpen;
fastClick(MOUSE_LEFT);
mouse(MOUSE_MOVE, 1+randomRange(100, 200), 1+randomRange(100, 200));
repeat
wait(randomRange(300, 1000));
until bankScreen.isOpen;
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(400, 1000));
bankScreen.close();
wait(randomRange(400, 1000));
doubleCheck;
end;

procedure runToMineFromBank();
begin
//don't know if needed
end;

procedure progressReport();
var
barsMade, profit, profitPerHour: integer;
begin
barsMade := loadsDone * 14;
profit := (barsMade * 210);
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));

writeLn('========================================================');
writeLn(' BarMaker BETA');
writeLn('Time Run: ' + timeRunning);
writeLn('Bars Made: ~' + intToStr(barsMade));
writeLn('Loads Done: ' + intToStr(loadsDone));
writeLn('Profit Made: ' + intToStr(profit));
writeLn('Per Hour: ' + intToStr(profitPerHour));
writeLn('========================================================');
end;


{Main Loop}
begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
paintStatus('Setting up SMART');
declarePlayers();

SPS.setup('BARMAKER_MAP', RUNESCAPE_OTHER);

if not isLoggedIn() then // ~TM I'd throw this block in the repeat loop below
begin
players[currentPlayer].login();
exitSquealOfFortune();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;

checkLocation;
repeat
runToMine();
mineCopper();
mineTin();
teleToLumbridge();
runToFurnace();
makeBars();
bankBars();
teleToLumbridge();
clearDebug();
progressReport();
until(false);

end.

Baba

2015-01-12 15:23:13

@The Mayor;
I added same code to the mining procedures to make mouse while mining hower over another rock and click when finished, couldn't think of a better way.

The Mayor

2015-01-12 15:29:20

From: Baba
@The Mayor;
I added same code to the mining procedures to make mouse while mining hower over another rock and click when finished, couldn't think of a better way.


Ahh yes, I didn't see you removed the click ;)

Hoodz

2015-01-12 16:35:23

From: Zef Style
your RS account password is in the script, you are going to want to change that.., I am sending you a PM to let you know also

Very nice of you, rep+
From: Baba
Oh lol forgot to delete. Thank you very much!


Congratulations on release, very nice script! :)

Baba

2015-01-12 16:54:30

From: hoodz
Very nice of you, rep+


Congratulations on release, very nice script! :)


Thank you :) Tomorrow will make banking more reliable and maybe a braking system if could figure out how to make one.

Baba

2015-01-13 12:45:20

UPDATED
[v1.0]
- Improved banking;
- Improved smithing recognition;

Theron

2015-01-14 23:40:20

From: Baba
UPDATED
[v1.0]
- Improved banking;
- Improved smithing recognition;


Running your script now. I'll try to get a good proggy for you. It's running very well, very impressive for a first script. Thanks mate!


seems to get stuck while trying to bank. Maybe it's a lag issue on my part. Think about adding a failsafe or something along those lines.

BarMaker V1.0
Time Run: 1 Hour, 14 Minutes and 15 Seconds
Bars Made: ~140
Loads Done: 10
Profit Made: 29400
Per Hour: 23752

Baba

2015-01-15 01:52:05

From: Theron
Running your script now. I'll try to get a good proggy for you. It's running very well, very impressive for a first script. Thanks mate!


seems to get stuck while trying to bank. Maybe it's a lag issue on my part. Think about adding a failsafe or something along those lines.

BarMaker V1.0
Time Run: 1 Hour, 14 Minutes and 15 Seconds
Bars Made: ~140
Loads Done: 10
Profit Made: 29400
Per Hour: 23752


Can you describe in which part did it got stuck?

Blasphery

2015-01-15 02:22:52

I will test this ! Update you on any issues later on :)

Baba

2015-01-15 07:51:04

From: Blasphery
I will test this ! Update you on any issues later on :)


Looking forward for an update :)

Blasphery

2015-01-15 08:09:14

From: Baba
Looking forward for an update :)

But first gotta mine some ores. Haha.

Baba

2015-01-15 08:17:52

From: Blasphery
But first gotta mine some ores. Haha.


This script mines 14 tin and copper, and makes the bars :D

Theron

2015-01-15 11:57:48

From: Baba
Can you describe in which part did it got stuck?


Well, it would finish making the bars, it would already be hovering over the bank chest, so it would just click, run to the chest, the chest would open, but it wouldn't quick deposit the bars. The bank would just stay open. It happened twice in an hour. Decided not to run overnight for that reason, I really like it, other that problem that I am having.

Blasphery

2015-01-15 12:58:23

From: Baba
This script mines 14 tin and copper, and makes the bars :D


Yup..will try it soon. Been busy lately

Baba

2015-01-15 13:48:46

From: Theron
Well, it would finish making the bars, it would already be hovering over the bank chest, so it would just click, run to the chest, the chest would open, but it wouldn't quick deposit the bars. The bank would just stay open. It happened twice in an hour. Decided not to run overnight for that reason, I really like it, other that problem that I am having.


From: Blasphery
Yup..will try it soon. Been busy lately


UPDATED
[v1.1]
- Fixed banking bug;
- Faster furnace recognition;
- Added failsafe when teleporting;
- Removed a bit of unnecesary code;

Theron

2015-01-15 22:57:22

========================================================
BarMaker V1.1
Time Run: 2 Hours, 12 Minutes and 28 Seconds
Bars Made: ~378
Loads Done: 27
Profit Made: 80136
Per Hour: 36294
========================================================


========================================================
BarMaker V1.1
Time Run: 8 Hours, 41 Minutes and 3 Seconds
Bars Made: ~1484
Loads Done: 106
Profit Made: 314608
Per Hour: 36228
========================================================


Not bad at all. Hoping you add smithing the bars into items.

Baba

2015-01-16 09:23:12

From: Theron
Not bad at all. Hoping you add smithing the bars into items.


Thank you for testing, didn't think it could pass 6h log :D Smithing the bars into items should come tomorrow or sunday, sorry for the inconvenience, but weekend is here :D

Theron

2015-01-16 09:51:21

From: Baba
Thank you for testing, didn't think it could pass 6h log :D Smithing the bars into items should come tomorrow or sunday, sorry for the inconvenience, but weekend is here :D


My pleasure, I was surprised at how well it ran, considering its your first script. No inconvenience at all.

Baba

2015-01-17 16:18:14

UPDATED
[v1.2]
-Added ability to choose to make bars into items;
-Improved progress report;

Theron

2015-01-18 11:21:55

From: Baba
UPDATED
[v1.2]
-Added ability to choose to make bars into items;
-Improved progress report;


I'll run it for a few hours when I get home, most impressed.