Results 1 to 3 of 3

Thread: South east Lumbridge miner

  1. #1
    Join Date
    Jun 2013
    Posts
    9
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default South east Lumbridge miner

    Features
    • Optional Powerminer
    • Optional Copper, Tin 1:1 ratio
    • Banks in Draynor
    • Can keep or drop gems
    • Takes breaks
    • Uses pixel shift to detect idle rather than timers


    Setup
    Put the DraynoreMiner image inside of the sps Runescape_Surface Folder.
    Download the simba file, or copy and paste the script within simba.


    Script
    Simba Code:
    program DraynoreMiner;
    {$DEFINE SMART}
    {$i srl/srl.simba}
    {$i sps/sps.simba}

    const
      USERNAME = '';
      PASSWORD = '';
      BANK_PIN = '';
      PICKAXE_IN_FIRST_SLOT = False;
      POWERMINE = False;
      EQUAL_TIN_COPPER = True;
      KEEP_GEMS = False;
      BREAK_EVERY = 2; //In Hours
      BREAKFOR = 20;   //In Minutes

    var
      InvSlot, TotalTin, TimeRan, TotalCopper, BankTimer: Integer;
      TotalGems, TotalMined, BankCount, BreaksTaken, MX, MY: Integer;
      Seconds, Minutes, Hours: Integer;
      ToBank, FromBank, ChosenPath: TPointArray;

    procedure CheckLobby;
    begin
      if (LobbyScreen) then
      begin
        LoginPlayer;
      end;
      if not loggedin then
      begin
        loginPlayer;
      end;
    end;

    procedure AntiRandom;
    begin
      CheckLobby;
      FindNormalRandoms;
      ExitSquealOfFortune;
      CloseAdWindow;
    end;

    procedure AntiBan;
    var
      Chance: Integer;
    begin
      Chance := Random(600);
      if (Chance < 10) then
        CompassMovement(10, 30, true);
      if (Chance < 20) and (Chance > 10) then
        HoverSkill(skill_Mining, False);
      if (Chance < 30) and (Chance > 20) then
        RandomTab(true);
      if (Chance < 40) and (Chance > 50) then
        PickUpMouse;
      if (Chance < 50) and (Chance > 60) then
        BoredHuman;
      SetAngle(SRL_ANGLE_HIGH);
    end;

    procedure DeclarePlayers;
    begin
      NumberOfPlayers(1);
      CurrentPlayer := 0;
      Players[0].Name := USERNAME;
      Players[0].Pass := PASSWORD;
      Players[0].Active := True;
      Players[0].Pin := BANK_PIN;
    end;

    procedure CheckInventory;
    begin
      if (ExistsItem(InvSlot)) then
      begin
        InvMouse(InvSlot, 3);
        if (IsUpTextMultiCustom(['ncut'])) then
        begin
        TotalGems := TotalGems + 1;
          if (KEEP_GEMS) then
          begin
            InvSlot := (InvSlot + 1);
          end
          else
          begin
            DropItem(InvSlot);
          end;
        end
        else
        begin
          if (IsUpTextMultiCustom(['Tin'])) or (IsUpTextMultiCustom(['Copper'])) then
          begin
          end
          else
          begin
            Dropitem(InvSlot);
          end;
        end;
      end;
    end;

    procedure Math;
    begin
      Seconds := 0;
      Minutes := 0;
      Hours := 0;
      Seconds := TimeRan / 1000;
      while seconds > 60 do
      begin
        Seconds := Seconds - 60;
        Minutes := Minutes + 1;
      end;
      while Minutes > 60 do
      begin
        Minutes := Minutes - 60;
        Hours := Hours + 1;
      end;
    end;

    procedure Report;
    begin
      Math;
      ClearDebug;
      writeln('//////////////////////Report\\\\\\\\\\\\\\\\\\\\\\\\\\');
      writeln('Ran for ' + IntToStr(Hours) + ' Hours ' + IntToStr(Minutes) + ' Minutes and ' + IntToStr(Seconds) + ' Seconds');
      writeln('Mined ' + IntToStr(TotalMined) + ' Total');
      writeln(IntToStr(TotalCopper) + ' Copper');
      writeln(IntToStr(TotalTin) + ' Tin');
      writeln('Found ' + IntToStr(TotalGems) + ' Gems');
      writeln('Banked ' + IntToStr(BankCount) + ' Times');
      writeln('Took ' + IntToStr(BreaksTaken) + ' Breaks');
    end;

    procedure ActiveCheckInventory;
    begin
      if not InvFull then
      begin
        if (ExistsItem(InvSlot)) then
        begin
          InvMouse(InvSlot, 3);
          if (IsUpTextMultiCustom(['ncut'])) then
          begin
            if (KEEP_GEMS) then
            begin
              InvSlot := (InvSlot + 1);
            end
            else
            begin
              DropItem(InvSlot);
            end;
          end
          else
          begin
            if (IsUpTextMultiCustom(['in'])) or (IsUpTextMultiCustom(['opper'])) then
            begin
              if not (InvSlot = 28) then
              begin
                InvSlot := InvSlot + 1;
              end;
            end
            else
            begin
              Dropitem(InvSlot);
            end;
          end;
        end;
      end;
    end;

    function Idle: boolean;
    var
      PlayerBox: TBox;
    begin
      PlayerBox := IntToBox(245, 130, 285, 195);
      if (AveragePixelShift(PlayerBox, 100, 250) < 40) then
      begin
        result := True;
      end
      else
      begin
        result := False;
      end;
    end;

    procedure SetInvSlots;
    begin
      InvSlot := 1;
      if (PICKAXE_IN_FIRST_SLOT) then
        InvSlot := 2;
    end;

    procedure SetDefaults;
    begin
      SetInvSlots;
      ToBank := [Point(653, 461), Point(660, 456), Point(663, 447),
        Point(651, 441), Point(628, 455), Point(614, 468), Point(610, 487),
        Point(601, 494), Point(586, 500), Point(573, 502), Point(551, 499),
        Point(535, 501), Point(519, 492), Point(500, 492), Point(483, 496),
        Point(461, 488), Point(447, 475), Point(420, 460), Point(405, 456),
        Point(380, 454), Point(360, 452), Point(338, 438), Point(321, 412),
        Point(315, 392), Point(315, 370), Point(308, 354), Point(305, 328),
        Point(298, 313), Point(291, 287), Point(285, 269), Point(273, 244),
        Point(252, 214), Point(222, 177), Point(213, 170), Point(199, 156),
        Point(185, 144), Point(170, 132), Point(161, 116), Point(155, 108),
        Point(146, 94), Point(136, 85), Point(122, 66), Point(109, 69),
        Point(110, 88)];
      FromBank := [Point(111, 86), Point(106, 74), Point(111, 64),
        Point(136, 64), Point(142, 77), Point(142, 87), Point(151, 108),
        Point(153, 116), Point(158, 128), Point(159, 154), Point(171, 173),
        Point(175, 181), Point(180, 189), Point(188, 199), Point(206, 226),
        Point(211, 234), Point(230, 252), Point(253, 275), Point(261, 276),
        Point(273, 277), Point(288, 298), Point(302, 321), Point(306, 327),
        Point(311, 336), Point(318, 349), Point(326, 369), Point(339, 380),
        Point(351, 397), Point(355, 418), Point(369, 439), Point(371, 453),
        Point(392, 469), Point(400, 476), Point(420, 478), Point(451, 489),
        Point(480, 491), Point(511, 497), Point(536, 502), Point(575, 498),
        Point(605, 490), Point(637, 481), Point(634, 449), Point(659, 434),
        Point(654, 464)];
    end;

    procedure Walk(Direction: string);
    begin
      SPS_Setup(runescape_surface, ['DraynoreMiner']);
      if (Direction = 'To') then
      begin
        ChosenPath := ToBank;
      end
      else
      begin
        ChosenPath := FromBank;
      end;
      SPS_WalkPath(ChosenPath);
      wait(2000);
      timeran := timeran + 2000;
    end;

    procedure CheckSlot;
    begin
      AntiRandom;
      repeat
        ActiveCheckInventory;
      until not (ExistsItem(InvSlot));
    end;

    procedure MineCopper(MustBeSuccessful: Boolean);
    var
      Success: boolean;
    begin
      Success := False;
      repeat
        report;
        CheckLobby;
        Findobj(MX, MY, 'Copper ore rocks', 5083645, 5);
        Mouse(MX, MY, 2, 2, true);
        AntiBan;
        wait(1000);
        TimeRan := TimeRan + 1000;
        CheckSlot;
        repeat
          AntiRandom;
          wait(200);
          TimeRan := TimeRan + 200;
          CheckInventory;
        until idle;
        if (MustBeSuccessful = False) then
        begin
          Success := True;
          if (ExistsItem(InvSlot)) then
          begin
            InvMouse(InvSlot, 3);
            if (IsUpTextMultiCustom(['opper'])) then
            begin
              InvSlot := InvSlot + 1;
              TotalCopper := TotalCopper + 1;
              TotalMined := TotalMined + 1;
            end
            else
            begin
              InvSlot := InvSlot + 1;
            end;
          end;
        end
        else
        begin
          if not (invfull) then
          begin
            Checklobby;
            if (ExistsItem(InvSlot)) then
            begin
              InvMouse(InvSlot, 3);
              if (IsUpTextMultiCustom(['ncut'])) then
              begin
                TotalGems := TotalGems + 1;
                if (KEEP_GEMS) then
                begin
                  InvSlot := (InvSlot + 1);
                end
                else
                begin
                  DropItem(InvSlot);
                end;
              end
              else
              begin
                if (IsUpTextMultiCustom(['opper'])) then
                begin
                  InvSlot := InvSlot + 1;
                  TotalCopper := TotalCopper + 1;
                  TotalMined := TotalMined + 1;
                  Success := True;
                end
                else
                begin
                  DropItem(InvSlot);
                end;
              end;
            end;
          end;
        end;
      until (Success = True) or (InvFull);
    end;

    procedure MineTin(MustBeSuccessful: Boolean);
    var
      Success: boolean;
    begin
      Success := False;
      repeat
        CheckLobby;
        report;
        Findobj(MX, MY, 'Tin ore rocks', 11513783, 5);
        Mouse(MX, MY, 2, 2, true);
        AntiBan;
        wait(1000);
        TimeRan := TimeRan + 1000;
        CheckSlot;
        repeat
          AntiRandom;
          wait(200);
          TimeRan := TimeRan + 200;
          CheckInventory;
          CheckLobby;
        until idle;
        if (MustBeSuccessful = False) then
        begin
          Success := True;
          if (ExistsItem(InvSlot)) then
          begin
            InvMouse(InvSlot, 3);
            if (IsUpTextMultiCustom(['in'])) then
            begin
              InvSlot := InvSlot + 1;
              TotalTin := TotalTin + 1;
              TotalMined := TotalMined + 1;
            end
            else
            begin
              InvSlot := InvSlot + 1;
            end;
          end;
        end
        else
        begin
          if (ExistsItem(InvSlot)) then
          begin
            InvMouse(InvSlot, 3);
            if (IsUpTextMultiCustom(['in'])) then
            begin
              InvSlot := InvSlot + 1;
              TotalTin := TotalTin + 1;
              TotalMined := TotalMined + 1;
              Success := True;
            end
            else
            begin
              DropItem(InvSlot);
            end;
          end;
        end;
      until (Success = True) or (InvFull);
    end;

    procedure SetupSmartClient;
    var
      Ran: Integer;
    begin
      SRL_SixHourFix := True;
      SMART_FixSpeed := True;
      ClearDebug;
      SetupSRL;
      ActivateClient;
      DeclarePlayers;
      if not LoggedIn then
      begin
        LoginPlayer;
        Ran := Random(2000);
        wait(1000 + Ran);
        TimeRan := TimeRan + 1000 + ran;
        SetAngle(SRL_ANGLE_HIGH);
      end;
      if IsActionBarOpen then
        MouseBox(500, 260, 510, 270, Mouse_Left);
    end;

    procedure BankLoop;
    var
      Ran: Integer;
    begin
      Walk('To');
      repeat
        Findobj(MX, MY, 'ounter', 2634036, 5);
        mouse(MX, MY, 2, 2, true);
        Checklobby;
        wait(5000);
        TimeRan := TimeRan + 500;
        Report;
        repeat
          wait(500);
          TimeRan := TimeRan + 500;
          BankTimer := BankTimer + 1;
          CheckLobby;
        until (BankScreen = true) or (BankTimer = 6);
        BankTimer := 0;
      until (BankScreen = true);
      if (PICKAXE_IN_FIRST_SLOT) then
      begin
        Deposit(2, 28, True);
      end
      else
      begin
        DepositAll;
      end;
      Ran := Random(400);
      wait(300 + Ran);
      TimeRan := TimeRan + Ran;
      CloseBank;
      BankCount := BankCount + 1;
      TimeRan := TimeRan + (360000);
      SetInvSlots;
      Report;
      Walk('From');
    end;

    procedure Start;
    begin
      SetDefaults;
      SetupSmartClient;
    end;

    procedure MineLoop;
    begin
      if not invFull then
      begin
        if (EQUAL_TIN_COPPER) then
        begin
          repeat
            Report;
            MineCopper(True);
            MineTin(True);
          until (InvFull) or (InvSlot = 28);
        end
        else
        begin
          repeat
            Report;
            MineCopper(False);
            MineTin(False);
          until (InvFull);
        end;
      end;
    end;

    procedure DoBreak;
    var
      Minute, TempBreakFor: Integer;
    begin
      TempBreakFor := BREAKFOR + Random(10);
      repeat
        Logout;
      until not LoggedIn;
      repeat
        wait(60000);
        Minute := Minute + 1;
      until Minute = TempBreakFor;
      repeat
        LoginPlayer;
      until LoggedIn;
    end;

    procedure CheckBreak;
    var
      TempBreaks, TempHours: Integer;
    begin
      TempBreaks := BreaksTaken;
      TempHours := Hours;
      while TempBreaks > 0 do
      begin
        TempHours := TempHours - 2;
        TempBreaks := TempBreaks - 1;
      end;
      if TempHours = BREAK_EVERY then
      begin
        DoBreak;
        BreaksTaken := BreaksTaken + 1;
      end;
    end;

    procedure MainLoop;
    begin
      repeat
        Report;
        CheckBreak;
        Checklobby;
        MineLoop;
        if (POWERMINE) then
        begin
          if (PICKAXE_IN_FIRST_SLOT) then
          begin
            DropAllExcept([1]);
            SetInvSlots;
            Report;
            CheckBreak;
            CheckLobby;
          end
          else
          begin
            DropAll;
            SetInvSlots;
            Report;
            CheckBreak;
            CheckLobby;
          end;
        end
        else
        begin
          CheckBreak;
          Report;
          BankLoop;
          Report;
          CheckBreak;
          CheckLobby;
        end;
      until (false);
    end;

    begin
      Start;
      repeat
        MainLoop;
      until (false);
    end.

    Image
    DraynoreMiner.png
    Attached Files Attached Files
    Last edited by cgpice; 07-04-2013 at 08:20 PM. Reason: Update to fix Gem Counting

  2. #2
    Join Date
    Jun 2013
    Posts
    9
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Update:
    Fixed an issue with the gem counting only counting on copper.

  3. #3
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    @cgpice

    This script is better then most first scripts. Do you want me to move it to the other mining scripts?
    Working on: Tithe Farmer

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •