Simba Code:
program VarrockMiner;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$i sps/lib/sps-rs3.simba}
{-------------------------------*********************************************-------------------------------}
{-------------------------------*********************************************-------------------------------}
{-------------------------------*********************************************-------------------------------}
{-------------------------------*********************************************-------------------------------}
{-============================== Varrock Iron Mine and Bank ==============================-}
{-============================== By Agoson ==============================-}
{-============================== Version 1.1 ==============================-}
{-------------------------------*********************************************-------------------------------}
{-------------------------------*********************************************-------------------------------}
{-------------------------------*********************************************-------------------------------}
{-------------------------------*********************************************-------------------------------}
//INSTRUCTIONS -------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------------------\\
//Enter your nick, file and desiredLoads amount ----------------------------------------------\\
//Start in VEB, the mine or anywhere in between ----------------------------------------------\\
//Make sure run is toggled -------------------------------------------------------------------\\
//Don't run for too long until I implement breaking! -----------------------------------------\\
//--------------------------------------------------------------------------------------------\\
const
nick:= 'God';
file:= 'TheMayor';
desiredLoads:= 120;
//--------------------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------------------\\
var
ToBank, ToMine: tpointarray;
location: string;
foundore: boolean;
loads, xpPh, xP, oreXP, orePh, oresMined, total, rTemp, inv, invTemp, breakTime, breakIntervals: integer; //Declaring multiple vars of same type on same line
// Procedure that sets up SRL, SPS, the player and relevant vars etc.
procedure setup
begin
total:= 0;
smartEnableDrawing := true;
setupSRL;
Players.Setup([nick], file);
CurrentPlayer := 0;
ToBank := [Point(505, 559), Point(508, 559), Point(510, 559), Point(512, 555), Point(514, 554), Point(515, 547), Point(517, 544), Point(519, 541), Point(520, 538), Point(522, 535), Point(524, 534), Point(529, 525), Point(529, 519), Point(529, 518), Point(530, 513), Point(530, 507), Point(530, 502), Point(531, 495), Point(530, 488), Point(528, 483), Point(528, 478), Point(529, 471), Point(528, 466), Point(528, 460), Point(528, 455), Point(529, 452), Point(530, 447), Point(530, 442), Point(530, 433), Point(528, 428), Point(530, 412), Point(527, 407), Point(522, 398), Point(517, 391), Point(515, 390), Point(514, 381), Point(507, 378), Point(508, 371), Point(509, 360), Point(507, 348), Point(504, 340), Point(500, 333), Point(493, 328), Point(488, 320), Point(480, 317), Point(475, 315), Point(461, 310), Point(449, 311), Point(435, 309), Point(425, 309), Point(420, 314), Point(409, 313), Point(404, 313), Point(399, 312), Point(389, 310), Point(381, 310), Point(374, 317), Point(373, 329), Point(374, 333), Point(374, 335), Point(376, 341), Point(377, 345), Point(375, 347), Point(372, 350)];
ToMine := [Point(369, 349), Point(369, 345), Point(369, 342), Point(369, 337), Point(369, 331), Point(370, 325), Point(370, 322), Point(370, 319), Point(370, 316), Point(373, 314), Point(378, 311), Point(381, 312), Point(387, 312), Point(390, 312), Point(393, 312), Point(397, 312), Point(403, 312), Point(409, 311), Point(413, 313), Point(418, 313), Point(422, 309), Point(425, 310), Point(431, 312), Point(436, 310), Point(440, 310), Point(445, 308), Point(449, 310), Point(453, 310), Point(457, 310), Point(462, 310), Point(466, 311), Point(468, 311), Point(474, 311), Point(478, 311), Point(482, 311), Point(487, 311), Point(490, 316), Point(494, 318), Point(496, 324), Point(501, 330), Point(504, 334), Point(504, 338), Point(511, 345), Point(513, 350), Point(513, 357), Point(508, 357), Point(506, 364), Point(509, 374), Point(509, 375), Point(515, 381), Point(515, 389), Point(522, 390), Point(520, 396), Point(524, 405), Point(527, 418), Point(528, 420), Point(529, 434), Point(528, 437), Point(525, 441), Point(525, 445), Point(525, 448), Point(525, 450), Point(528, 457), Point(528, 463), Point(528, 463), Point(527, 465), Point(527, 468), Point(527, 472), Point(527, 473), Point(529, 473), Point(529, 477), Point(529, 482), Point(529, 485), Point(530, 487), Point(531, 492), Point(532, 499), Point(533, 503), Point(533, 507), Point(533, 513), Point(530, 517), Point(527, 522), Point(521, 528), Point(519, 532), Point(518, 536), Point(515, 545), Point(514, 550), Point(511, 555), Point(510, 556), Point(505, 560), Point(505, 560)];
sps.setup('SPSVarrockIron', RUNESCAPE_SURFACE, 4, 600.0, 0.40);
players[currentPlayer].login();
mainscreen.setAngle(MS_ANGLE_HIGH);
oreXP:= 27;
end;
// Procedure courtesy of Coh3n, checks for spinticket etc
procedure Find_Randoms();
begin
ExitSquealOfFortune;
ClaimSpinTicket;
End;
// Credit - Ashaman, temporary fix to my very broken antiban, minor editting by moi.
Function Antiban: Boolean;
Var
I: Integer;
Begin
writeln('Performing Antiban');
I := Random(600);
Case I Of
1..10: boredHuman(false);
11..30:
Begin
hoverSkill(Skill_Mining);
Wait(GaussRangeInt(1000,2000));
End;
30..90: mouseMovingObject;
91..150: SleepAndMoveMouse(RandomRange(100,6000));
151..190:
Begin
MouseOffClient(Random(4));
Wait(RandomRange(2000, 15000));
End;
191..400: Wait(RandomRange(1000, 2000));
401..500: randomCameraAngle(MS_ANGLE_HIGH);
501..600: pickUpMouse();
End;
If (TabBackpack.Count<25) Then
Wait(GaussRangeInt(1000,1000));
End;
// The mayor is responsible for this, searches for TPAs then moves to each one individually
function findOre: boolean;
var
x, y, i, b: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn then
exit;
if tabBackpack.count < 28 then
// color // tol //CTS, hue, sat from ACA
if findColorsSpiralTolerance(x, y, TPA, 2504288, mainScreen.getBounds(), 10, colorSetting(2, 0.08, 0.20)) then
if (Length(TPA) < 1) then // if no matching TPoints are found, exit
exit;
ATPA := TPA.toATPA(30, 30); // split our TPA into boxes of 30 x 30 pixels and put into an ATPA
ATPA.sortFromMidPoint(mainscreen.playerPoint); // sort the array from player, so closest TPA to player is first in array
for i := 0 to high(ATPA) do
begin // move move to each TPA one at a time, until we get a match
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Mine Iron ore rocks'], 200) then
begin
GetMousePos(x, y);
b := Random(1000);
Mouse(point(x, y).rand(1), MOUSE_LEFT, MOUSE_HUMAN);
wait(200 + random(600));
if tabBackpack.waitForShift(4500) = true then // Waitfor inv to inc by 1
inc(oresMined); // Increase the oresmined variable by 1
writeln('Ores mined ', oresMined);
if b > 980 then
Antiban; // Call antiban
exit(true);
end;
end;
end;
// Credit to Ashaman script for the basis of this prog report
Procedure Progress;
begin
XP:= oresMined*oreXP;
xpPh:= Round(XP * (3600.0 / (GetTimeRunning / 1000.0)));
orePh:= Round((OresMined * (3600.0 / (GetTimeRunning / 1000.0))));
Writeln('~~~~~~~~~~~~ Varrock Iron Mine and Bank - Version 1 Public Release ~~~~~~~~~~~~') ;
Writeln('Time Running: ' + ToStr(TimeRunning));
Writeln('Ores Mined: ' + ToStr(oresMined));
Writeln('Ores Per Hour: ' + ToStr(orePh));
Writeln('Loads Done: ' + ToStr(loads));
Writeln('Experience Earned: ' + IntToStr(xP));
Writeln('Experience Per Hour: ' + ToStr(xpPh));
Writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
end;
// Procedure to print progress report and end script
procedure endScript;
begin
wait(randomRange(4000, 3000));
players[currentPlayer].exitToLobby();
Progress;
writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@Ending Script@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
writeln('Thank you for using Varrock Bank and Miner, all credits to the SRL community');
terminateScript;
end;
// Function to bank
function bank : boolean;
begin
if bankscreen.open(BANK_BOOTH) then
begin
inc(loads);
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
bankscreen.close(); // add a wait before close
exit(true);
end else
if bankscreen.open(BANK_NPC_BLUE) then
begin
inc(loads);
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
bankscreen.close();
exit(true);
end else
exit(false);
end;
// Function to attempt to bank or find MM symbol if banking not possible
function tryBank : boolean;
var
bs: TPoint;
b : integer;
begin
b:= tabBackpack.count;
if (b = 0) then
begin
writeln('Didnt bank because inventory is empty');
exit(false);
end else
if minimap.findSymbol(bs, MM_SYMBOL_BANK, minimap.getBounds()) then
begin
if bank then
exit(true);
end else
b:= tabBackpack.count; // no need to count again, b is already the count
if b > 0 then
if not bankscreen.isOpen then
begin
mouse(bs, MOUSE_LEFT, MOUSE_HUMAN);
if bank then
begin // no need for the begin and end else here
exit(true);
end else
end else
exit(false);
end;
// Function to walk to bank or mine depending on location
function tryWalk : boolean;
var
b : integer;
begin;
minimap.toggleRun(true);
b:= tabBackpack.count;
if b = 28 then
begin
if sps.walkPath(toBank) then
Antiban;
writeln('Walking path to the bank');
exit(true); // with no begin and end, it will exit true even if it didnt walk to bank
end else
b:= tabBackpack.count; // no need to count twice
if b = 0 then
begin
if sps.walkPath(toMine) then
Antiban;
writeln('Walking path to the mine');
exit(true);
end else
exit(false);
end;
// Function to mine if possible
function tryMine(): boolean;
var
t := getSystemTime() + 60000; // maximum one minute (can change to whatever you want) used as a failsafe in case something goes wrong
tt: TPoint;
begin
if minimap.findSymbol(tt, MM_SYMBOL_BANK, minimap.getBounds()) then //indent
begin
exit(false); // indent
end else
while ((not result) and (getSystemTime() < t)) do
begin
findOre();
result := (tabBackpack.count() = 28);
wait(100 + random(100));
end;
end;
// Main loop
procedure mainLoop;
begin
if not isLoggedIn then
exit;
find_Randoms;
if tabBackpack.count = 28 then
begin
tryBank;
Progress;
tryWalk;
end else
tryWalk;
tryMine;
end;
begin
setup;
Find_Randoms;
repeat
mainLoop; // in this repeat loop you should put if not isLoggedIn() then login
until loads = desiredLoads;
Progress;
TerminateScript;
end.