SRL Archive - OSR Help

Simple Ironminer Help


Imanoobbot

2012-03-25 10:01:27

Hey I am in writing a simple IronMiner with ACA v2. My problem is at the beginning it already got Compiling errors. Here are the coded lines.

program IronMiner;

var
x, y: Integer;
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
R, G, B: Integer;
X, Y, Z: Extended;

function FindObject(var fx, fy: Integer): Boolean;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.10);

if not(FindColorsTolerance(arP, 2964581, MSX1, MSY1, MSX2, MSY2, 6)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);

if (R >= 81) and (R <= 121) and (G >= 48) and (G <= 73) and (B >= 36) and (B <= 55) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 4.89) and (X <= 10.75) and (Y >= 4.10) and (Y <= 8.92) and (Z >= 2.27) and (Z <= 4.66) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Iron Ore Rock')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;

procedure MineIron;
if (FindColorsTolerance(arP, 2964581, MSX1, MSY1, MSX2, MSY2, 6) then
begin MoveMouse(x, y);
ClickMouse(x, y, 2);
end;

begin
SetupSRL;
FindObject(x, y);
MineIron;
end;


Error: [Error] (17:13): Unknown identifier 'GetColorToleranceSpeed' at line 16
Compiling failed.


If I am making it this way i got the same error.
program AutoMiner;

var
x, y: Integer;
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;

function IronColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.10);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 2964581, MSX1, MSY1, MSX2, MSY2, 6);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 4.89) and (X <= 10.75) and (Y >= 4.10) and (Y <= 8.92) and (Z >= 2.27) and (Z <= 4.66) then
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;


procedure MineIron;
var x, y: integer;
begin
if FindObj(x, y, 'ine', IronColor, 35) then
begin
Mouse(x, y, 2, 2, false);
ChooseOption('ine');
end;
end;

begin
IronColor;
MineIron;
end.


Maybe someone could explain me how to build ACA into a script and how to drop the ores after full invintory.

-Imanoobbot

begginer

2012-03-25 10:17:07

Pm me your skype. I'll help but I am on phone and my dad it's on laptop.

Imanoobbot

2012-03-25 10:34:10

From: begginer
Pm me your skype. I'll help but I am on phone and my dad it's on laptop.


Same skype name as in this forum?

There are like 1000 with the name "beginner" ;)
My skype name : "TheKialok"

begginer

2012-03-25 11:01:50

Make sure to add a declare player procedure.
This is fixed btw :)

program IronMiner;
{$i SRL/SRL/misc/smart.simba}
{$i SRL/SRL.simba}

var
x, y: Integer;
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
R, G, B: Integer;


function FindObject(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.10);

if not(FindColorsTolerance(arP, 2964581, MSX1, MSY1, MSX2, MSY2, 6)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);

if (R >= 81) and (R <= 121) and (G >= 48) and (G <= 73) and (B >= 36) and (B <= 55) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 4.89) and (X <= 10.75) and (Y >= 4.10) and (Y <= 8.92) and (Z >= 2.27) and (Z <= 4.66) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Iron Ore Rock')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;

procedure MineIron;
begin
if (FindColorsTolerance(arP, 2964581, MSX1, MSY1, MSX2, MSY2, 6)) then
begin MoveMouse(x, y);
ClickMouse(x, y, 2);
end;
end;

begin
SetupSRL;
FindObject(x, y);
MineIron;
end.

Do not use clickmouse or movemouse. It's a high banning rate.

Imanoobbot

2012-03-25 12:23:53

Okey now my script looks like this and i still got a compiling error.

program IronMiner;
{$i srl/srl.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;

end;


function IronColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.05, 0.54);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 2766164, MSX1, MSY1, MSX2, MSY2, 11);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);

if (R >= 49) and (R <= 125) and (G >= 28) and (G <= 75) and (B >= 21) and (B <= 56) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 1.88) and (X <= 11.47) and (Y >= 1.59) and (Y <= 9.48) and (Z >= 0.95) and (Z <= 4.86) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

procedure MineIron;
begin
if (FindColorsTolerance(arP, IronColor, MSX1, MSY1, MSX2, MSY2, 6)) then
begin Mouse(x, y, 3, 3, False);
WaitOptionMulti(['mine', 'ine'], 50);
end;
end;



begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
FindObject(x, y);
MineIron;
until(invFull);
end.


Error Message:

[Error] (70:25): Unknown identifier 'arP' at line 69
Compiling failed.


*I don´t get why i get this error message the variable is explained in the beginning.

begginer

2012-03-25 12:33:47

program IronMiner;
{$i srl/srl.simba}


var
arP: TPointArray;
x, y:Integer;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;

end;


function IronColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.05, 0.54);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 2766164, MSX1, MSY1, MSX2, MSY2, 11);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);

if (R >= 49) and (R <= 125) and (G >= 28) and (G <= 75) and (B >= 21) and (B <= 56) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 1.88) and (X <= 11.47) and (Y >= 1.59) and (Y <= 9.48) and (Z >= 0.95) and (Z <= 4.86) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

procedure MineIron;
begin
if (FindColorsTolerance(arP, IronColor, MSX1, MSY1, MSX2, MSY2, 6)) then
begin Mouse(x, y, 3, 3, False);
WaitOptionMulti(['mine', 'ine'], 50);
end;
end;



begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
IronColor;
MineIron;
until(invFull);
end.

Had some missing integers
And other stuff

Abu

2012-03-25 12:41:28

You haven't defined arP within that procedure.

Imanoobbot

2012-03-25 12:48:34

Okey Compiling worked now. =)
My colors are quite good i think but im still getting this error message:

"Failed to find the color, no result.
AutoColor = 2305614
AutoColor = 2305614
AutoColor = 3557754
AutoColor = 3557754
Failed to find the color, no result.
Failed to find the color, no result.
Successfully executed." <– Like this for 1000 lines

Any suggestions?


From: abu_jwka
You haven't defined arP within that procedure.


Thank you. Beginner already helped me with that. =)

Abu

2012-03-25 12:54:17

Well then obviously you need a more accurate color if its not finding it…


Just play around with the colors on ACA till you get one that finds the ore from every angle

Imanoobbot

2012-03-25 12:56:31

From: abu_jwka
Well then obviously you need a more accurate color if its not finding it…


Just play around with the colors on ACA till you get one that finds the ore from every angle



Will try that later. Quite hard atm because of color changing.

Abu

2012-03-25 13:07:16

Here's an idea, get the best color and tolerance and put it into a FindObjCustom function. That's probably the most advanced function for a beginner, but very easy to utilise.

EDIT:
(*
FindObjCustom
~~~~~~~~~~~~~

.. code-block:: pascal

function FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;

Finds Object with custom amount of colors and custom amount of Uptext

.. note::

by Starblaster100

Example:

.. code-block:: pascal

FindObjCustom(x, y, ['att', 'ack'], [123456, 345678], 5);

*)

Imanoobbot

2012-03-25 13:59:13

From: abu_jwka
Here's an idea, get the best color and tolerance and put it into a FindObjCustom function. That's probably the most advanced function for a beginner, but very easy to utilise.

EDIT:
(*
FindObjCustom
~~~~~~~~~~~~~

.. code-block:: pascal

function FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;

Finds Object with custom amount of colors and custom amount of Uptext

.. note::

by Starblaster100

Example:

.. code-block:: pascal

FindObjCustom(x, y, ['att', 'ack'], [123456, 345678], 5);

*)



+1 Reputation for abu_jwka :)

Will test this when im back home.

begginer

2012-03-25 14:01:24

That can be used without need to get the autocolor function. Since u are newcomer you can use it. Then later to autocolor and maybe making your won't function to find it.

Abu

2012-03-25 14:47:14

From: begginer
That can be used without need to get the autocolor function. Since u are newcomer you can use it. Then later to autocolor and maybe making your won't function to find it.


FindObjCustom > AutoColor

Imanoobbot

2012-03-25 15:22:22

Okey now its looking like this and i am getting an Compiling error again. (Color is not updated yet)

pprogram IronMiner;
{$i srl/srl.simba}


var
arP: TPointArray;
x, y:Integer;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;

end;


function FindIron: Boolean;

var
x, y: integer;

begin
FindObjCustom(x, y, ['ron', 'ore'], [2766164], 11);
MMouse(x, y, 2, 2);
Mouse(x, y, 0, 0, True);
end;

procedure MineIron;
begin
if (FindColorsTolerance(arP, IronColor, MSX1, MSY1, MSX2, MSY2, 6)) then
begin Mouse(x, y, 3, 3, False);
WaitOptionMulti(['mine', 'ine'], 50);
end;
end;



begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
FindIron;
MineIron;
until(invFull);
end.


Errors now…

[Hint] (24:10): Variable 'Result' never used at line 23
[Error] (37:30): Unknown identifier 'IronColor' at line 36
Compiling failed.

Should I put the number of the color for "IronColor" ? But then i dont see the reason for putting the FindIron function in there.

Abu

2012-03-25 15:32:37

Read my pm

Imanoobbot

2012-03-25 15:53:05

From: abu_jwka
Read my pm


Ya, will update it in like 10minutes when im back home

Imanoobbot

2012-03-25 16:49:28

Oke I added some Antiban now and the color is working good so far mined my first invitory! ;)

     

program IronMiner;
{$i srl/srl.simba}


var
arP: TPointArray;
x, y:Integer;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;

end;


function FindIron: Boolean;

var
x, y: integer;

begin
FindObjCustom(x, y, ['ron', 'ore'], [2898010], 11);
MMouse(x, y, 2, 2);
Mouse(x, y, 0, 0, True);
end;



procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(100) of
0:
begin
HoverSkill('Mining', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;

begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
FindIron;
Antiban;
until(invFull);
end.

Any Suggestion how to let the script wait until the ore is mined and then click the next rock? After that my next problem is dropping the ores. Got a idea that that it could be something like this:

Procedure WaitForMenu;
begin

while not optionsExist(['ancel'],false) do
wait(250+random(250));
end;

and this

WaitForMenu;
ChooseOptionMultiEx(['ine','e ro']);

It´s not really working so far.

Imanoobbot

2012-03-25 18:19:55

Okey dropping function is not really working yet anyone knows how to fix?


program IronMiner;
{$i srl/srl.simba}




Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;

end;


procedure DropOre;

var
x, y, RocksMined, IronOre: Integer;

begin
repeat
IronOre := DTMFromString('mbQAAAHicY2VgYPjIxMDwH4o/APF3INZmZGBQYYTQ1kBsCsSGsqJA1UwoWIQBEzBiwWAAAEEdBlk=');

If FindDTM(IronOre, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 2, 2);
Mouse(x, y, 0, 0, false);
WaitOption('Drop', randomrange(200, 300));
Wait(randomrange(200, 300));
end;



until(not(FindDTM(IronOre, x, y, MIX1, MIY1, MIX2, MIY2)))
FreeDTM(IronOre);
end;


function FindIron: Boolean;

var
x, y: integer;

begin
FindObjCustom(x, y, ['ron', 'ore'], [2766423], 11);
MMouse(x, y, 2, 2);
Mouse(x, y, 0, 0, True);
end;




procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(100) of
0:
begin
HoverSkill('Mining', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;







begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
MouseSpeed := RandomRange(17, 22);

repeat
repeat
FindIron;
Antiban;
until(invFull);
DropOre;
Incex(RocksMined, 27);
until(not(loggedin));


end.


[Error] (111:9): Unknown identifier 'RocksMined' at line 110
Compiling failed.

Anyone know how to fix this?

begginer

2012-03-25 18:27:51

program IronMiner;
{$i srl/srl.simba}

var
IronOre,x, y : integer;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;

end;


procedure DropOre;
begin
repeat
IronOre := DTMFromString('mbQAAAHicY2VgYPjIxMDwH4o/APF3INZmZGBQYYTQ1kBsCsSGsqJA1UwoWIQBEzBiwWAAAEEdBlk=');

If FindDTM(IronOre, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 2, 2);
Mouse(x, y, 0, 0, false);
WaitOption('Drop', randomrange(200, 300));
Wait(randomrange(200, 300));
end;



until(not(FindDTM(IronOre, x, y, MIX1, MIY1, MIX2, MIY2)))
FreeDTM(IronOre);
end;


function FindIron: Boolean;

var
x, y: integer;

begin
FindObjCustom(x, y, ['ron', 'ore'], [2766423], 11);
MMouse(x, y, 2, 2);
Mouse(x, y, 0, 0, True);
end;




procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(100) of
0:
begin
HoverSkill('Mining', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;







begin // Mainloop not updated yet
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;

repeat
FindIron;
Antiban;
until(invFull);
end.

begginer

2012-03-25 18:42:38

Just forget about RocksMined cuz you'll need and 50 more lines to count them

Abu

2012-03-25 18:46:11

Yeh what begginer has done is great.

However, Imanoobbot, from that I have seen that you do not understand how variables work.

Basically, if you declare variables before any of your functions, then you can use those variables anywhere you want in your script… but if you declare those variables within a procedure, then you can only use it within that procedure and not anywhere else you like.

For example, you declared RocksMined as a variable within your DropLogs procedure, this means you can only use that variable in that procedure, not in the main loop.

Hope that cleared things up.

Imanoobbot

2012-03-25 19:39:58

From: abu_jwka
Yeh what begginer has done is great.

However, Imanoobbot, from that I have seen that you do not understand how variables work.

Basically, if you declare variables before any of your functions, then you can use those variables anywhere you want in your script… but if you declare those variables within a procedure, then you can only use it within that procedure and not anywhere else you like.

For example, you declared RocksMined as a variable within your DropLogs procedure, this means you can only use that variable in that procedure, not in the main loop.

Hope that cleared things up.


Cleared a lot up. But means that, that I could put all the variables I want to use at the beginning of the script and they will work for the whole script?
Second point is that I think it´s quite hard to find a good working color for iron ores in the Al Kharid mine because when I just click the red Iron stripes on the rocks it will just color it perfect but clicks on the Scorpions and Copper ore too. When I just take the light red it will Spamclick copper ore after some time and clicks the cross-tongs of the scorpions. When I take the dark red it will click some parts of the body of the scorpions after some time.

* Btw. I just started off with scripting yesterday so ;) learned really a lot today

Imanoobbot

2012-03-25 20:12:41

This Version seems to work quite good as I added an Autocolor function.




program IronMiner;
//{$DEFINE SMART}
{$i srl/srl.simba}




Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;

end;

function IronColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 0.22);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 3030376, MSX1, MSY1, MSX2, MSY2, 5);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 5.69) and (X <= 10.58) and (Y >= 4.71) and (Y <= 8.64) and (Z >= 2.51) and (Z <= 4.38) then
begin
Result := arC[i];
Writeln('IronColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('IronColor failed in finding the color.');
end;



procedure DropOre;
var x, y, IronOre, I: Integer;
CurrentBox: TBox;
begin
IronOre := DTMFromString('mbQAAAHicY2VgYPjIxMDwH4o/APF3INZmZGBQYYTQ1kBsCsSGsqJA1UwoWIQBEzBiwWAAAEEdBlk=');
if (InvEmpty) then
exit;
for I := 1 to 28 do begin
CurrentBox := InvBox(I);
if (FindDTM(IronOre, x, y, CurrentBox.x1, CurrentBox.y1, CurrentBox.x2, CurrentBox.y2)) then
DropItem(I);
end;
end;


function FindIron: Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.94);

if not(FindColorsTolerance(arP, IronColor, MSX1, MSY1, MSX2, MSY2, 6)) then
begin
Writeln('Rock Color not found...');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 4.13) and (X <= 10.17) and (Y >= 3.71) and (Y <= 8.43) and (Z >= 2.49) and (Z <= 4.36) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Min')) and (IsUpText('Iron')) then
begin;
Mouse(p.x, p.y, 0, 0, True);
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('Rock not found...');
Exit;
end;


end;

function WaitUntilMined: Boolean;
var
t, IC: Integer;
begin
IC := 0;
t := 0;
Status('Walking to Rock');
MarkTime(t);
repeat
Wait(10);
if (TimeFromMark(t) >= 6000) then Exit;
until (not FlagPresent) and FindBlackChatMessage('u swi');
Status('Mining Rock');
IC := InvCount;
t := 0;
MarkTime(t);
repeat
Wait(10);
if (TimeFromMark(t) >= 12000) then Exit;
Wait(750); //was 500
if Levelup then
begin
Writeln('Congratz you gained another level');
end;
if IC <> InvCount then
Break;
until (FindBlackChatMessage('anage'));
Result := True;
end;



procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(100) of
0:
begin
HoverSkill('Mining', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;




begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
MouseSpeed := RandomRange(17, 22);

repeat
repeat
FindIron;
WaitUntilMined;
Antiban;
until(invFull);
DropOre;
until(not(loggedin));

end.

* Very simple but quite nice version. 0.1 ;)

Added lots of new stuff in the newer versions.