Results 1 to 13 of 13

Thread: Switching players won't work

  1. #1
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Switching players won't work

    I'm having some problems changing players and I have no idea why.

    Thsi is my playerswitch procedure:
    SCAR Code:
    procedure TheNext;
    var
      Status: Boolean;
    begin
      Status := LoggedIn;
      Logout;
      W(SleepTime * 60 * 1000);
      if (Players[CurrentPlayer].Integers[1] >= MaxLoads) then
        Status := False;
      NextPlayer(Status);
      Loads := 0;
      Proggie;
    end;

    And my mainloop:
    SCAR Code:
    begin
    Setup;
    repeat
      DTMSetup('Miningstone', TheOre);
      SetAngle(True);
      MakeCompass('n');
      while (Loads < Players[CurrentPlayer].Integers[0]) do
      begin
        GetMiningLvl(Players[CurrentPlayer].Integers[3]);
        WalkToMine;
        Miner;
        WalkToShop;
        Seller;
      end;
      TheNext;
    until AllPlayersInactive;
    end.

    I have 3 players that are active (yes, I've checked, they are setup correctly).
    It does 5 loads, logs out and then it logs into the same account?

    Any help will be appreciated

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What is the exact problem.
    ~Hermen

  3. #3
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It uses the same player over and over again instead of switching to the next.

  4. #4
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Maybe you've set the playersusing := count; wrong.
    I'm not sure it's called playersusing.
    ~Hermen

  5. #5
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    What's your Setup procedure look like?

  6. #6
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I assume
    SCAR Code:
    W(SleepTime * 60 * 1000);

    is your sleeping function. Does that log the player back in before NextPlayer does?

  7. #7
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure Setup;
    begin
      SmartSetupEx(121, False, True, False);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      SetupMining;
      DeclarePlayers;
      SetupFrtAntiBan;
      ActivateClient;
      LoginPlayer;
      ClearDebug;
      Proggie;
    end;

    W() is just this:
    SCAR Code:
    procedure W(Timer: Integer);
    begin
      Wait(Timer + Random(500));
    end;

    Made it since I hate typing Random(500).

  8. #8
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Just post your script we can't help you with this, if the information you gave us is almost nothing.
    ~Hermen

  9. #9
    Join Date
    Mar 2009
    Location
    Ireland
    Posts
    111
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Hermpie View Post
    Just post your script we can't help you with this, if the information you gave us is almost nothing.
    hear, hear...

    pm it if you dont want it public (which is sort of silly if you are going to release it)

  10. #10
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Code:
    begin
    Setup;
    repeat
      DTMSetup('Miningstone', TheOre);
      SetAngle(True);
      MakeCompass('n');
      while (Loads < Players[CurrentPlayer].Integers[0]) do
      begin
        GetMiningLvl(Players[CurrentPlayer].Integers[3]);
        WalkToMine;
        Miner;
        WalkToShop;
        Seller;
      end;
      TheNext;
    until AllPlayersInactive;
      NextPlayer(Players[CurrentPlayer].Active);
    end.
    that should do it if it doesnt then post your whole script and ill do it with that

  11. #11
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program RimmingtonMiner;
    {.include SRL/SRL/Misc/Smart.Scar}
    {.include SRL/SRL.Scar}
    {.include SRL/SRL/Skill/Mining.Scar}
    {.include FrtAntiBan.Scar}

    const
      SleepTime = 3;
      MaxLoads = 200;

    var
      x, y, TheFS: Integer;
      TheOre, Loads: Integer;
     
    function Counter: Integer; forward;
    procedure Proggie; forward;
    procedure GetMiningLvl(var Return: Integer); forward;

    procedure W(Timer: Integer);
    begin
      Wait(Timer + Random(500));
    end;

    function FS(Times: Integer): Boolean;
    begin
      if (TheFS >= Times) then
      begin
        TheFS := 0;
        Result := True;
      end;
      Inc(TheFS);
    end;

    procedure Reset;
    begin
      TheFS := 0;
    end;

    procedure DeclarePlayers;
    begin
      Skills := ['Mining', 'Smithing', 'Hitpoints', 'Fishing', 'Cooking']; // Maximum is 5
      HowManyPlayers := 3;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name       := '';
      Players[0].Pass       := '';
      Players[0].Nick       := '';
      Players[0].Active     := True;   // Active
      Players[0].Integers[0] := 5;     // Loads to do before switching
      Players[0].Strings[0] := 'Iron'; // Copper, Tin, Iron, Gold, Auto
     
      Players[1].Name       := '';
      Players[1].Pass       := '';
      Players[1].Nick       := '';
      Players[1].Active     := True;   // Use this account?
      Players[0].Integers[0] := 5;     // Loads to do before switching
      Players[1].Strings[0] := 'Iron'; // Copper, Tin, Iron, Gold
     
      Players[2].Name       := '';
      Players[2].Pass       := '';
      Players[2].Nick       := '';
      Players[2].Active     := True;      // Use this account?
      Players[0].Integers[0] := 5;       // Loads to do before switching
      Players[2].Strings[0] := 'Iron'; // Copper, Tin, Iron, Gold
    end;

    function ContinueScript: Boolean;
    begin
      if FindPickHeadColor and LoggedIn then
        Result := true;
    end;

    function InShop: Boolean;
    begin
      if FindObj(x, y, 'adder', 2510699, 5) then
        Result := (Distance(MSCX, MSCY, x, y) < 100);
    end;

    function ReturnMineDTM(Str: String): Integer;
    begin
      case Lowercase(Str) of
        'tin': Result := DTMFromString('78DA630C606260886100032608C510EBC6C39' +
           '002A41981F83F10307A0365222072CC503561B1BE0CFC503520C0' +
           '08322788801A3FA01A2F026AA2806A62F1AB0100768B0CAE');
        'iron': Result := DTMFromString('78DA632C60626048644001B16E3C0C29409A1' +
           '188FF03016321508D2FAA9AB0585F0656A81A1060CC06AA8921A0' +
           'A61AA82689809A7AA01A5B089B192AD61AAE8AA20600B43E0D2B');
        'copper': Result := DTMFromString('78DA63AC616260F06700032608C5501DC3CF9' +
           '002A41981F83F1030160065BC51D5F8258633B042D58000633950' +
           '2610554D6DB43EAA9A7AA08C1B7E35000BDC0B95');
        'gold': Result := DTMFromString('78DA63CC646260886200034608C510E9CCCD9' +
           '002E5FF070246909A00881C13544D58AC2F032B921EC602A04C18' +
           '0135F940191F54353ED622286A00DB340AC6');
      end;
    end;

    function ReturnOreDTM(Str: String): Integer;
    begin
      case Lowercase(Str) of
        'tin': Result := DTMFromString('78DA63CC606260E0656440058C482490CE01A' +
           'A6122A0A618A8E60F037E35594035BF09A88907AA612560571C50' +
           '8D202361BBC408A82903AA1120420D170135D584C30700A08206C' +
           '8');
        'iron': Result := DTMFromString('78DA63CC66626078C18006189148209D05547' +
           '39D809A78A09A8704D4C402D5BC26A0261DA8E61301356540356F' +
           '08A8A902AA7944404D0950CD1D026A0A806A6EE057030032C30BF' +
           '9');
        'copper': Result := DTMFromString('78DA63DCC7C4C0C0C5C8800A189148207D0CA' +
           '8E60F037E3527806A980998731AA8868F08BB0409A801B9598C80' +
           '9A4D4498B311A88693809A6D40354C04D45C00AA61C1AF0600833' +
           'D091E');
        'gold': Result := DTMFromString('78DA63B4636260E0656440058C4824907603A' +
           'AF9C3805F8D0350CD6F026ACC816A9808D8650C54C34F408D3D50' +
           '8D180135EE44F8CB0BA84690801A3FA01A4E026A02816A1889B08' +
           'B01BF1A006A89057B');
      end;
    end;

    procedure DTMSetup(What: String; var Return: Integer);
    var
      Temp: String;
      Skill: Integer;
    begin
      Temp := Lowercase(Players[CurrentPlayer].Strings[0]);
      if GameTab(4) then
      begin
        GetMiningLvl(Skill);
        if (Temp = 'auto') then
        begin
          case Skill of
            0..20:
              begin
                case Random(2) of
                  0: Temp := 'copper';
                  1: Temp := 'tin';
                end;
              end;
            21..45: Temp := 'iron';
            46..99: Temp := 'gold';
          end;
        end;
      end else
      begin
        if (Temp = 'auto') then
        begin
          case Random(2) of
            0: Temp := 'copper';
            1: Temp := 'tin';
          end;
        end;
      end;
      // OreDTM
      case Lowercase(What) of
        'oredtm': Return := ReturnOreDTM(Temp);
        'minedtm': Return := ReturnMineDTM(Temp);
        'miningstone':
          begin
            case Temp of
              'copper': Return := rimmington_copper;
              'tin': Return := rimmington_tin;
              'iron': Return := rimmington_iron;
              'gold': Return := rimmington_gold;
            end;
          end;
      end;
    end;

    procedure WalkToMine;
    var
      TempD: Integer;
    begin
      if not ContinueScript then Exit;
      // Walk To Shop
      SetRun(True);
      if FindSymbol(x, y, 'shop') then
      begin
        if (Distance(MMCX, MMCY, x, y) > 25) then
        begin
          Mouse(x + 10, y, 5, 5, True);
          FFlag(5);
        end;
      end;
      // Walk To Portal
      if FindSymbol(x, y, 'portal') then
      begin
        Mouse(x, y, 5, 5, True);
        FFlag(5);
      end;
      // Walk to Mining entrance
      RadialRoadWalk(FindRoadColor, 45, 90, 70, 2, 2);
      // Walk to Mining spot with failsafe walk
      while not FindSymbol(x, y, 'mining spot') do
      begin
        if FS(1) then Break;
        Mouse(MMCX + 50, MMCY - 40, 5, 5, True);
        FFlag(5);
      end;
      Reset;
      if FindSymbol(x, y, 'mining spot') then
      begin
        Mouse(x, y, 5, 5, True);
        FFlag(5);
      end;
      DTMSetup('MineDTM', TempD);
      if FindDTM(TempD, x, y, MMX1, MMY1, MMX2, MMY2) then
      begin
        Mouse(x, y, 3, 3, True);
        Flag;
      end;
      FreeDTM(TempD);
      W(1000);
    end;

    procedure WalkToShop;
    begin
      if not ContinueScript then Exit;
      // Updates loads and ores
      Inc(Players[CurrentPlayer].Integers[1]);
      Inc(Loads);
      Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] + Counter;
      // Walks to mining spot
      SetRun(True);
      if FindSymbol(x, y, 'mining spot') then
      begin
        Mouse(x, y, 5, 5, True);
        FFlag(5);
      end;
      // Walks to entrance with failsafe
      while not RadialRoadWalk(FindRoadColor, 160, 270, 70, 2, 2) do
      begin
        if FS(1) then Break;
        Mouse(MMCX - 20, MMCY + 60, 5, 5, True);
        FFlag(5);
      end;
      Reset;
      // Walks towards portal
      RadialRoadWalk(FindRoadColor, 230, 270, 60, 2, 2);
      // Walks to Portal
      if FindSymbol(x, y, 'portal') then
      begin
        if (Distance(MMCX, MMCY, x, y) > 25) and (MMCY < y - 20) then
        begin
          Mouse(x, y, 5, 5, True);
          FFlag(5);
        end;
      end;
      // Walks to shop
      while not InShop do
      begin
        if FS(5) then Break;
        if FindSymbol(x, y, 'shop') then
        begin
          Mouse(x + 5, y, 2, 2, True);
          FFlag(5);
        end;
      end;
      Reset;
    end;

    procedure Miner;
    var
      Inv, C: Integer;
    begin
      while not InvFull do
      begin
        Inv := InvCount;
        Inc(C);
        if (C > 75) then Break;
        if FindObjRock(x, y, TheOre) then
        begin
          case Random(4) of
            0..2: Mouse(x, y, 2, 2, True);
            3:
              begin
                Mouse(x, y, 2, 2, False);
                W(500);
                ChooseOption('ine');
              end;
          end;
          while (Inv = InvCount) do
          begin
            W(1000);
            case Random(5) of
              0: FrtAntiBan;
            end;
            if FS(25) then Break;
          end;
          Reset;
        end else
        begin
          W(2000);
          case Random(5) of
            0: FrtAntiBan;
          end;
        end;
      end;
    end;

    procedure Seller;
    var
      i, TempD: Integer;
      B: TBox;
    begin
      DTMSetup('OreDTM', TempD);
      if FindObj(x, y, 'hop', 5206412, 5) then
      begin
        Mouse(x, y, 3, 3, False);
        W(200);
        if ChooseOption('rade') then
        begin
          W(4000);
          for i := 1 to 28 do
          begin
            B := InvBox(i);
            if FindDTM(TempD, x, y, B.X1, B.Y1, B.X2, B.Y2) then
            begin
              MouseItem(i, False);
              ChooseOption('50');
              W(1000);
              Break;
            end;
          end;
        end;
        Mouse(485, 43, 3, 3, True);
      end;
      FreeDTM(TempD);
      Proggie;
    end;

    procedure GetMiningLvl(var Return: Integer);
    var
      Tempx: Integer;
    begin
      Tempx := GetCurrentTab;
      Return := GetSkillLevel('mining');
      GameTab(Tempx);
    end;

    function Counter: Integer;
    var
      i, TempD: Integer;
      B: TBox;
    begin
      DTMSetup('OreDTM', TempD);
      GameTab(4);
      for i := 1 to 28 do
      begin
        B := InvBox(i);
        if FindDTM(TempD, x, y, B.X1, B.Y1, B.X2, B.Y2) then
          Inc(Result);
      end;
      FreeDTM(TempD);
    end;

    function CalcXp(Ores, Player: Integer): Extended;
    var
      xp: Extended;
    begin
      case Lowercase(Players[Player].Strings[0]) of
        'tin': xp := 17.5;
        'copper': xp := 17.5;
        'iron': xp := 35;
        'gold': xp := 65;
      end;
      Result := xp * StrToFloat(IntToStr(Ores));
    end;

    function WhatMining(Play: Integer): String;
    begin
      if (Lowercase(Players[Play].Strings[0]) = 'auto') then
      begin
        case Players[Play].Integers[3] of
          0: Result := 'unknown';
          1..20: Result := 'copper/tin';
          21..45: Result := 'iron';
          46..99: Result := 'gold';
        end;
      end else
        Result := Players[Play].Strings[0];
    end;

    procedure Proggie;
    var
      i: Integer;
    begin
      ClearDebug;
      Writeln('Frt''s Rimmington Miner');
      Writeln('Ran for ' + TimeRunning);
      Writeln('');
      for i := 0 to High(Players) do
      begin
        Writeln(Players[i].Nick + ': ' + IntToStr(Players[i].Integers[1]) +
                ' loads | ' + IntToStr(Players[i].Integers[2]) + ' ' + WhatMining(i) + ' ores mined | ' +
                FloatToStr(CalcXp(Players[i].Integers[2], i)) + ' xp gained.');
      end;
    end;

    // Credit: Bam Bam for helping :)
    procedure TheNext;
    var
      Status: Boolean;
    begin
      Status := LoggedIn;
      Logout;
      W(SleepTime * 60 * 1000);
      if (Players[CurrentPlayer].Integers[1] >= MaxLoads) then
        Status := False;
      NextPlayer(Status);
      Loads := 0;
      Proggie;
    end;

    procedure Setup;
    begin
      SmartSetupEx(121, False, True, False);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      SetupMining;
      DeclarePlayers;
      SetupFrtAntiBan;
      ActivateClient;
      LoginPlayer;
      ClearDebug;
      Proggie;
    end;

    begin
    Setup;
    repeat
      DTMSetup('Miningstone', TheOre);
      SetAngle(True);
      MakeCompass('n');
      while (Loads < Players[CurrentPlayer].Integers[0]) do
      begin
        GetMiningLvl(Players[CurrentPlayer].Integers[3]);
        WalkToMine;
        Miner;
        WalkToShop;
        Seller;
      end;
      TheNext;
    until AllPlayersInactive;
    end.

  12. #12
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    I'm not sure what impact this would have on your script, but you have Players[0].Integers[0] listed instead of Players[1].Integers[0] and Players[2].Integers[0]

  13. #13
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    try this

    Code:
    rogram RimmingtonMiner;
    {.include SRL/SRL/Misc/Smart.Scar}
    {.include SRL/SRL.Scar}
    {.include SRL/SRL/Skill/Mining.Scar}
    {.include FrtAntiBan.Scar}
    
    const
      SleepTime = 3;
      MaxLoads = 200;
    
    var
      x, y, TheFS: Integer;
      TheOre, Loads: Integer;
    
    function Counter: Integer; forward;
    procedure Proggie; forward;
    procedure GetMiningLvl(var Return: Integer); forward;
    
    procedure W(Timer: Integer);
    begin
      Wait(Timer + Random(500));
    end;
    
    function FS(Times: Integer): Boolean;
    begin
      if (TheFS >= Times) then
      begin
        TheFS := 0;
        Result := True;
      end;
      Inc(TheFS);
    end;
    
    procedure Reset;
    begin
      TheFS := 0;
    end;
    
    procedure DeclarePlayers;
    begin
      Skills := ['Mining', 'Smithing', 'Hitpoints', 'Fishing', 'Cooking']; // Maximum is 5
      HowManyPlayers := 3;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name       := '';
      Players[0].Pass       := '';
      Players[0].Nick       := '';
      Players[0].Active     := True;   // Active
      Players[0].Integers[0] := 5;     // Loads to do before switching
      Players[0].Strings[0] := 'Iron'; // Copper, Tin, Iron, Gold, Auto
    
      Players[1].Name       := '';
      Players[1].Pass       := '';
      Players[1].Nick       := '';
      Players[1].Active     := True;   // Use this account?
      Players[0].Integers[0] := 5;     // Loads to do before switching
      Players[1].Strings[0] := 'Iron'; // Copper, Tin, Iron, Gold
    
      Players[2].Name       := '';
      Players[2].Pass       := '';
      Players[2].Nick       := '';
      Players[2].Active     := True;      // Use this account?
      Players[0].Integers[0] := 5;       // Loads to do before switching
      Players[2].Strings[0] := 'Iron'; // Copper, Tin, Iron, Gold
    end;
    
    function ContinueScript: Boolean;
    begin
      if FindPickHeadColor and LoggedIn then
        Result := true;
    end;
    
    function InShop: Boolean;
    begin
      if FindObj(x, y, 'adder', 2510699, 5) then
        Result := (Distance(MSCX, MSCY, x, y) < 100);
    end;
    
    function ReturnMineDTM(Str: String): Integer;
    begin
      case Lowercase(Str) of
        'tin': Result := DTMFromString('78DA630C606260886100032608C510EBC6C39' +
           '002A41981F83F10307A0365222072CC503561B1BE0CFC503520C0' +
           '08322788801A3FA01A2F026AA2806A62F1AB0100768B0CAE');
        'iron': Result := DTMFromString('78DA632C60626048644001B16E3C0C29409A1' +
           '188FF03016321508D2FAA9AB0585F0656A81A1060CC06AA8921A0' +
           'A61AA82689809A7AA01A5B089B192AD61AAE8AA20600B43E0D2B');
        'copper': Result := DTMFromString('78DA63AC616260F06700032608C5501DC3CF9' +
           '002A41981F83F1030160065BC51D5F8258633B042D58000633950' +
           '2610554D6DB43EAA9A7AA08C1B7E35000BDC0B95');
        'gold': Result := DTMFromString('78DA63CC646260886200034608C510E9CCCD9' +
           '002E5FF070246909A00881C13544D58AC2F032B921EC602A04C18' +
           '0135F940191F54353ED622286A00DB340AC6');
      end;
    end;
    
    function ReturnOreDTM(Str: String): Integer;
    begin
      case Lowercase(Str) of
        'tin': Result := DTMFromString('78DA63CC606260E0656440058C482490CE01A' +
           'A6122A0A618A8E60F037E35594035BF09A88907AA612560571C50' +
           '8D202361BBC408A82903AA1120420D170135D584C30700A08206C' +
           '8');
        'iron': Result := DTMFromString('78DA63CC66626078C18006189148209D05547' +
           '39D809A78A09A8704D4C402D5BC26A0261DA8E61301356540356F' +
           '08A8A902AA7944404D0950CD1D026A0A806A6EE057030032C30BF' +
           '9');
        'copper': Result := DTMFromString('78DA63DCC7C4C0C0C5C8800A189148207D0CA' +
           '8E60F037E3527806A980998731AA8868F08BB0409A801B9598C80' +
           '9A4D4498B311A88693809A6D40354C04D45C00AA61C1AF0600833' +
           'D091E');
        'gold': Result := DTMFromString('78DA63B4636260E0656440058C4824907603A' +
           'AF9C3805F8D0350CD6F026ACC816A9808D8650C54C34F408D3D50' +
           '8D180135EE44F8CB0BA84690801A3FA01A4E026A02816A1889B08' +
           'B01BF1A006A89057B');
      end;
    end;
    
    procedure DTMSetup(What: String; var Return: Integer);
    var
      Temp: String;
      Skill: Integer;
    begin
      Temp := Lowercase(Players[CurrentPlayer].Strings[0]);
      if GameTab(4) then
      begin
        GetMiningLvl(Skill);
        if (Temp = 'auto') then
        begin
          case Skill of
            0..20:
              begin
                case Random(2) of
                  0: Temp := 'copper';
                  1: Temp := 'tin';
                end;
              end;
            21..45: Temp := 'iron';
            46..99: Temp := 'gold';
          end;
        end;
      end else
      begin
        if (Temp = 'auto') then
        begin
          case Random(2) of
            0: Temp := 'copper';
            1: Temp := 'tin';
          end;
        end;
      end;
      // OreDTM
      case Lowercase(What) of
        'oredtm': Return := ReturnOreDTM(Temp);
        'minedtm': Return := ReturnMineDTM(Temp);
        'miningstone':
          begin
            case Temp of
              'copper': Return := rimmington_copper;
              'tin': Return := rimmington_tin;
              'iron': Return := rimmington_iron;
              'gold': Return := rimmington_gold;
            end;
          end;
      end;
    end;
    
    procedure WalkToMine;
    var
      TempD: Integer;
    begin
      if not ContinueScript then Exit;
      // Walk To Shop
      SetRun(True);
      if FindSymbol(x, y, 'shop') then
      begin
        if (Distance(MMCX, MMCY, x, y) > 25) then
        begin
          Mouse(x + 10, y, 5, 5, True);
          FFlag(5);
        end;
      end;
      // Walk To Portal
      if FindSymbol(x, y, 'portal') then
      begin
        Mouse(x, y, 5, 5, True);
        FFlag(5);
      end;
      // Walk to Mining entrance
      RadialRoadWalk(FindRoadColor, 45, 90, 70, 2, 2);
      // Walk to Mining spot with failsafe walk
      while not FindSymbol(x, y, 'mining spot') do
      begin
        if FS(1) then Break;
        Mouse(MMCX + 50, MMCY - 40, 5, 5, True);
        FFlag(5);
      end;
      Reset;
      if FindSymbol(x, y, 'mining spot') then
      begin
        Mouse(x, y, 5, 5, True);
        FFlag(5);
      end;
      DTMSetup('MineDTM', TempD);
      if FindDTM(TempD, x, y, MMX1, MMY1, MMX2, MMY2) then
      begin
        Mouse(x, y, 3, 3, True);
        Flag;
      end;
      FreeDTM(TempD);
      W(1000);
    end;
    
    procedure WalkToShop;
    begin
      if not ContinueScript then Exit;
      // Updates loads and ores
      Inc(Players[CurrentPlayer].Integers[1]);
      Inc(Loads);
      Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] + Counter;
      // Walks to mining spot
      SetRun(True);
      if FindSymbol(x, y, 'mining spot') then
      begin
        Mouse(x, y, 5, 5, True);
        FFlag(5);
      end;
      // Walks to entrance with failsafe
      while not RadialRoadWalk(FindRoadColor, 160, 270, 70, 2, 2) do
      begin
        if FS(1) then Break;
        Mouse(MMCX - 20, MMCY + 60, 5, 5, True);
        FFlag(5);
      end;
      Reset;
      // Walks towards portal
      RadialRoadWalk(FindRoadColor, 230, 270, 60, 2, 2);
      // Walks to Portal
      if FindSymbol(x, y, 'portal') then
      begin
        if (Distance(MMCX, MMCY, x, y) > 25) and (MMCY < y - 20) then
        begin
          Mouse(x, y, 5, 5, True);
          FFlag(5);
        end;
      end;
      // Walks to shop
      while not InShop do
      begin
        if FS(5) then Break;
        if FindSymbol(x, y, 'shop') then
        begin
          Mouse(x + 5, y, 2, 2, True);
          FFlag(5);
        end;
      end;
      Reset;
    end;
    
    procedure Miner;
    var
      Inv, C: Integer;
    begin
      while not InvFull do
      begin
        Inv := InvCount;
        Inc(C);
        if (C > 75) then Break;
        if FindObjRock(x, y, TheOre) then
        begin
          case Random(4) of
            0..2: Mouse(x, y, 2, 2, True);
            3:
              begin
                Mouse(x, y, 2, 2, False);
                W(500);
                ChooseOption('ine');
              end;
          end;
          while (Inv = InvCount) do
          begin
            W(1000);
            case Random(5) of
              0: FrtAntiBan;
            end;
            if FS(25) then Break;
          end;
          Reset;
        end else
        begin
          W(2000);
          case Random(5) of
            0: FrtAntiBan;
          end;
        end;
      end;
    end;
    
    procedure Seller;
    var
      i, TempD: Integer;
      B: TBox;
    begin
      DTMSetup('OreDTM', TempD);
      if FindObj(x, y, 'hop', 5206412, 5) then
      begin
        Mouse(x, y, 3, 3, False);
        W(200);
        if ChooseOption('rade') then
        begin
          W(4000);
          for i := 1 to 28 do
          begin
            B := InvBox(i);
            if FindDTM(TempD, x, y, B.X1, B.Y1, B.X2, B.Y2) then
            begin
              MouseItem(i, False);
              ChooseOption('50');
              W(1000);
              Break;
            end;
          end;
        end;
        Mouse(485, 43, 3, 3, True);
      end;
      FreeDTM(TempD);
      Proggie;
    end;
    
    procedure GetMiningLvl(var Return: Integer);
    var
      Tempx: Integer;
    begin
      Tempx := GetCurrentTab;
      Return := GetSkillLevel('mining');
      GameTab(Tempx);
    end;
    
    function Counter: Integer;
    var
      i, TempD: Integer;
      B: TBox;
    begin
      DTMSetup('OreDTM', TempD);
      GameTab(4);
      for i := 1 to 28 do
      begin
        B := InvBox(i);
        if FindDTM(TempD, x, y, B.X1, B.Y1, B.X2, B.Y2) then
          Inc(Result);
      end;
      FreeDTM(TempD);
    end;
    
    function CalcXp(Ores, Player: Integer): Extended;
    var
      xp: Extended;
    begin
      case Lowercase(Players[Player].Strings[0]) of
        'tin': xp := 17.5;
        'copper': xp := 17.5;
        'iron': xp := 35;
        'gold': xp := 65;
      end;
      Result := xp * StrToFloat(IntToStr(Ores));
    end;
    
    function WhatMining(Play: Integer): String;
    begin
      if (Lowercase(Players[Play].Strings[0]) = 'auto') then
      begin
        case Players[Play].Integers[3] of
          0: Result := 'unknown';
          1..20: Result := 'copper/tin';
          21..45: Result := 'iron';
          46..99: Result := 'gold';
        end;
      end else
        Result := Players[Play].Strings[0];
    end;
    
    procedure Proggie;
    var
      i: Integer;
    begin
      ClearDebug;
      Writeln('Frt''s Rimmington Miner');
      Writeln('Ran for ' + TimeRunning);
      Writeln('');
      for i := 0 to High(Players) do
      begin
        Writeln(Players[i].Nick + ': ' + IntToStr(Players[i].Integers[1]) +
                ' loads | ' + IntToStr(Players[i].Integers[2]) + ' ' + WhatMining(i) + ' ores mined | ' +
                FloatToStr(CalcXp(Players[i].Integers[2], i)) + ' xp gained.');
      end;
    end;
    
    // Credit: Bam Bam for helping :)
    procedure TheNext;
    var
      Status: Boolean;
    begin
      Status := LoggedIn;
      Logout;
      W(SleepTime * 60 * 1000);
      if (Players[CurrentPlayer].Integers[1] >= MaxLoads) then
        Status := False;
      NextPlayer(Status);
      Loads := 0;
      Proggie;
    end;
    
    procedure Setup;
    begin
      SmartSetupEx(121, False, True, False);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      SetupMining;
      DeclarePlayers;
      SetupFrtAntiBan;
      ActivateClient;
      LoginPlayer;
      ClearDebug;
      Proggie;
    end;
    
    
    begin
    Setup;
    repeat
      DTMSetup('Miningstone', TheOre);
      SetAngle(True);
      MakeCompass('n');
      while (Loads < Players[CurrentPlayer].Integers[0]) do
      begin
        GetMiningLvl(Players[CurrentPlayer].Integers[3]);
        WalkToMine;
        Miner;
        WalkToShop;
        Seller;
      end;
      TheNext;
    until AllPlayersInactive;
      NextPlayer(Players[CurrentPlayer].Active);//u need to tell the script what to do next it doesnt auto switch
    end.

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
  •