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.