Roflme
2012-11-04 09:37:42
program RoflmeRimmingtonMine;
{$DEFINE SMART}
{$i SRL/SRL.simba}
{$i SPS/SPS.simba}
{$i SRL/SRL/Misc/Debug.simba}
{$I SRL/SRL/Misc/Online.simba}
const
WaitForHowLong = 4000; // Milliseconds waited for script to try mining again.
// Increase if your mining is low leveled.
var
x, y, HomeTele, PortSarim, TeleportCheck:Integer;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
With Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := true;
end;
end;
procedure SetDTMs;
begin
HomeTele := DTMFromString('mbQAAAHicY2VgYGBngAAQzQel2bGI7zvyiaFtzg2GlXufgmkQlgOKo2NGLBgMAIhLC5Q=');
PortSarim := DTMFromString('mggAAAHicY2NgYOAAYi4gZgVidiDmZ4AACSDmhmIQEIRiGWk5OL62hZPBzc0djDmBctgwIw4MAQBP+AT4');
end;
procedure AntiBan;
begin
Case Random(6000) of
1: RandomRClick;
2: RandomMovement;
3..10: BoredHuman;
11..20: PickUpMouse;
21..5999: Wait(50);
end;
SetAngle(SRL_ANGLE_HIGH);
Wait(50+Random(20));
end;
function ClickCompassNorth:boolean;
var
d: Integer;
begin
Mouse(543, 33, 10, 2, mouse_left);
Wait(200+random(20));
for d := 0 to 5 do
if rs_GetCompassAngleDegrees = d then
begin
Result := True;
Writeln('Successfully changed Compass');
end;
SetAngle(SRL_ANGLE_HIGH);
end;
function OreColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 2.27);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 6730204, MSX1, MSY1, MSX2, MSY2, 11);
if (Length(arP) = 0) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
Result := arC[i];
Break;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Exit;
end;
function SnowColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(3.49, 1.84);
if not (FindColorsTolerance(arP, 14473666, MMX1, MMY1, MMX2, MMY2, 35)) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
Result := arC[i];
Break;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Exit;
end;
function GoFindObj(Color, Tol: Integer; ObjText: string): Boolean;
var
CTS, I, N: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.7, 0.2);
For N := 0 to 1 do
if not FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, Tol) then
Exit;
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 3, 3);
FilterTPADist(TPA, 3);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 0, 0);
Wait(50+random(10));
If IsUpText(ObjText) then
begin
Result := True
Writeln('Found Object');
Break;
end;
end;
end;
procedure MineClay;
var
MineWait, PlusOne:Integer;
begin
Writeln('Time to start mining!');
MakeCompass('45');
repeat
if InvFull then
Exit;
PlusOne := InvCount + 1
if GoFindObj(OreColor, 1, 'lay') then
begin
ClickMouse2(true);
MarkTime(MineWait);
end;
repeat
Wait(50+random(10));
until (TimeFromMark(MineWait) > WaitForHowLong) or (InvCount = PlusOne);
until(InvFull);
Exit;
end;
function isTeleporting:boolean;
var
Shift:integer;
YourBox: TBox;
begin
YourBox := PointToBox(Point(MSCX-17, MSCY-11),Point(MSCX+10,MSCY+30));
begin
Shift := AveragePixelShift(YourBox, 250, 500);
if Shift > 300 then
begin
Result := True;
Writeln('Teleporting');
end else
Exit;
Wait(100);
end;
end;
function DaemonheimCheck:integer;
begin
Result := CountColorTolerance(SnowColor, MMCX-40, MMCY-40, MMCX+40, MMCY+40, 35);
Writeln(Result);
end;
function isDaemonheim:boolean;
begin
if DaemonheimCheck > 200 then
begin
Result := True;
Writeln('At Daemonheim');
end;
end;
procedure StartTeleportDaemonheim;
begin
GameTab(tab_Equip);
MouseTBox(GetEquippedItemBounds('ring'), mouse_right);
ChooseOptionMulti(['Teleport',' to Daemonheim', 'Daemonheim', 'Daemon', 'Telepor', 'rt to Dae', 'monheim']);
end;
function CheckTeleportDaemonheim:boolean;
begin
if isDaemonheim then
begin
Result := True;
Exit;
end else
MarkTime(TeleportCheck);
repeat
if isTeleporting then
Break;
Writeln('Checking');
until(TimeFromMark(TeleportCheck) > 4000) or isDaemonheim;
if TimeFromMark(TeleportCheck) > 4000 then
begin
Writeln('Time is past 4 seconds');
StartTeleportDaemonheim;
CheckTeleportDaemonheim;
Exit;
end;
end;
function WalkToBank:boolean;
var
myPath:TPointArray;
begin
ClickCompassNorth;
SPS_Setup(RUNESCAPE_SURFACE, ['13_3', '13_4', '14_3', '14_4']);
myPath := [Point(5637, 1819), Point(5637, 1768)]
SPS_WalkPath(myPath);
repeat
Wait(50+random(10));
until not isMoving
if FindSymbol(x, y, 'bank') then
begin
Result := True;
Writeln('At the bank');
end;
if not FindSymbol(x, y, 'bank') then
begin
Writeln('Messed up walking, will try again');
StartTeleportDaemonheim;
CheckTeleportDaemonheim;
WalkToBank;
end;
end;
function FremennikBank:boolean;
begin
repeat
if FindObjTPA(x, y, 6242869, 18, 2, 4, 4, 15, ['Fremen', 'banker', 'ik bank']) then
begin
Mouse(x, y, 1, 1, False);
WaitOption('Bank', 1000);
Wait(1000)
end;
until BankScreen or PinScreen;
if PinScreen then
begin
repeat
InPin(Players[0].Pin);
until BankScreen
end;
if BankScreen then
Result := True;
repeat
DepositAll;
Wait(300+random(30));
until InvCount=0
CloseBank;
end;
procedure StartTeleportPortSarim;
begin
GameTab(tab_Magic);
if FindDTM(HomeTele, x, y, MIX1, MIY1, MIX2, MIY2) then
Mouse(x, y, 3, 3, mouse_left);
Wait(600+random(70));
repeat
if FindDTM(PortSarim, x, y, MSX1, MSY1, MSX2, MSY2) then
Mouse(x, y, 2, 4, mouse_left);
wait(1000+random(100));
until not LodestoneScreen;
end;
function isPortSarim:boolean;
begin
if FindSymbol(x, y, 'lodestone') then
begin
Result := True;
end;
end;
function CheckTeleportPortSarim:boolean;
begin
if isPortSarim then
begin
Result := True;
Exit;
end else
MarkTime(TeleportCheck);
repeat
if isTeleporting then
Break;
Writeln('Checking');
until(TimeFromMark(TeleportCheck) > 4000) or isPortSarim;
if TimeFromMark(TeleportCheck) > 4000 then
begin
Writeln('Time is past 4 seconds');
StartTeleportPortSarim;
CheckTeleportPortSarim;
Exit;
end;
end;
function WalkToMine:boolean;
var
myPath:TPointArray;
begin
if IsPortSarim then
begin
SPS_Setup(RUNESCAPE_OTHER, ['rimmington']);
myPath := [Point(259, 172), Point(227, 142), Point(204, 97), Point(167, 83), Point(146, 115)];
SPS_WalkPath(myPath);
if FindSymbol(x, y, 'mine') then
begin
Result := True;
end;
end;
end;
begin
Cleardebug;
DeclarePlayers;
SRL_SixHourFix := True;
Smart_FixSpeed := True;
SetupSRL;
SmartSetRefresh(40);
LoginPlayer;
ClickCompassNorth;
SetDTMs;
repeat
Writeln('Going to get to mine');
StartTeleportPortSarim;
Writeln('Making sure everything is working');
CheckTeleportPortSarim;
Writeln('Successfully teleported to Port Sarim, going mine');
WalkToMine;
Writeln('Successfully walked to mine, mining some clay');
MineClay;
Writeln('Full invo, banking');
StartTeleportDaemonheim;
Writeln('Making sure teleport to Daemonheim is going as planned');
CheckTeleportDaemonheim;
Writeln('At Daemonhiem successfully, going to bank');
WalkToBank;
Writeln('Found bank, banking');
FremennikBank;
until(false);
end.Working on this new project starting with getting a working Rimmington miner.
Wherever I start the script, it'll start teleporting but then it'll say
Successfully teleported to Port Sarim, going mine
Successfully walked to mine, mining some clay
Time to start mining!Which means CheckTeleportPortSarim is coming back true? Even when I start it in the middle of nowhere…
And then WalkToMine is coming back true as well??
Why??? What am I doing wrong…
(Ignore the banking procedures, they're just temporary. I just want it to be able to teleport, walk to mine, and get a full inventory first.)