icode
2015-03-15 20:28:11
I needed a powerminer so I wrote one up. I only needed it to mine iron, but I was in yanille so I just figured I'd get colors for most rocks.
*WARNING* It does drop everything in your inventory. I haven't added an option for not having your pickaxe equipped, but I might in the future. It would be very easy just need to add a few lines in my Drop loop. Just need to add in the const a true or false to drop the first inv slot.
But for right now the script drops all inv slots please make sure your pickaxe is equipped.
*WARNING* It does drop everything in your inventory. I haven't added an option for not having your pickaxe equipped, but I might in the future. It would be very easy just need to add a few lines in my Drop loop. Just need to add in the const a true or false to drop the first inv slot.
But for right now the script drops all inv slots please make sure your pickaxe is equipped.
program iCodepowerminer;
{$DEFINE SMART8}
{$i srl-osr/srl.simba}
{$I SRL-OSR/SRL/misc/SmartGraphics.Simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
end;
const
{Setup stuffs}
MaxOre = 2300; //# of ores you want to mine.
OreType = 'Iron'; // Options are: Tin, Copper, Iron, Coal, Mithril
var
OreAmmount, x, y, XPGain, LoadsDone, TimeGone, IronOre2: integer;
TotalTimeRunning, XPPerHour, LoadsPerHour, OrePerHour: integer;
CoalOre, MithrilOre, ClayOre, TinOre, CopperOre : integer;
function FindTheIron(x, y: Integer): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
PBox: TBox;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.17, 0.75);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 1450296, MSx1, MSy1, MSx2, MSy2, 9);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.25, 0.82);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 2898528, MSx1, MSy1, MSx2, MSy2, 2);
ColorToleranceSpeed(CTS);
end;
SMART_DrawDots(MyTPA);
MyATPA := tpatoatpaex(mytpa, 40, 40);
TPAL := High(MyATPA);
for i := TPAL downto 0 do
begin
MMTPA := MiddleTPA(MyATPA[i]);
MMouse(MMTPA.x, MMTPA.y, 3, 3);
if (waitUpTextMulti(['ine', 'roc'], 600)) then
begin
Result := True;
ClickMouse2(Mouse_Left);
break;
end
else
begin
Writeln('option mine rock not found') Attempts := + 1;
if Attempts >= 30 then
begin
WriteLn('cannot find Iron...logging out');
Logout;
TerminateScript;
end;
end;
end;
end;
function FindTheCoal(x, y: Integer): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
PBox: TBox;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.24, 0.76);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 2175539, MSx1, MSy1, MSx2, MSy2, 4);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.19, 0.50);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 2702911, MSx1, MSy1, MSx2, MSy2, 4);
ColorToleranceSpeed(CTS);
end;
SMART_DrawDots(MyTPA);
MyATPA := tpatoatpaex(mytpa, 40, 40);
TPAL := High(MyATPA);
for i := TPAL downto 0 do
begin
MMTPA := MiddleTPA(MyATPA[i]);
MMouse(MMTPA.x, MMTPA.y, 3, 3);
if (waitUpTextMulti(['ine', 'roc'], 600)) then
begin
Result := True;
ClickMouse2(Mouse_Left);
end
else
begin
Writeln('option mine rock not found') Attempts := + 1;
if Attempts >= 30 then
begin
WriteLn('cannot find Iron...logging out');
Logout;
TerminateScript;
end;
end;
end;
end;
function FindTheMithril(x, y: Integer): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
PBox: TBox;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.10);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 6636868, MSx1, MSy1, MSx2, MSy2, 7);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.10);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 6636868, MSx1, MSy1, MSx2, MSy2, 7);
ColorToleranceSpeed(CTS);
end;
SMART_DrawDots(MyTPA);
MyATPA := tpatoatpaex(mytpa, 40, 40);
TPAL := High(MyATPA);
for i := TPAL downto 0 do
begin
MMTPA := MiddleTPA(MyATPA[i]);
MMouse(MMTPA.x, MMTPA.y, 3, 3);
if (waitUpTextMulti(['ine', 'roc'], 600)) then
begin
Result := True;
ClickMouse2(Mouse_Left);
end
else
begin
Writeln('option mine rock not found') Attempts := + 1;
if Attempts >= 30 then
begin
WriteLn('cannot find Mithril...logging out');
Logout;
TerminateScript;
end;
end;
end;
end;
function FindTheTin(x, y: Integer): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
PBox: TBox;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.07);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 6645102, MSx1, MSy1, MSx2, MSy2, 14);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.34, 0.03);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 7171702, MSx1, MSy1, MSx2, MSy2, 7);
ColorToleranceSpeed(CTS);
end;
SMART_DrawDots(MyTPA);
MyATPA := tpatoatpaex(mytpa, 40, 40);
TPAL := High(MyATPA);
for i := TPAL downto 0 do
begin
MMTPA := MiddleTPA(MyATPA[i]);
MMouse(MMTPA.x, MMTPA.y, 3, 3);
if (waitUpTextMulti(['ine', 'roc'], 600)) then
begin
Result := True;
ClickMouse2(Mouse_Left);
end
else
begin
Writeln('option mine rock not found') Attempts := + 1;
if Attempts >= 30 then
begin
WriteLn('cannot find Tin...logging out');
Logout;
TerminateScript;
end;
end;
end;
end;
function FindTheCopper(x, y: Integer): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
PBox: TBox;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.14);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 3363184, MSx1, MSy1, MSx2, MSy2, 11);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.09);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 4945315, MSx1, MSy1, MSx2, MSy2, 3);
ColorToleranceSpeed(CTS);
end;
SMART_DrawDots(MyTPA);
MyATPA := tpatoatpaex(mytpa, 40, 40);
TPAL := High(MyATPA);
for i := TPAL downto 0 do
begin
MMTPA := MiddleTPA(MyATPA[i]);
MMouse(MMTPA.x, MMTPA.y, 3, 3);
if (waitUpTextMulti(['ine', 'roc'], 600)) then
begin
Result := True;
ClickMouse2(Mouse_Left);
end
else
begin
Writeln('option mine rock not found') Attempts := + 1;
if Attempts >= 30 then
begin
WriteLn('cannot find Copper...logging out');
Logout;
TerminateScript;
end;
end;
end;
end;
function FindTheClay(x, y: Integer): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
PBox: TBox;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.12);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 4421779, MSx1, MSy1, MSx2, MSy2, 8);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.12);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, 4421779, MSx1, MSy1, MSx2, MSy2, 8);
ColorToleranceSpeed(CTS);
end;
SMART_DrawDots(MyTPA);
MyATPA := tpatoatpaex(mytpa, 40, 40);
TPAL := High(MyATPA);
for i := TPAL downto 0 do
begin
MMTPA := MiddleTPA(MyATPA[i]);
MMouse(MMTPA.x, MMTPA.y, 3, 3);
if (waitUpTextMulti(['ine', 'roc'], 600)) then
begin
Result := True;
ClickMouse2(Mouse_Left);
end
else
begin
Writeln('option mine rock not found') Attempts := + 1;
if Attempts >= 30 then
begin
WriteLn('cannot find Clay...logging out');
Logout;
TerminateScript;
end;
end;
end;
end;
procedure mine;
var
PBox: TBox;
mx, my, x, y: integer;
begin
makecompass('E');
findnormalrandoms;
PBox := IntToBox(206, 137, 309, 230);
repeat
if not (findSymbol(mx, my, 'mining site')) then
begin
writeln('can not see the iron, logging out!');
Logout;
TerminateScript;
end;
if OreType = 'Iron' then
begin
findtheiron(x, y);
while (isMoving) do
wait(250);
while (AveragePixelShift(PBox, 250, 500) > 250) do
wait(350);
if invfull then
Incex(IronOre2, 28);
end;
if OreType = 'Coal' then
begin
findtheCoal(x, y);
while (isMoving) do
wait(50);
while (AveragePixelShift(PBox, 250, 500) > 250) do
wait(200);
if invfull then
Incex(CoalOre, 27);
end;
if OreType = 'Clay' then
begin
findtheClay(x, y);
while (isMoving) do
wait(50);
while (AveragePixelShift(PBox, 250, 500) > 250) do
wait(200);
if invfull then
Incex(ClayOre, 27);
end;
if OreType = 'Copper' then
begin
findtheCopper(x, y);
while (isMoving) do
wait(50);
while (AveragePixelShift(PBox, 250, 500) > 250) do
wait(200);
if invfull then
Incex(CopperOre, 27);
end;
if OreType = 'Tin' then
begin
findtheTin(x, y);
while (isMoving) do
wait(50);
while (AveragePixelShift(PBox, 250, 500) > 250) do
wait(200);
if invfull then
Incex(TinOre, 27);
end;
if OreType = 'Mithril' then
begin
findtheMithril(x, y);
while (isMoving) do
wait(50);
while (AveragePixelShift(PBox, 250, 500) > 250) do
wait(200);
if invfull then
Incex(MithrilOre, 27);
end;
until invfull;
Incex(OreAmmount, 27);
end;
procedure Drop;
begin
if invfull then
begin
writeln('dropping ores ...');
DropArray([1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]);
end;
end;
procedure Proggy;
begin
TotalTimeRunning := (GetTimeRunning / 60000);
TimeGone := (GetTimeRunning / 1000);
XPGain := (((IronOre2) * 35) + ((CoalOre) * 50) + ((ClayOre) * 5) + ((CopperOre) * 17) + ((TinOre) * 17) + ((MithrilOre) * 80));
XPPerhour := (3600 * (XPGain)) / ((TimeGone));
LoadsPerhour := (3600 * (LoadsDone)) / ((TimeGone));
OrePerHour := (3600 * (OreAmmount)) / ((TimeGone));
Writeln('icode`s Powerminer Pre-alpha V0.1');
Writeln('TimeRunning: ' + IntToStr(TotalTimeRunning) + ' minutes |Loads: ' + IntToStr(LoadsDone));
Writeln('Ore Per Hour: ' + IntToStr(OrePerHour) + ' |Total Ore: ' + IntToStr(IronOre2));
Writeln('XP Per Hour: ' + IntToStr(XPPerHour) + ' |Total XP: ' + IntToStr(XPGain));
end;
procedure Loop;
begin
repeat
Proggy;
writeln('mining ores...');
mine;
Proggy;
writeln('dropping ores...');
Drop;
wait(100);
Inc(LoadsDone)
until (OreAmmount > MaxOre);
end;
begin
DeclarePlayers;
SetupSRL;
ClearDebug;
writeln('iCode`s AIO Powerminer Pre-alpha V0.1');
if not LoggedIn then
LoginPlayer;
wait(5000);
Loop;
writeln('thankyou for using icode`s AIO powerminer');
logout;
terminateScript;
end.