SRL Archive - First Scripts

iCode's 1st Script - Powerminer


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.

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.

iriep12345

2015-03-19 09:23:27

Whats the xp per hr?

Buxtons

2015-03-19 09:30:16

From: iriep12345
Whats the xp per hr?


It should be 22-25k p/h

iriep12345

2015-03-19 09:35:44

is it bot like? have u tested it?

Harrier

2015-03-19 10:38:51

From: Buxtons
It should be 22-25k p/h

Really depends on the mining level, I get 40k xp/h with mine. (Mouse key dropping @70 mining with a rune pick)

Buxtons

2015-03-19 10:45:11

From: Hawker
Really depends on the mining level, I get 40k xp/h with mine. (Mouse key dropping @70 mining with a rune pick)


Really? Back when I was power mining @70-89 I'd max at 30k p/h If I was lucky. I must have been doing something wrong haha.

rj

2015-03-19 11:48:34

Yo you can make the script a few hundred lines shorter, makes it more easy to read and debug

[spoiler=shorter]
program iCodepowerminer;
{$DEFINE SMART8}
{$i srl-osr/srl.simba}
{$I SRL-OSR/SRL/misc/SmartGraphics.Simba}

const
{Setup stuffs}
MaxOre = 2300; //# of ores you want to mine.
OreType = 'iron'; // Options are: CLAY, TIN, COPPER, COAL, MITHRIL


type
TRock = record
name:string;
color_1, color_2, tolerance_1, tolerance_2, xp:integer;
baseHmod, baseSmod, veinHmod, veinSmod:extended;
end;

var
myRock:Trock;
OreAmmount, XPGain, LoadsDone, TimeGone: integer;
TotalTimeRunning, XPPerHour, LoadsPerHour, OrePerHour: integer;

function Rock(rName:string;rColor_1,rColor_2,rTolerance_1,rTolerance_2, xp:integer;
rBaseHmod,rBaseSmod,rveinHmod,rVeinSmod:extended):Trock;
begin
result.name := rName;
result.color_1 := rColor_1;
result.tolerance_1 := rTolerance_1;
result.color_2 := rColor_2;
result.tolerance_2 := rTolerance_2;
result.baseHmod := rBaseHmod;
result.baseSmod := rBaseSmod;
result.veinHMod := rveinHmod;
result.veinSmod := rVeinSmod;
end;

function getMyRock(rockType:string):Trock;
begin
case lowerCase(rockType) of
'clay' : result := Rock(rockType, 4421779, 4421779, 8, 8, 5, 0.04, 0.12, 0.04, 0.12);
'copper' : result := Rock(rockType, 3363184, 4945315, 11, 17, 3, 0.04, 0.14, 0.04, 0.09);
'tin' : result := Rock(rockType, 6645102, 7171702, 14, 7, 17, 0.11, 0.07, 0.34, 0.03);
'iron' : result := Rock(rockType, 1450296, 2898528, 9, 2, 35, 0.17, 0.75, 0.25, 0.82);
'coal' : result := Rock(rockType, 2175539, 2702911, 4, 4, 50, 0.24, 0.76, 0.19, 0.50);
'mithril' : result := Rock(rockType, 6636868, 6636868, 7, 80, 7, 0.08, 0.10, 0.08, 0.10)
else begin
writeln('ERROR getMyRock(rockType:string)Valid arguements = CLAY, TIN, COPPER, COAL, MITHRIL');
terminateScript();
end;
end;
end;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
end;

function findRock(r:Trock): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(r.baseHmod, r.baseSmod);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, r.color_1, MSx1, MSy1, MSx2, MSy2, r.tolerance_2);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(r.veinHmod, r.veinSmod);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, r.color_2, 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 ' + r.name + '...logging out');
Logout;
TerminateScript;
end;
end;
end;
end;

procedure mineRocks;
var
PBox: TBox;
mx, my: 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;

findRock(myRock);
while (isMoving) do
wait(250);
while (AveragePixelShift(PBox, 250, 500) > 250) do
wait(350);

until invfull;
Incex(OreAmmount, 27); // you could get the amount of iron in the inventory
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 := (OreAmmount * myRock.xp); //
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(OreAmmount));
Writeln('XP Per Hour: ' + IntToStr(XPPerHour) + ' |Total XP: ' + IntToStr(XPGain));
end;

procedure Loop;
begin
repeat
Proggy;
writeln('mining ore ' + myRock.name);
mineRocks;
Proggy;
writeln('dropping ores...');
Drop;
wait(100);
Inc(LoadsDone);
until (OreAmmount > MaxOre);
end;

begin
myRock := getMyRock(oreType);
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.
[/spoiler]

pm me if you have any questions

Fr3akNL

2015-05-17 10:21:19

From: rj
Yo you can make the script a few hundred lines shorter, makes it more easy to read and debug

[spoiler=shorter]
program iCodepowerminer;
{$DEFINE SMART8}
{$i srl-osr/srl.simba}
{$I SRL-OSR/SRL/misc/SmartGraphics.Simba}

const
{Setup stuffs}
MaxOre = 2300; //# of ores you want to mine.
OreType = 'iron'; // Options are: CLAY, TIN, COPPER, COAL, MITHRIL


type
TRock = record
name:string;
color_1, color_2, tolerance_1, tolerance_2, xp:integer;
baseHmod, baseSmod, veinHmod, veinSmod:extended;
end;

var
myRock:Trock;
OreAmmount, XPGain, LoadsDone, TimeGone: integer;
TotalTimeRunning, XPPerHour, LoadsPerHour, OrePerHour: integer;

function Rock(rName:string;rColor_1,rColor_2,rTolerance_1,rTolerance_2, xp:integer;
rBaseHmod,rBaseSmod,rveinHmod,rVeinSmod:extended):Trock;
begin
result.name := rName;
result.color_1 := rColor_1;
result.tolerance_1 := rTolerance_1;
result.color_2 := rColor_2;
result.tolerance_2 := rTolerance_2;
result.baseHmod := rBaseHmod;
result.baseSmod := rBaseSmod;
result.veinHMod := rveinHmod;
result.veinSmod := rVeinSmod;
end;

function getMyRock(rockType:string):Trock;
begin
case lowerCase(rockType) of
'clay' : result := Rock(rockType, 4421779, 4421779, 8, 8, 5, 0.04, 0.12, 0.04, 0.12);
'copper' : result := Rock(rockType, 3363184, 4945315, 11, 17, 3, 0.04, 0.14, 0.04, 0.09);
'tin' : result := Rock(rockType, 6645102, 7171702, 14, 7, 17, 0.11, 0.07, 0.34, 0.03);
'iron' : result := Rock(rockType, 1450296, 2898528, 9, 2, 35, 0.17, 0.75, 0.25, 0.82);
'coal' : result := Rock(rockType, 2175539, 2702911, 4, 4, 50, 0.24, 0.76, 0.19, 0.50);
'mithril' : result := Rock(rockType, 6636868, 6636868, 7, 80, 7, 0.08, 0.10, 0.08, 0.10)
else begin
writeln('ERROR getMyRock(rockType:string)Valid arguements = CLAY, TIN, COPPER, COAL, MITHRIL');
terminateScript();
end;
end;
end;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
end;

function findRock(r:Trock): Boolean;
var
MyTPA: TPointArray;
MMTPA: TPoint;
MyATPA: T2DPointarray;
attempts, TPAL, CTS, i: Integer;
begin
attempts := 0 CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(r.baseHmod, r.baseSmod);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, r.color_1, MSx1, MSy1, MSx2, MSy2, r.tolerance_2);
ColorToleranceSpeed(CTS);
if Length(MyTPA) = 0 then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(r.veinHmod, r.veinSmod);
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, r.color_2, 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 ' + r.name + '...logging out');
Logout;
TerminateScript;
end;
end;
end;
end;

procedure mineRocks;
var
PBox: TBox;
mx, my: 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;

findRock(myRock);
while (isMoving) do
wait(250);
while (AveragePixelShift(PBox, 250, 500) > 250) do
wait(350);

until invfull;
Incex(OreAmmount, 27); // you could get the amount of iron in the inventory
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 := (OreAmmount * myRock.xp); //
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(OreAmmount));
Writeln('XP Per Hour: ' + IntToStr(XPPerHour) + ' |Total XP: ' + IntToStr(XPGain));
end;

procedure Loop;
begin
repeat
Proggy;
writeln('mining ore ' + myRock.name);
mineRocks;
Proggy;
writeln('dropping ores...');
Drop;
wait(100);
Inc(LoadsDone);
until (OreAmmount > MaxOre);
end;

begin
myRock := getMyRock(oreType);
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.
[/spoiler]

pm me if you have any questions


Have u edited that script manual or does simba hve some kind of plugin to make it easier to read?

rj

2015-05-17 11:25:58

From: Fr3akNL
Have u edited that script manual or does simba hve some kind of plugin to make it easier to read?


Yes. But what I did here was rewrote parts of the script by hand so as to remove repetitive code. But there is a simba extension that applies the pascalscript standards to your script, example:

It would turn thisL

function mineRock():boolean;
begin
writeln('miningrock');
end;
begin
if not mineRock() then
terminateScript();
end.

Into this:

function mineRock():boolean;
begin
writeln('miningrock');
end;
begin
if not mineRock() then
terminateScript();
end.

Same script different format

dutchp0wner

2015-05-17 13:53:56

Is it stable for hours?

samlant

2015-06-03 00:07:01

From: rj
Yo you can make the script a few hundred lines shorter, makes it more easy to read and debug


Good job thinking of helping in that way, I think it's a very productive way to constructively criticize one's work;

One question to the OP however, Why no antiban? I'm sure your script can benefit much from including antiban like this:
procedure WalkingAntiBan;
begin
case Random(200) of
0..5 : begin
randomRClick;
Writeln('randomRClick');
end;
6..11 : begin
hoverSkill(random, True);
Writeln('hoverSkill');
end;
12..22 : begin
randomMovement;
Writeln('randomMovement');
end;
23..33 : begin
compassMovement(60, 330, True);
Writeln('compassMovement');
end;
34..44 : begin
boredHuman;
Writeln('boredHuman');
end;
45..50 : begin
randomTab(False);
Writeln('randomTab');
end;
51..59 : begin
MMouseOffClient('random');
Writeln('MMouseOffClient');
end;
60..65 : begin
pickUpMouse;
Writeln('pickUpMouse');
end;
66..75 : begin
SmallRandomMouse;
Writeln('SmallRandomMouse');
end;
76..80 : begin
RandomAngle('1');
Writeln('RandomAngle');
end;
end;
end;


and running it at certain intervals, such as after every RandomRange(5..16) ores mined? If you'd like any help implementing antiban, I'm available for questions and examples :p Otherwise, Good job with the script, I'm sure much was learned from this!