Give me a second to add a report to mine and I'll post it here.
program IronM1D1;
{$DEFINE SMART}
{$i AeroLib/AeroLib.Simba}
Const
//----------------------Being user setup----------------------//
DOPLAYERCHECKS = True; // Switch worlds if a nearby player is detected?
// Player info
P_USERNAME = '';
P_PASSWORD = '';
P_NICKNAME = '';
P_MEMBER = True;
// Break settings
cBREAK_IN = 80; // How long before we take a break? (minutes)
cBREAK_FOR = 10; // How long will we break for? (minutes)
cR_BREAK_IN = 25; // Random minutes to add/subtract from how long until we break
cR_BREAK_FOR = 7; // Random minutes to add/subjtract from break duraction
//----------------------End user setup----------------------//
// Core constants
VERSION_MAIN = 1.0;
VERSION_SUB = 0;
Var
timer_CS,sTimer,
rTimer : Timer;
item_IronOre : TItem;
oreCount : Integer;
obj_Rock : TMSObject;
Shutdown : Boolean = False;
SDReason : String = 'Player inactive';
procedure setSimbaWindowTitle(NewTitle: String);
var
i : Integer;
arr : TSysProcArr;
begin
arr := getprocesses();
for i:=0 to high(arr) do
if Pos('Simba -', arr[i].Title) > 0 then
setWindowTitle(arr[i].Handle, NewTitle);
end;
procedure setSMARTWindowTitle(NewTitle: String);
var
i : Integer;
arr : TSysProcArr;
begin
arr := getprocesses();
for i:=0 to high(arr) do
if Pos('SMART', arr[i].Title) > 0 then
setWindowTitle(arr[i].Handle, NewTitle);
end;
procedure declarePlayer();
begin
Me.Name := P_USERNAME;
Me.Pass := P_PASSWORD;
Me.Pin := '';
Me.Nick := P_NICKNAME;
Me.LampSkill := SKILL_MINING;
Me.Member := P_MEMBER;
Me.Active := True;
end;
procedure loadVars();
begin
obj_Rock.create('Iron rock', ['Mine Rocks','ne Ro'], [createCol(2107974, 6, 0.13, 0.28)], []);
with item_IronOre do
DTM := DTMFromString('mggAAAHicY2NgYDjExMCwCYh3APFBID4CxOeAuIyRgaEIiKuBuAGIC6B8Hz0loC5GDMyFVRQ3hgAARokIEw==');
timer_CS.start();
sTimer.start();
rTimer.start();
setupBreak(cBREAK_IN, cBREAK_FOR, cR_BREAK_IN, cR_BREAK_FOR);
end;
procedure freeGlobals();
begin
freeDTM(item_IronOre.DTM);
end;
procedure report();
var
mXP: Integer;
begin
mXP := max((oreCount*35), 1);
progressReport(RESULT_DEBUGBOX, 'Iron M1D1', 'Flight', 'V '+toStr(VERSION_MAIN)+' Rev '+toStr(VERSION_SUB),
['Total run time','Mining XP','Ores mined','Breaks','Logged in'],
[MsToTime(getTimeRunning(),Time_Abbrev),intToStrEx(mXP)+' ('+intToStrEx(getPerHour(mXP))+'/Hr)',
intToStrEx(oreCount)+' ('+intToStrEx(getPerHour(oreCount))+'/Hr)',break_Count,count_Login]);
randomsReport();
writeln('Time until break: '+msToTime(getTimeUntilBreak(), Time_Bare));
end;
procedure checkForPlayers();
var
W,i : Integer;
Switch : Boolean = False;
begin
if not DOPLAYERCHECKS then Exit;
for i:=1 to 3 do
if length(getMiniMapDotsIn('white', toBox(MMCX-45,MMCY-45,MMCX+45,MMCY+45))) > 0 then
begin
warn('Nearby players detected, changing worlds...', WT_SCRIPT);
logoutPlayer();
W := randomWorld(P_MEMBER);
warn('World '+toStr(W)+' chosen.', WT_SCRIPT);
changeWorld(W, false);
if not isLoggedIn() then
if loginPlayer(false) then
Switch := True;
end else
break;
if Switch then
begin
setCompass(0);
setAngle(ANGLE_HIGH);
toggleRunning(True);
end;
sTimer.start();
end;
function randomsCheck(): Boolean;
begin
if not isLoggedIn() then Exit(false);
if levelUpEx(False) then Exit(true);
if clickToContinue() then Exit(true);
checkForPlayers();
if getHealthPercent() <= 30 then
begin
Shutdown := True;
sdReason := 'Critical health reached';
result := True;
end;
result := waitEx(1);
end;
procedure doAntiBans();
begin
if not isLoggedIn() then
Exit;
case random(1000) of
1..6:
begin
keyDown(40);
wait(RandomRange(500, 1100));
keyUp(40);
wait(RandomRange(310, 865));
setAngle(ANGLE_HIGH);
end;
7:
if (timer_CS.TimeElapsed > 300000) then
begin
timer_CS.start();
hoverSkill('Mining', False);
end;
8,10 : checkMovingObjs(false);
11..70: humanRandomMouse();
end;
end;
procedure mineRocks();
var
t : Timer;
iPnt,
pnt : TPoint;
i : integer;
begin
if not isLoggedIn() then Exit;
for i:=1 to 3 do
begin
if obj_Rock.Find(10, MSCP, pnt) then
break;
if (i=3) then
if not obj_Rock.Find(10, MSCP, pnt) then
Exit;
end;
fastClick(MOUSE_LEFT);
if not didRedClick() then Exit;
mouseBox(AREA_INV, MOUSE_MOVE);
waitFunc(@isPlayerWalking, 70, 1000);
while isPlayerWalking() do
waitEx(60);
C := getInvCount();
T.Start();
repeat
if not isLoggedIn() then Exit;
if isInvFull() then break;
if randomsCheck() then
break;
if (getInvCount() <> C) then
begin
sTimer.start();
break;
end;
if item_IronOre.findIn(AREA_INV, iPnt) then
break;
doAntiBans();
waitEx(randomRange(100,450));
until(T.TimeElapsed() > randomRange(5700,7500));
if item_IronOre.Interact('Drop') then
begin
sTimer.start();
inc(oreCount);
end;
end;
begin
declarePlayer();
initAL();
loadVars();
addOnTerminate('freeGlobals');
setSimbaWindowTitle('Untitled - Notepad');
setSMARTWindowTitle('Old School RuneScape Game');
Repeat
if not Shutdown then
if not isLoggedIn() then
if loginPlayer(false) then
begin
setCompass('N');
setAngle(ANGLE_HIGH);
toggleRunning(True);
fixGraphics();
end;
while isLoggedIn() do
begin
if (sTimer.TimeElapsed() > 20000) then
Shutdown := True;
if Shutdown then break;
randomsCheck();
mineRocks();
if (rTimer.TimeElapsed() > 15000) then
begin
report();
rTimer.Start();
end;
end;
Until(Shutdown or (not Me.Active));
logoutPlayer();
end.
Take note that this script only searches for the
old-style iron rocks, the ones that are a single color when the ore is present. If you want it to search for the newer style of iron rocks you'll need to adjust the "obj_Rock" in the
loadvars() procedure. It's nothing special, just a simple M1D1-style of mining. It will only drop iron ores from the inventory (not the gems), and if you have a full inventory of gems it
doesn't detect that and
won't shut down. However the script does have an inactivity failsafe that if an ore is not dropped within 20 seconds the script logs out and shuts down, no matter the cause. Also there's the option to have the script hop worlds if a player is detected close to us (avoid being reported).
I made the script to quickly level my Mining so I could do abyssal-runecrafting. I designed it to work at the Yanille mine where the old-style rocks exist, but there are many places where they can be found, like North-East Ardougne.
Edit:
Honestly I should just make this into a Yanille mining script and make a tutorial out of it. That would cover many areas of the AeroLib include and how to script with it… :smarty: