Log in

View Full Version : Failed when compiling :S



qwerty66
07-06-2007, 02:42 PM
If someone could help me out that would be great, I just downloaded SCAR Divi and I found a cool script i want to use, its a mining one. I loaded up Rs and logged on, i put teh script in the proper place and i drag the target to the rs window. I press run, and it says,

Include file C:\Program Files\SCAR 3.10\includes\SRL\SRL.scar does not exist.
Include file C:\Program Files\SCAR 3.10\includes\SRL\SRL\skill\mining.scar does not exist.
Failed when compiling


I downloaded SLR, and now the error is this Line 243: [Error] (15572:5): Unknown identifier 'RandomRClickEvery' in script
What can i do to get my program to work?

qwerty66
07-06-2007, 02:47 PM
im using this script for mining iron in varrock west,

program SPMReborn;
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\mining.scar}

//==============================[Setup]===================================\\
const
MiningInDwarvenMine = False;//Are we mining in the dwarven mines?
MineNewRocks = False;//VERY BUGGY - Are we mining the new (Rimmington) rocks?
UseTimeOut = True; //If player doesnt mine for 5 minutes it logs out > set to false.
CheckForHealth = True; //If true checks health first, if damaged, it runs.
MaxSecToWait = 10; //Max seconds to wait before clicking again.
RunDir = 'N'; //Direction to run to (N / E / W / S).
RunFar = True; //Runfar? (Recommended!)
TheOreTolerance = 5; //Tolerance the color of the ore can have.
RandomlyChooseRock = False;//Randomly choose one of the rocks selected?
MMouseWhenWaiting = True; //Sometimes moves the mouse when waiting for rock.
UseAntiBan = True; //AntiBan will be used if set to true.
AntiBanAmount = 3; //0 is lots of antiban, 1 less, 2 even more less, etc.
OresDropDir = 'None';//N / E / W / S / Random / None.

UsePlayerForm = True; //If false DeclarePlayers(below)will be used.
ShowPlayerForm = True; //Show the playerform when started?
LoadsPerPlayer = 2; //Loads to do before switching.
RandomLoads = 2; //Randomness that will be added to above.
StartPlayer = 0; //Player to start with, 0 is the first one.

VersionNumber = '0.62';//Current version number.
DebugStyle = 'Write';//Write / Status / Disguise / None.

//==============================[Colors]==================================\\
//If your mining new rocks you might need to set your own color.
const
CopperColor = 3824768;
TinColor = 8290185;
ClayColor = 4553880;
IronColor = 2569045;
SilverColor = 12434885;
CoalColor = 2834753;
GoldColor = 1881051;
MithrilColor = 7359564;
AdamantColor = 6322272;
RuniteColor = 0;

//==========================[Player Setup]================================\\
procedure DeclarePlayers;
begin
HowManyPlayers := 6;//MAKE SURE THIS ONE IS CORRECT!

CurrentPlayer := StartPlayer;
NumberOfPlayers(HowManyPlayers);

Players[0].Name :='Username';
Players[0].Pass :='Password';
Players[0].Nick :='sern'; // 3-4 letters from your name, NO CAPITALS (that includes the first character)
Players[0].String1 :='Iron'; //Will be mined most (unless RandomlyChooseRock is set)
Players[0].String2 :='Copper';//Will be mined less, unless ^
Players[0].String3 :='Tin'; //Will be mined even less, unless ^
Players[0].Active:= True;

Players[1].Name :='Username';
Players[1].Pass :='Password';
Players[1].Nick :='sern';
Players[1].String1 :='Coal';
Players[1].String2 :='Gold';
Players[1].String3 :='Iron';
Players[1].Active:= True;

Players[2].Name :='Username';
Players[2].Pass :='Password';
Players[2].Nick :='sern';
Players[2].String1 :='Copper';
Players[2].String2 :='Tin';
Players[2].String3 :='Iron';
Players[2].Active:= True;

Players[3].Name :='Username';
Players[3].Pass :='Password';
Players[3].Nick :='sern';
Players[3].String1 :='Addy';
Players[3].String2 :='Mith';
Players[3].String3 :='Gold';
Players[3].Active:= True;

Players[4].Name :='Username';
Players[4].Pass :='Password';
Players[4].Nick :='sern';
Players[4].String1 :='Coal';
Players[4].String2 :='Copper';
Players[4].String3 :='Tin';
Players[4].Active:= True;

Players[5].Name :='Username';
Players[5].Pass :='Password';
Players[5].Nick :='sern';
Players[5].String1 :='Iron';
Players[5].String2 :='Addy';
Players[5].String3 :='Coal';
Players[5].Active:= True;
end;

//=========================[DONT TOUCH BELOW]=============================\\
var
arOreColor, arOreColorResults: TPointArray;
I, bmpOreMask, bmpClayMask, OresMined, LoadsDone,
TotalLoadsDone, GasAvoided, MineMax, TheLoads: Integer;
PlayerStatus: Boolean;

//------------------------------------------------------------------------\\
{ Signature - To prove its mine, lol. ||
\\------------------------------------------------------------------------//}

procedure Signature;
begin
Writeln(' _______ __ __ __');
Writeln(' / _____/__ __ _____ |__| |__| ___ ____');
Writeln(' \___ \| | \/ \| | | |/ _ \/ \');
Writeln(' / \ | / Y Y \ | | ( <_> ) | \');
Writeln('/_____ /____/|__|_| /__|__|__|\___/|__| /');
Writeln(' \/ \/ \/');
Writeln('Scripts Brings You:');
Writeln(' SumPowerMiner');
end;

//------------------------------------------------------------------------\\
{ ProgressReport - Shows what the script has done ||
\\------------------------------------------------------------------------//}

procedure ProgressReport;//Made by Fakawi, i think, edited by me
var
PActive: string;
I: Integer;
begin
SRLRandomsReport;
if Players[CurrentPlayer].Active then PActive:='True' else PActive:='False';
Writeln(' ');
Writeln('<============= SumPowerMiner ==============>');
Writeln('<========= -'+VersionNumber+'- Progress Report =========>');
Writeln('/==========================================\');
Writeln(' Worked for '+ TimeRunning);
Writeln(' Mined ' + IntToStr(OresMined) + ' ores.');
if(GasAvoided > 0)then Writeln(' Avoided gas ' + IntToStr(GasAvoided) + ' times.');
Writeln('\======================================== ==/');
Writeln(' Name : '+Players[CurrentPlayer].Name);
Writeln(' Mining Lvl : '+IntToStr(Players[CurrentPlayer].Level[15]));
Writeln(' Worked for : '+IntToStr(Players[CurrentPlayer].Worked)+' minutes.');
Writeln(' Loads done : '+IntToStr(Players[CurrentPlayer].Integer1));
Writeln(' Active : '+PActive);
Writeln(' Location : '+Players[CurrentPlayer].Loc);
Writeln('\\----------------------------------------//');
for I := 0 to HowManyPlayers-1 do
begin
if(Players[I].Active = True)then PActive := 'True' else PActive := 'False';
Writeln(IntToStr(I) + ' : ' + Players[I].Name + ' = '+ PActive +
' , Loads: ' + IntToStr(Players[I].Integer1) +
', Lvl: ' + IntToStr(Players[I].Level[15]) +
', Loc: ' + Players[I].Loc);
end
Writeln('<==========================================>');
end;

//------------------------------------------------------------------------\\
{ KeepUpStats - Updates the statistics. ||
\\------------------------------------------------------------------------//}

procedure KeepUpStats;
begin
OresMined := OresMined + CountItemBmpMaskTol(bmpOreMask, 5, 5);
OresMined := OresMined + CountItemBmpMaskTol(bmpClayMask, 5, 5);
LoadsDone := LoadsDone + 1;
TotalLoadsDone := TotalLoadsDone + 1;
Players[CurrentPlayer].Integer1 := Players[CurrentPlayer].Integer1 + 1;
ReportVars[0] := ReportVars[0] + CountItemBmpMaskTol(bmpOreMask, 5, 5);
ReportVars[0] := ReportVars[0] + CountItemBmpMaskTol(bmpClayMask, 5, 5);
ReportVars[1] := ReportVars[1] + 1;
end;

//------------------------------------------------------------------------\\
{ LoadImages - Loads images in memory. ||
\\------------------------------------------------------------------------//}

procedure LoadImages;
begin
bmpOreMask := BitmapFromString(9, 8, 'z78DA333040076E6080C9C60' +
'F064A17F17A71E9C2AFD70D03E09725DE4CF2DC0F00DCD05C 59');
bmpClayMask := BitmapFromString(9, 6, 'z78DA33302016B88101F' +
'12A4905B86CC1AF9E3CB7E1329F787F218B03004FC54795') ;
end;

//------------------------------------------------------------------------\\
{ DebugMe - Shows info of what the script is doing. ||
\\------------------------------------------------------------------------//}

procedure DebugMe(Info: string);
begin
case(LowerCase(DebugStyle))of
'write' : Writeln(Info);
'status' : Status(Info);
'disguise': DisguiseScar(Info);
end;
end;

//------------------------------------------------------------------------\\
{ PlayerLost - Deactivates player if needed. ||
\\------------------------------------------------------------------------//}

procedure PlayerLost(Info: string);
begin
Writeln(Info);
PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wa v');
Logout;
end;

//------------------------------------------------------------------------\\
{ MouseAntiBan - Moves mouse human-like (Anti-ban). By Yakman ||
\\------------------------------------------------------------------------//}

procedure MouseAntiBan; //From Yakman.
begin
if not(LoggedIn)then Exit;
case Random(6) of
0 : IdleTime(1000 + Random(350),500,1.0);
1 : IdleTime(1000 + Random(350),1000,1.0);
2 : IdleTime(1000 + Random(350),750,0.5);
3 : SleepAndMoveMouse(2500 + Random(2500));
4 : SleepAndMoveMouse(1500 + Random(1500));
5 : SleepAndMoveMouse(500 + Random(500));
end
end;

//------------------------------------------------------------------------\\
{ MyAntiBan - Anti-Ban procedure by Yakman. ||
\\------------------------------------------------------------------------//}

procedure MyAntiBan;//From Yakman
var
DItem, DBanMe, AntiBanRatio: Integer;
begin
if not(LoggedIn)then Exit;
AntiBanRatio := 25 + (25 * AntiBanAmount);
DBanMe := Random(AntiBanRatio);
case DBanMe of
0 : MMouse(Random(MSX2), Random(MSY2),0,0);
1 : RandomRClickEvery(2 + Random(13));
2 : HoverSkill('mining', False);
3 : HoverSkill('smithing', False);
4 : RotateEvery(20+random(10));
5 : LeaveScreenEvery(5+random(5));
6 : HoverEvery(15+random(5),'random');
7 : HoverEvery(15+random(5),players[currentplayer].skill);
8 : MouseAntiBan;
9 : begin
DItem:=1+random(14);
if(ExistsItem(DItem))then
DragItem(DItem,15+random(10));
end
10 : begin
GameTab(1+random(12));
wait(1500+random(500));
GameTab(4);
end;
end;
end;

//------------------------------------------------------------------------\\
{ DropOres - Drops all the ores. ||
\\------------------------------------------------------------------------//}

procedure DropOres;
var
i, Dx, Dy: Integer;
RDir: string;
begin
if(Lowercase(OresDropDir) = 'random')then
begin
case Random(4) of
0 : RDir := 'S';
1 : RDir := 'N';
2 : RDir := 'E';
3 : RDir := 'W';
end;
end
else
RDir := OresDropDir;
if not(RDir = 'None')then
RunAwayDirection(RDir);
Dx := x;
Dy := y;
GameTab(4);
while(FindBitmapMaskTolerance(bmpOreMask, x, y, MIX1, MIY1, MIX2, MIY2, 10, 5))and
(i < 5)do
begin
ClickAllItemsBmpMaskTolWait('Drop', bmpOreMask, 5, 5, 300);
ClickAllItemsBmpMaskTolWait('Drop', bmpClayMask, 5, 5, 300);
if(FindColor(x, y, 16777215, MIX1, MIY1, MIX2, MIY2))then
Mouse(x, y, 5, 5, false);
ChooseOption(x, y, 'cel');
i := i + 1;
end;
if(FindColor(x, y, 16777215, MIX1, MIY1, MIX2, MIY2))then
Mouse(x, y, 5, 5, false);
ChooseOption(x, y, 'cel');
x := Dx;
y := Dy;
if not(RDir = 'None')then
RunBack;
GameTab(4);
end;

//------------------------------------------------------------------------\\
{ SetOreColor - Sets the desired OreColors ||
\\------------------------------------------------------------------------//}

procedure SetOreColor;
begin
case LowerCase(Players[CurrentPlayer].String1) of
'copper' : OreColor1 := CopperColor;
'tin' : OreColor1 := TinColor;
'clay' : OreColor1 := ClayColor;
'iron' : OreColor1 := IronColor;
'silver' : OreColor1 := SilverColor;
'coal' : OreColor1 := CoalColor;
'gold' : OreColor1 := GoldColor;
'mithril' : OreColor1 := MithrilColor;
'adamant' : OreColor1 := AdamantColor;
'runite' : OreColor1 := RuniteColor;
end;
case Lowercase(Players[CurrentPlayer].String2) of
'copper' : OreColor2 := CopperColor;
'tin' : OreColor2 := TinColor;
'clay' : OreColor2 := ClayColor;
'iron' : OreColor2 := IronColor;
'silver' : OreColor2 := SilverColor;
'coal' : OreColor2 := CoalColor;
'gold' : OreColor2 := GoldColor;
'mithril' : OreColor2 := MithrilColor;
'adamant' : OreColor2 := AdamantColor;
'runite' : OreColor2 := RuniteColor;
end;
case Lowercase(Players[CurrentPlayer].String3) of
'copper' : OreColor3 := CopperColor;
'tin' : OreColor3 := TinColor;
'clay' : OreColor3 := ClayColor;
'iron' : OreColor3 := IronColor;
'silver' : OreColor3 := SilverColor;
'coal' : OreColor3 := CoalColor;
'gold' : OreColor3 := GoldColor;
'mithril' : OreColor3 := MithrilColor;
'adamant' : OreColor3 := AdamantColor;
'runite' : OreColor3 := RuniteColor;
end;
end;

//------------------------------------------------------------------------\\
{ SumFindPickHeadColor - Advanced FindPickHeadColor, finds the paxe ||
\\------------------------------------------------------------------------//}

function SumFindPickHeadColor: Boolean;
var
InvPAxe, WieldPAxe, Ix, Iy, Wx, Wy: integer;
dtmPaxes: Array[1..6] of integer;
begin
dtmPaxes[1] := DTMFromString('78DA637463646008664001068A0C0C5C401 A2' +
'8C3F01F0818C381AC40543536FE11703520C0E80B6479A0AA F149' +
'2D405103000A07084F'); //Rune
dtmPaxes[2] := DTMFromString('78DA631463646008634001068A0C0C5C401 A2' +
'8C3F01F08183580AC405435561E56703520C028076479A0AA F188' +
'F142510300D923076A'); //Addy
dtmPaxes[3] := DTMFromString('78DA637CCEC0C010C680020C141918B8803 42' +
'310FF0702C69F404620AA1A73F300B81A10607C0F243C50D5 B8BA' +
'A7A3A8010086BD09E1'); //Mith
dtmPaxes[4] := DTMFromString('78DA63DCC9C0C010CC80020C141918B8803 42' +
'310FF0702C653404620AA9ACCA424B81A10603C00243C50D5 B4D6' +
'D4A0A801007D560A4B'); //Steel
dtmPaxes[5] := DTMFromString('78DA63EC62606008654001068A0C0C5C409 A1' +
'188FF0301E36C202310558DBB93135C0D08304E04121EA86A A242' +
'4250D400003C4908E3'); //Iron
dtmPaxes[6] := DTMFromString('78DA638C62606008634001068A0C0C5C409 A1' +
'188FF0301630E901188AAC6D1480EAE0604189380843BAA1A 3B2D' +
'0614350000CD0781'); //Bronze
GameTab(4);
for InvPAxe := 1 to 7 do
begin
if(InvPAxe = 7)then Break;
if(FindDtm(dtmPaxes[InvPAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2))then
Break;
end;
GameTab(5);
for WieldPAxe := 1 to 7 do
begin
if(WieldPAxe = 7)then Break;
if(FindDtm(dtmPaxes[WieldPAxe], Wx, Wy, MIX1, MIY1, MIX2, MIY2))then
Break;
end;

if(InvPAxe = 7) and (WieldPAxe = 7)then begin Result := false; Exit; end;
if((InvPAxe-WieldPAxe) < 0)then EquipPick := false else EquipPick := true;
Result := true;
if(EquipPick)then
begin
GameTab(5);
hc1 := GetColor(585, 295);
hc2 := GetColor(597, 297);
hc3 := GetColor(594, 296);
hc4 := GetColor(588, 295);
hc5 := GetColor(582, 294);
end else
begin
GameTab(4);
if(Ix > 592) and (Iy > 238)then Drag(Ix, Iy, 5, 5, 579, 227, 5, 5, true);
FindDtm(dtmPaxes[InvPAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2);
hc1 := GetColor(587, 216);
hc2 := GetColor(587, 219);
hc3 := GetColor(592, 222);
hc4 := GetColor(584, 216);
hc5 := GetColor(577, 219);
end;
for WieldPAxe := 1 to 6 do
FreeDtm(dtmPaxes[WieldPAxe]);
WriteLn('Pick head colors... ' + IntToStr(hc1) + ' ' + IntToStr(hc2) + ' ' +
IntToStr(hc3) + ' ' + IntToStr(hc4) + ' ' + IntToStr(hc5));
end;

//------------------------------------------------------------------------\\
{ FindFastRandoms - Finds basic randoms fast. By WT-Fakawi. ||
\\------------------------------------------------------------------------//}

function FindFastRandoms: Boolean; // By WT-Fakawi.
var
i: Integer;
begin
for I := 1 to 11 do
begin
case I of
1: if FindDead then
Result := True;

2: if FindMod then
Result := True;

3: if FindMime then
Result := True;

4: if FindMaze then
Result := True;

5: if FindQuiz then
Result := True;

6: if FindDemon then
Result := True;

7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;

8: begin
if not MiningInDwarvenMine then
begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
end;

9 : if RC then
Result := True;

10 : if FindFight then
begin
Result := True;
RunTo(RunDir, RunFar);
end;

11: if FindTalk then
Result := True;
end;
Wait(1);
end;
end;

//------------------------------------------------------------------------\\
{ HandleGas - Handles the player when there is gas. ||
\\------------------------------------------------------------------------//}

procedure HandleGas;
var
TempMouseSpeed, GasTime: Integer;
begin
Writeln('Gas found!');
TempMouseSpeed := MouseSpeed;
MouseSpeed := 5;
Mouse(MMCX, MMCY, 5, 5, true);
MarkTime(GasTime);
MouseSpeed := TempMouseSpeed;
while(TimeFromMark(GasTime) < 35000)do
if(Random(20) > 15)then
IdleTime(500, 500, 0.4)
else
Wait(1000);
MarkTime(MineMax);
GasAvoided := GasAvoided + 1;
ReportVars[3] := ReportVars[3] + 1;
end;

//------------------------------------------------------------------------\\
{ FindNewOre - Finds new ores in the inventory. ||
\\------------------------------------------------------------------------//}

function FindNewOre(InvSpot: Integer): Boolean;
begin
Result := ExistsItem(InvSpot);
end;

//------------------------------------------------------------------------\\
{ FindColorsArray - Finds specified rock colors. Thnx to Lorax. ||
\\------------------------------------------------------------------------//}

function FindColorsArray(Color, Tolerance, Step, MaxTol: Integer): TPointArray;
var
Count, tx, ty: Integer;
begin
while (not FindColorTolerance(tx, ty, Color, MSX1, MSY1, MSX2, MSY2, Tolerance + Count * Step))and
(Count * Step <= MaxTol) do
Count := Count + 1;
FindColorsSpiralTolerance(MSCX, MSCY, Result, Color, MSX1, MSY1, MSX2, MSY2, Tolerance + Count * Step);
end;

//------------------------------------------------------------------------\\
{ getArrayFromBox - Splits above results in groups of size. Thnx to Lorax ||
\\------------------------------------------------------------------------//}

function getArrayFromBox(arColor: TPointArray; Width, Height, MinCount, Dist: Integer): TPointArray;
var
Count, Count2, Count3, Count4, TempArrayLength: Integer;
Average : TPoint;
begin
Count2 := 1;
TempArraylength := GetArrayLength(Result);
SetArrayLength(Result, Count2);
for Count := 1 to GetArrayLength(arColor) - 1 do
begin
if(arColor[Count].x < arColor[Count - 1].x + Width)and
(arColor[Count].y < arColor[Count - 1].y + Height)and
(arColor[Count].x > arColor[Count - 1].x - Width)and
(arColor[Count].y > arColor[Count - 1].y - Height)and
(Count < GetArrayLength(arColor)-1)then
else
begin
Average.x := 0;
Average.y := 0;
for Count3 := Count4 to Count - 1 do
begin
Average.x := Average.x + arColor[Count3].x;
Average.y := Average.y + arColor[Count3].y;
end;

if((Count3-Count4) > MinCount)then
begin
if(Distance(Average.x, Average.y, MSCX, MSCY) > Dist)then
begin
Average.x := Average.x / (Count3 - Count4);
Average.y := Average.y / (Count3 - Count4);
SetArrayLength(Result, Count2);
Result[Count2 - 1].x := Average.x;
Result[Count2 - 1].y := Average.y;
Count2 := Count2 + 1;
end;
end;
end;
if(GetArrayLength(Result)>TempArrayLength)then
begin
TempArrayLength := GetArrayLength(Result);
Count4 := Count;
end;
end;
end;

//------------------------------------------------------------------------\\
{ UpdateColor - Updates the coords of the rock. By Lorax. ||
\\------------------------------------------------------------------------//}

function UpdateColor(var ax, ay: Integer; tColor: Integer): boolean;
var
Checker: Integer;
begin
Checker := GetSystemTime;
while(FindColorSpiralTolerance(ax, ay, tColor, ax - 20, ay - 20, ax + 20, ay + 20, 10))and
(TimeFromMark(Checker) < 10000)and
(FlagPresent)do
Wait(16);
for Checker := 0 to 62 do
begin
FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 10);
Wait(16);
end;

Result := FindColorTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 10);
end;

//------------------------------------------------------------------------\\
{ RockGone - Results true if the rock is gone. ||
\\------------------------------------------------------------------------//}

function RockGone(Rx, Ry, Squarex, Squarey, Color, Tol: Integer): Boolean;
begin
if not(UpdateColor(Rx, Ry, Color))then
begin
Result := True;
Exit;
end;
Result := not(FindColorSpiralTolerance(x, y, Color, Rx - Squarex, Ry - Squarex, Rx + Squarex, Ry + Squarey, Tol));
end;

//------------------------------------------------------------------------\\
{ WaitWhileWorking - Waits while mining. Thnx to Lorax. ||
\\------------------------------------------------------------------------//}

procedure WaitWhileWorking(Ax, Ay, InvSpot, MineMark: Integer);
begin
while (LoggedIn) do
begin
if(NoPick)then
begin
if not(SumFindPickHeadColor)then
begin
PlayerLost('Player lost, no more paxes');
NoPick := False;
Exit;
end;
NoPick := False;
end;
if not(MineNewRocks)then
if(RockGone(Ax, Ay, 10, 10, OreColor, TheOreTolerance))then
Exit;
Wait(10);
if(GasCheck(Ax, Ay))then
begin
PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wa v');
HandleGas;
DebugMe('We got gas while waiting');
Exit;
end;
Wait(10);
if(FindFastRandoms)then
begin
MarkTime(MineMax);
DebugMe('Found a random while waiting');
PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wa v');
Exit;
end;
Wait(50);
if not(FindPick)then
begin
MarkTime(MineMax);
PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wa v');
DebugMe('Something is wrong with our pickaxe.');
Exit;
end;
if(TimeFromMark(MineMark) > MaxSecToWait * 1000)then
begin
DebugMe('Time ran out while waiting');
Exit;
end;
if(FindFight)then
begin
PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wa v');
RunTo(RunDir, True);
DebugMe('We got into a fight');
Exit;
end;
Wait(10);
if(FindNewOre(InvSpot))then
Exit;
if(MMouseWhenWaiting)then
if(Random(20)+1 > 15)then
IdleTime(200 + Random(500), 500, 0.4);
end;
end;

//------------------------------------------------------------------------\\
{ FindRock - Finds closest rocks on the screen. ||
\\------------------------------------------------------------------------//}

function FindRock: Boolean;
var
i: Integer;
begin
for i := 1 to 3 do
begin
if(RandomlyChooseRock)then
begin
case(Random(2) + 1)of
1 : OreColor := OreColor1;
2 : OreColor := OreColor2;
3 : OreColor := OreColor3;
end;
end
else
case I of
1 : OreColor := OreColor1;
2 : OreColor := OreColor2;
3 : OreColor := OreColor3;
end;
arOreColor := FindColorsArray(OreColor, 4, 2, TheOreTolerance);
arOreColorResults := getArrayFromBox(arOreColor, 20, 20, 2, 20);
Result := (GetArrayLength(arOreColorResults) > 0);
if(Result)then
Exit;
end
DebugMe('Rock NOT found...');
end;

//------------------------------------------------------------------------\\
{ PowerMine - Main PowerMiner function. Combinds all mine procedures. ||
\\------------------------------------------------------------------------//}

function PowerMine: Boolean;
var
Mx, My, TempColor, InvSpot, MaxWait : Integer;
FoundRock: Boolean;
begin
if not(LoggedIn)then Exit;
if(FindRock)then
begin
GameTab(4);
for InvSpot := 1 to 28 do
if not(ExistsItem(InvSpot))then
Break;
MarkTime(MaxWait);
for I := 0 to GetArrayLength(arOreColorResults) - 1 do
begin
MMouse(arOreColorResults[I].x, arOreColorResults[I].y, 0, 0);
if(IsUpText('Mine'))then
begin
FoundRock := True;
Break;
end;
Wait(300);
if(TimeFromMark(MaxWait) > 2000)then
Exit;
end;
if not(FoundRock)then
Exit;
Result := True;
GetMousePos(Mx, My);
TempColor := GetColor(Mx, My);
if not(GasCheck(Mx, My - 20))then
begin
if Random (20) < 19 Then Mouse(Mx, My, 0, 0, True)
else
begin
Mouse(Mx, My, 0, 0, False);
ChooseOption(x, y, 'Mine');
end;
end
else
begin
HandleGas;
Exit;
end;
MarkTime(MineMax);
MarkTime(MaxWait);
WaitWhileWorking(Mx, My, InvSpot, MineMax);
end;
end;

//------------------------------------------------------------------------\\
{ PlayersTime - Time to switch players ? ||
\\------------------------------------------------------------------------//}

procedure PlayersTime;
begin
if not(LoggedIn)then
Exit;
if(LoadsDone >= TheLoads)then
begin
Writeln('Logging out player, loads done.');
Players[CurrentPlayer].Loc := 'Done Mining';
Logout;
end;
end;

//------------------------------------------------------------------------\\
{ CheckVersion - Gets latest version if needed ||
\\------------------------------------------------------------------------//}

procedure CheckVersion;
var
TheFileNumber: Integer;
CurrentVersion: Extended;
TheScriptString, ScriptName, CurrentVersionString: string;
begin
CurrentVersionString := GetPage('http://sumilionscripts.freehostia.com/SPMVersion.txt');
CurrentVersion := StrToFloat(CurrentVersionString);
if(CurrentVersion > StrToFloat(VersionNumber))then
begin
Writeln('Your current version is not the latest.');
Writeln('Downloading new version, please wait...');
TheScriptString := GetPage('http://sumilionscripts.freehostia.com/SPM.scar');
ScriptName := 'SPM v' + CurrentVersionString + '.scar';
TheFileNumber := ReWriteFile(ScriptPath + ScriptName, false);
WriteFileString(TheFileNumber, TheScriptString);
Writeln('Updated script can be found at :');
Writeln(ScriptPath + ScriptName);
TerminateScript;
end;
end;

//------------------------------------------------------------------------\\
{ SetupClient - Makes SCAR ready to handle the script. ||
\\------------------------------------------------------------------------//}

procedure SetupClient;
begin
SetupSRL;
SetupSRLMining;
ScriptID := '12';
LoadImages;
CheckHPFirst := CheckForHealth;
Cleardebug;
Signature;
CheckVersion;
DisguiseScar('RuneScape - the massive online adventure game by Jagex Ltd');
StartPlayers(ShowPlayerForm, 'string1 string2 string3');
CurrentPlayer := StartPlayer;
ActivateClient;
Wait(500+Random(1000));
end;

//------------------------------------------------------------------------\\
{ SetupUser - Makes Character ready to handle the script. ||
\\------------------------------------------------------------------------//}

procedure SetupUser;
begin
LoginPlayer;
SetOreColor;
TheLoads := LoadsPerPlayer + Random(RandomLoads);
LoadsDone := 0;
MakeCompass('N');
HighestAngle;
if not SumFindPickHeadColor then
begin
Writeln('No Paxe found... logging out.');
Logout;
NextPlayer(false);
end;
Players[CurrentPlayer].Level[15] := GetSkillLevel('mining');
Players[CurrentPlayer].Loc := 'Mining';
SetRun(true);
MarkTime(MineMax);
end;

//------------------------------------------------------------------------\\
{ Main line - Combinds all magic =]. ||
\\------------------------------------------------------------------------//}

begin
SetupClient;
repeat;
SetupUser;
repeat;
while(InvCount < 28)and
(LoggedIn)do
begin
if(UseTimeOut)then
if(TimeFromMark(MineMax) > 300000)then
Break;
Wait(20);
PowerMine;
Wait(20);
if(FindNormalRandoms)then
MarkTime(MineMax);
end;
if(UseTimeOut)then
if(TimeFromMark(MineMax) > 300000)then
PlayerLost('Player lost, timed out.');
if(LoggedIn)then
begin
KeepUpStats;
DropOres;
end;
ProgressReport;
PlayerStatus := LoggedIn;
PlayersTime;
until not(LoggedIn);
NextPlayer(PlayerStatus);
until not(Players[CurrentPlayer].Active);
end.