Code:
program DwtIronMiner2;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
const
ANTIBAN_CHANCE = 10; //e.g. 10 is a 10% chance for antiban after mining an ore
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'Username'; //put your usename here
password := 'Password'; //put your password here
isActive := true;
world := - 1; //desired world
isMember := false;
end
currentPlayer := 0;
end;
/////////////////////////////////////////////////////////////////////////////
// Don't touch below this line unless you know what you're doing!! ///////
////////////////////////////////////////////////////////////////////////////
////////CREDITS TO TheMayor and Ross FOR MANY PARTS OF THIS SCRIPTS//////////////
///////////////////////////////////////////////////////////////////////////
///////HUGE THANKS TO TheMayor and Ross FOR YOUR TIME AND HELP/////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
const
MINE_TIMER = 12000;
MIN_PIXEL_SHIFT = 75;
DISABLE_DEBUG = true;
var
LoadsDone, Ironint, IronOre, scriptPaintBMP: integer;
p, Iron: string;
LOCATION_BOX: TBox := intToBox (370, 153, 405, 190);
procedure Message();
begin
writeLn('================================================================');
writeLn('================================================================');
writeLn('================================================================');
writeLn('///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
Writeln('////////----- Welcome to Dwt iron miner V2.0 by pipos1 ----\\\\\');
writeLn('///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
writeLn('======================hope you will like it :)==================');
writeLn('================================================================');
writeLn('================================================================');
end;
procedure antiBan(); //some simple random antiban
var
i: integer;
begin
i := random(100);
if i <= ANTIBAN_CHANCE then
begin
writeln('Doing antiban.');
case random(5) of
0:
begin
writeln('Pick up mouse.');
pickUpMouse();
end;
1:
begin
writeln('Mouse off client.');
mouseOffClient(OFF_CLIENT_RANDOM);
end;
2:
begin
writeln('Sleep and move mouse.');
sleepAndMoveMouse(random(1000) + 1000);
end;
3:
begin
writeln('Random wait time.');
wait(randomRange(1350, 4375));
end;
4:
begin
writeln('Checking mining skill.');
hoverSkill(SKILL_MINING);
end;
end;
tabBackpack.Open;
end;
end;
procedure checkLocation(); // thanks to The Mayor this is way better than the first one
begin
if sps.isInBox(LOCATION_BOX) then
writeLn('We are inside the mine, no more ore left.')
else
begin
writeLn('We are not inside the mine, walking there.');
SPS.walkToPos(LOCATION_BOX.getGaussPoint());
end;
end;
procedure RunToMine();
var
RunToMine: TPointArray;
begin
if not isLoggedIn() then
exit;
writeln('Run to mine.');
case random(3) of
0:
begin
RunToMine := [Point(502, 342), Point(465, 329), Point(439, 319), Point(409, 294), Point(387, 275), Point(371, 232), Point(368, 198), Point(388, 167)];
writeln('Random path 1.');
end;
1:
begin
RunToMine := [Point(502, 340), Point(472, 323), Point(450, 309), Point(422, 292), Point(408, 269), Point(387, 242), Point(380, 205), Point(387, 170)];
writeln('Random path 2.');
end;
2:
begin
RunToMine := [Point(502, 340), Point(471, 306), Point(444, 283), Point(419, 253), Point(409, 229), Point(409, 198), Point(387, 168)];
writeln('Random path 3.');
end;
end
SPS.walkPath(RunToMine);
end;
procedure randomMouse(chance: Integer; sleep: Boolean = false; min, max: Integer = 0);
begin
if random(chance) = 1 then
if sleep then
sleepAndMoveMouse(randomRange(min, max))
else
smallRandomMouse();
end;
function isPlayerMoving(minShift: Integer): Boolean;
var
shift: Integer;
begin
shift := getPixelShiftAverage(mainscreen.playerBox, 150, 700);
result := shift > minShift;
end;
function waitPackMoving(minShift, maxTime: Integer): Boolean;
var
count: Integer;
t: TTimeMarker;
begin
count := tabBackpack.count();
wait(randomRange(600, 800));
t.start();
repeat
wait(250);
randomMouse(8);
randomMouse(12, true, 500, 4000);
if tabBackpack.count() <> count then
begin
exit(true);
end;
until (not isPlayerMoving(minShift)) or (t.getTime() > maxTime);
end;
procedure MineIron();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
writeln('Starting mining iron ore.');
if not isLoggedIn() then
exit;
repeat
wait(randomRange(767, 1234));
findColorsSpiralTolerance(x, y, TPA, 2306391, mainScreen.getBounds(), 5, colorSetting(2, 0.09, 0.25));
if (Length(TPA) < 1) then
checkLocation;
ATPA := TPA.toATPA(25, 25);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
smartImage.clearArea(ATPA.getBounds()) for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ron'], 500) then
begin
fastClick(MOUSE_LEFT);
antiBan();
break;
end;
end;
waitPackMoving(MIN_PIXEL_SHIFT, MINE_TIMER + random(1000));
until tabBackpack.isFull() or (not isLoggedIn());
end;
procedure TeleToClanCamp();
var
x, y, VexillumDTM: integer;
p: Tpoint
begin
if not isLoggedIn() then
exit;
begin
VexillumDTM := DTMFromString('mggAAAHicY2NgYChmYmCoA+JaIC4B4mwo3sbIwLABiHcC8QkoDeJndG4H6mLCwJIM2AEjDgwBAFuUCPI=');
gameTabs.openTab(TAB_EQUIPMENT);
repeat
if findDTM(VexillumDTM, x, y, tabBackPack.getBounds()) then
mouse(x, y, 8, 8, MOUSE_MOVE);
if isMouseOverText(['lan', 'exillum']) then
fastClick(MOUSE_RIGHT);
wait(randomRange(150, 700));
if chooseOption.select(['alador']) then
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Teleporting to clan camp.');
wait(randomRange(5000, 6000));
gameTabs.openTab(TAB_BACKPACK);
until (not isLoggedIn()) or (minimap.findSymbol)(p, MM_SYMBOL_BANK, minimap.getBounds());
end;
end;
procedure RunToChest();
var
RunToChest: TPointArray;
begin
if not isLoggedIn() then
exit;
writeln('Run to bank.');
case random(3) of
0:
begin
RunToChest := [Point(498, 347)];
writeln('Random path 1.');
end;
1:
begin
RunToChest := [Point(504, 340)];
writeln('Random path 2.');
end;
2:
begin
RunToChest := [Point(504, 328)];
writeln('Random path 3.');
end;
end
SPS.walkPath(RunToChest);
end;
procedure FindChest();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
BankTimer: TTimeMarker;
p: Tpoint
begin
if not isLoggedIn() then
exit;
BankTimer.start();
case random(2) of
0:
begin
writeln('Using bank color 1.');
repeat
findColorsSpiralTolerance(x, y, TPA, 6586275, mainScreen.getBounds(), 3, colorSetting(2, 0.24, 0.43));
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
smartImage.clearArea(ATPA.getBounds()) for i := 0 to high(ATPA) do
begin
writeln('Opening bank.');
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank'], 500) then
begin
fastClick(MOUSE_LEFT);
wait(randomRange(2345, 3234));
break;
end;
end;
if (BankTimer.getTime() > 15000) then
begin
if minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds) then
begin
mouse(p.x, p.y, 3, 3, MOUSE_LEFT);
wait(randomRange(456, 1123));
minimap.waitPlayerMoving();
end;
end;
until bankScreen.isOpen() or (not isLoggedIn());
end;
1:
begin
writeln('Using bank color 2.');
repeat
findColorsSpiralTolerance(x, y, TPA, 11773851, mainScreen.getBounds(), 4, colorSetting(2, 0.14, 0.37));
ATPA := TPA.toATPA(15, 15);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
smartImage.clearArea(ATPA.getBounds()) for i := 0 to high(ATPA) do
begin
writeln('Opening bank.');
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank'], 500) then
begin
fastClick(MOUSE_LEFT);
wait(randomRange(2345, 3234));
break;
end;
end;
if (BankTimer.getTime() > 15000) then
begin
writeln('Didnt find bank clicking on bank symbol on minimap.');
if minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds) then
begin
mouse(p.x, p.y, 3, 3, MOUSE_LEFT);
wait(randomRange(456, 1123));
minimap.waitPlayerMoving();
end;
end;
until bankScreen.isOpen() or (not isLoggedIn());
end;
end;
end;
procedure DepositIron();
begin
if not isLoggedIn() then
exit;
if bankScreen.isOpen() then
writeln('Depositing iron ore.');
case random(2) of
0:
begin
writeln('Banking option 1.');
repeat
if bankScreen.getPackCount() > 0 then
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(543, 1234));
IronOre := IronOre + 28;
inc(LoadsDone);
bankScreen.close()
until bankScreen.getPackCount() = 0 or (not isLoggedIn());
end;
1:
begin
writeln('Banking option 2.');
repeat
mouse(573, 94, 12, 12, MOUSE_RIGHT);
chooseOption.select(['ll']);
wait(randomRange(234, 567));
inc(LoadsDone);
bankScreen.close()
until bankScreen.getPackCount() = 0 or (not isLoggedIn());
end;
end;
end;
procedure GetPrice();
begin
IronInt := grandExchange.getPrice(440);
end;
procedure ProgressReport();
var
IronOreMined, profit, profitPerHour, ExpMade, ExpPerHour: integer;
begin
ExpMade := LoadsDone * 980;
ExpPerHour := Round(((LoadsDone * 980) * 3600) / (GetTimeRunning / 1000));
IronOreMined := LoadsDone * 28;
profit := (IronOreMined * Ironint);
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));
begin
smartImage.clear;
smartImage.drawBitmap(scriptPaintBMP, Point(3, 461));
smartImage.drawText(ToStr(TimeRunning), Point(102, 474), 'smallChars', true, clWhite);
smartImage.drawText(ToStr(IronOreMined), Point(149, 500), 'smallChars', true, clWhite);
smartImage.drawText(ToStr(LoadsDone), Point(113, 530), 'smallChars', true, clWhite);
smartImage.drawText(ToStr(ExpMade) + 'exp earned', Point(412, 540), 'smallChars', true, clWhite);
smartImage.drawText(ToStr(ExpPerHour) + 'exp/hr', Point(412, 555), 'smallChars', true, clWhite);
smartImage.drawText(ToStr(profit) + 'gp earned', Point(412, 522), 'smallChars', true, clLime);
smartImage.drawText(ToStr(profitPerHour) + 'gp/hr', Point(412, 507), 'smallChars', true, clLime);
end;
end;
procedure scriptPaint();
begin
scriptPaintBMP := loadBitmap(appPath + '/includes/sps/img/runescape_other/DwtIronMinerimg.png');
smartImage.drawBitmap(scriptPaintBMP, Point(3, 461));
end;
procedure MainLoop();
begin
repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
exitTreasure();
claimTicket();
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
if tabBackpack.isFull() then
begin
TeleToClanCamp();
RunToChest();
FindChest();
DepositIron();
end;
ProgressReport();
RunToMine();
MineIron();
antiBan();
until (false);
end;
begin
clearDebug();
GetPrice();
smartEnableDrawing := true;
disableSRLDebug := DISABLE_DEBUG;
SetupSRL;
declarePlayers();
SPS.setup('DwtIronMiner2.0', RUNESCAPE_OTHER);
scriptPaint();
Message();
MainLoop();
end.