Simba Code:
program simplecoalpowerminer;
{$DEFINE SMART}
{$i srl/srl.simba}
// If using this in the miners guild a high angle looking South is recommended.
var
StartingXp, OriginalXp, CoalMined, TimeOut: Integer;
const
(********************Begin Setup*********************************)
SRLStats_Username = ''; // your SRL stats username
SRLStats_password = ''; // your srl stats password
Version = '1.0';
CustomMouseSpeed = 15;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username?
Players[0].Pass := ''; // Password?
Players[0].Nick := ''; // 3 letters of your username (not the first letter)
Players[0].Active := True;
end;
(***************************End Setup******************************)
{Begin: Modified from MKHerbCleaner2.7 by GetDropped69}
procedure Antiban;
begin
case Random(1500) of
0..25:
begin
HoverSkill('Mining',false);
MouseBox(645,169,670,203,1);
end;
100..150:
begin
Sleep(1500+Random(1500));
end;
350..400:
begin
GameTab(tab_Friends);
Sleep(80+Random(225));
MouseBox(644,168,669,202,1);
end;
600..650:
begin
Mouse(260,160,5,6,false);
Sleep(200+Random(100));
MMouse(190,276,10,30);
Sleep(250+Random(100));
MMouse(495,45,50,50);
end;
800..850:
begin
ToggleMoneyPouch(true);
Sleep(200+Random(250));
Mouse(532,98,10,10,false);
WaitOptionMulti(['Examine money','money pouch'],200);
Sleep(500+Random(200));
ToggleMoneyPouch(false);
end;
900..950:
begin
SleepAndMoveMouse(2000+Random(2000));
end;
end;
end;
{End: Modified from MKHerbCleaner2.7 by GetDropped69}
function XPPerHour(Runtime,Gained:Extended):Extended;
begin
Result:=((Gained * 3600) / (Runtime / 1000));
end;
Function GainedXP:Extended;
begin
Result:= GetXPBarTotal - StartingXp;
end;
procedure ProgressReport;
var
TimeGone, CurrentXp, XpGain, CoalInInv: Integer;
begin
ClearDebug;
TimeGone := (GetTimeRunning/1000);
if(TimeGone = 0) then
exit;
CoalInInv := InvCount
CurrentXp := GetXPBar(1);
originalxp := GetXPBarTotal;
XpGain := (currentxp-originalxp);
begin
writeln('****************************************************************************');
writeln('****************************************************************************');
writeln('****************************************************************************');
writeln('****************************************************************************');
writeln('*Simple Coal Powerminer Version One*');
writeln('*We have mined: ' +IntToStr(CoalMined) + 'coal*');
writeln('*We have gained: ' + floattostr(GainedXp) + ' xp');
Writeln('Thats ' + FloatToStr(XpPerHour(GetTimeRunning,GainedXp))+ ' Xp Per Hour*');
writeln('*Total Running Time: ' + IntToStr(GetTimeRunning/60000) + ' Minutes*');
writeln('*****************************************************************************');
writeln('*****************************************************************************');
writeln('*****************************************************************************');
writeln('*****************************************************************************');
end;
end;
function AutoCoalColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL, R, G, B: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.20, 0.19);
if not (FindColorsTolerance(arP, 2237475, MSX1, MSY1, MSX2, MSY2, 7)) 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 >= 17) and (R <= 52) and (G >= 17) and (G <= 54) and (B >= 16) and (B <= 52) 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;
Function MineCoal :Boolean;
var
a: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
tmpCTS : Integer;
PlusOne: Integer;
counter: Integer;
begin
FindNormalRandoms;
PlusOne := InvCount+1;
if(not(LoggedIn))then Exit;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.39, 0.10); //Hue and Sat here
FindColorsTolerance(TPA, AutoCoalColor, MSX1, MSY1, MSX2, MSY2, 7); //Color and tolerance here
SortTPAFrom(TPA, Point(MSCX, MSCY));
ATPA := TPAtoATPAEx(TPA, 25, 25);
SortATPAFromSize(ATPA, 500, true);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
MMouse(MP.X, MP.Y, 4, 4);
if WaitUptext('Mine Coal', 2000) then //Uptext of mining the rock
begin
FindNormalRandoms;
ClickMouse2(mouse_left);
Result := True;
flag;
marktime(counter);
repeat
FindNormalRandoms;
antiban;
wait(1000);
if invcount = plusone then
writeln('you add an ore of coal to your inventory');
until (invcount=PlusOne) or (TimeFromMark(counter) > 8000);
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
procedure FailSafe;
var
Time, MaxTime: Integer;
begin
Time := 0;
maxTime := (RandomRange(10000, 20000));
MarkTime(Time)
repeat
if (TimeFromMark(Time) >= MaxTime) then
logout;
TerminateScript;
until(False);
end;
procedure Dropcoal;
Var
I : Integer;
B : TBox;
begin
FindNormalRandoms;
for i := 1 to 28 do
begin
If(ExistsItem(I))then
Begin
FindNormalRandoms;
B := InvBox(I);
If(CountColorTolerance(autocoalcolor, B.x1, B.y1, B.x2, B.y2, 20) > 50)then
Begin
MouseItem(I, mouse_Right);
WaitOption('rop', 100+Random(500));
FindNormalRandoms;
End;
End;
End;
End;
//credits: A big thanks to all the guys in the help section that helped
//me get this script into a working order.
begin
SetupSRL;
DeclarePlayers;
ActivateClient;
if not (LoggedIn) then
LogInPlayer;
if not(IsXPBarOpen) then
ToggleXPBar(True);
StartingXp := GetXPBarTotal;
MarkTime(TimeOut);
MouseSpeed := CustomMouseSpeed;
repeat
FindNormalRandoms;
marktime(TimeOut);
if (TimeFromMark(TimeOut) >30000) then
begin
FailSafe;
end;
MineCoal;
CoalMined := CoalMined + 1;
Dropcoal;
progressreport;
until(false);
end.