Results 1 to 5 of 5

Thread: HerbCleaner!

  1. #1
    Join Date
    Nov 2011
    Location
    Louisiana
    Posts
    881
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default HerbCleaner!

    I am so proud that I was able to learn this and make this script! I've only been here a few weeks and have learned so much, and want to learn more. I borrowed and followed other players scripts to do some of my functions, and it's working quite well for me, but a shout out to the SRL developers as I've learned a lot and this script is based off of seeing others and learning from that. So how's this script?

    Also, a lot of players were requesting an Herb Cleaner, and while neeger made one, I've seen reports of bugs. For me, this script has worked flawlessly until it runs out of herbs. Then it doesn't know how to Logout, lol, but I'll put it in soon.


    Simba Code:
    program HerbCleaner;
    {$DEFINE SMART}
    {$i SRL/SRL.scar}

    var
    AntiBanCounter, MainAntiBanCounter: integer;
    RandomLevel: string;
    {
          Setup:
          -Have herbs in 1st bank slot
          -Have character in the bank
          -Fill in setup below and you're done!
    }

    Const
    HowManyCleaned = 1000; //How many herbs do you have to clean?
    WhichBank = ''; // Which bank are you in? vwb, veb, feb, fwb, etc. (All SRL banks supported)
    Member = true; // Are you a member? True (only member skill)
    LampSkillxp = 'Herblore'; // Where you want lamp experience?(from random)
    FrequencyOfAntiBan = 3; // How often do you want to perform antiban? after 1, 2, or 3 loads?

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1; // Total amount, multiple players not supported
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := ''; // Username
      Players[0].Pass := ''; // Password
      Players[0].Nick := ''; // 3-4 lowercase letters from username
      Players[0].Active := True; // Set to true if you want to use Player 0
      Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];

    end;

    {                   Setup complete. Click run and enjoy!

    }


    Procedure FreeAllDTMs;
    begin
      Writeln('Freed all DTMs');
    end;

    procedure StartSmart;
    begin
      Smart_Server := (155);   // Smart Server
      Smart_Members := (Member);
      Smart_Signed := True;
      Smart_SuperDetail := False;
    end;

    Procedure CheckLevel;
    begin
      writeln('Checking herblore level');
      Mouse(599, 189, 4, 4, true);
      MMouse(591, 337, 8, 8)
      wait(2000 + random (1000));
      GameTab(25); //inv
    end;

    Procedure MoveCompassRandom;
    begin
      writeln('moving compass');
      Case Random(4) of
      0: MakeCompass('N');
      1: MakeCompass('E');
      2: MakeCompass('S');
      3: MakeCompass('W');
      end;
    end;

    Procedure RandomLevelPicker;
    begin
      Case Random(15) of
      0: RandomLevel := 'mining';
      1: RandomLevel := 'attack';
      2: RandomLevel := 'defense';
      3: RandomLevel := 'strength';
      4: RandomLevel := 'range';
      5: RandomLevel := 'herblore';
      6: RandomLevel := 'magic';
      7: RandomLevel := 'runecrafting';
      8: RandomLevel := 'smithing';
      9: RandomLevel := 'fishing';
      10: RandomLevel := 'cooking';
      11: RandomLevel := 'crafting';
      12: RandomLevel := 'woodcutting';
      13: RandomLevel := 'firemaking';
      end;
    end;

    Procedure AntiBan;
    begin
       Writeln('Performing Anti-ban..');
       Case Random(7) of
       0: CheckLevel;
       1: MMouse(268, 172, 200, 200);
       2: MoveCompassRandom;
     end;
     Writeln('AntiBan Complete');
     AntiBanCounter := 0;
     MainAntiBanCounter := MainAntiBanCounter + 1;
    end;

    procedure AntiRandoms;    //   ---Calls Anti-randoms---
    begin
      if not LoggedIn then exit;
      FindNonInventoryRandoms;
      FindNormalRandoms;
      LampSkill := (LampSkillxp);
      LevelUp;
    end;

    procedure Clean;
    var
      Slots: TIntegerArray;
      i: integer;
    begin
      if not LoggedIn then Exit;
      Slots := [1, 2, 3, 4, 8, 7, 6, 5, 9, 10, 11, 12, 16, 15, 14, 13, 17, 18, 19,
                20, 24, 23, 22, 21, 25, 26, 27, 28];
      for i := 0 to 27 do
      begin
        if not ExistsItem(Slots[i]) then Continue;
        MouseItem(Slots[i], True);
        Inc(Players[CurrentPlayer].Integers[0]);
        Wait(450 + random(80));
        FindNormalRandoms;
      end;
    end;

    procedure WithdrawHerbs;//    ---Withdraws Herbs from open bank---
    var
      x, y: integer;
    begin
      if OpenBank(Players[CurrentPlayer].Loc, False, False) then
      begin
        MouseBox(45, 100, 60, 113, 3);
        if WaitUptext('rimy', 4000) then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, false);
          Wait(380 + random(50));
          ChooseOption('raw-All');
    end;
      end;
      CloseBank;
      Wait(750 + random(200));
    end;

    procedure WithdrawBank; //    ---Opens the bank to withdraw---
    var
      Tr, Bo: integer;

    begin
      if BankScreen = false then
      begin
        AntiRandoms;
        writeln('Trying to open bank..');
        MakeCompass('N');
        SetAngle(true);
        OpenBankFast(WhichBank);
      end;
      repeat
        wait(10);
        Tr := Tr +1;
      until (Tr = 1000) or (BankScreen = true);
      if BankScreen = True then
      begin
        Writeln('opened bank successfully');
        wait(1000 + random(1000));
        if BankScreen then
        begin
          Wait(200 + Random(300));
          FixBank;
          if (not(InvEmpty)) then
            DepositAll;
        end;
        ActivateClient;
        WithdrawHerbs;
      end else
      if BankScreen = False then
      begin
        Bo := Bo +1;
        writeln('Tried opening bank ' + IntToStr(Bo) + ' Times');
        if (Bo >= 5) then
        begin
          writeln('Opening bank failed, logging out.');
          //Logout;
          NextPlayer(false);
          FreeAllDTMs;
          TerminateScript;
        end;
      end;
      CloseBank;
    end;

    procedure SetupScript;
    begin
      SetupSRL;
      DeclarePlayers;
      StartSmart;
      ActivateClient;
      LoginPlayer;
    end;

    begin;
      SetupScript;
      repeat
        ActivateClient;
        WithdrawBank;
        Clean;
      until AllPlayersInactive;
      FreeAllDTMs;
    end.

  2. #2
    Join Date
    Oct 2011
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ill give it a test now and return with a progress report

  3. #3
    Join Date
    Nov 2011
    Location
    Louisiana
    Posts
    881
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Err-I don't have a Progress Report in there as of now. But it works, and does what it says if you set it up right. It'll just withdraw the herbs from that first bank slot and clean away.

  4. #4
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Hey, congratulations on your first script there bud! Looking good for sure. If I might throw some suggestions your way.

    First of which, SRL already has some really awesome anti-bans within the include, you just need to explore them. For example:

    You have this as an anti-ban: (From the looks of it, it hovers your Herblore skill and then back to the inventory)
    Simba Code:
    Procedure CheckLevel;
    begin
      writeln('Checking herblore level');
      Mouse(599, 189, 4, 4, true);
      MMouse(591, 337, 8, 8)
      wait(2000 + random (1000));
      GameTab(25); //inv
    end;

    Actually you don't need this at all, because luckily SRL has a procedure for hovering over a skill. Conveniently enough it's called "HoverSkill(SKILL STRING):" and it does the same thing, neat huh? So you can just delete your CheckLevel procedure completely and inside your Antiban procedure where you have "0: CheckLevel;" just replace that line with "HoverSkill('Herblore');". Easy peasy.

    Also, in your Clean procedure, I believe this:
    Simba Code:
    Slots := [1, 2, 3, 4, 8, 7, 6, 5, 9, 10, 11, 12, 16, 15, 14, 13, 17, 18, 19,
                20, 24, 23, 22, 21, 25, 26, 27, 28];
    Can be shortened to this:
    Simba Code:
    Slots := [1..28];

    The ".." indicates to include every number in between those to, so 2-27 are included via "..".

    One last thing I'd like to point out quick. For your herb withdrawing you have the script set to move the mouse to what looks like the first row/column, check the uptext, and withdraw all. Well believe it or not there's a procedure for this inside of "bank.scar". Check this out:
    Simba Code:
    function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;

    So... to withdraw your herbs at the first row & column you'd simple do this:
    Simba Code:
    WithdrawEx(1, 1, 0, ['rimy']);  //Setting 0 as the amount indicates to withdraw 'all'


    Apart from that your script is looking good! It really is great to see newcomers taking an interest and learning, as this is what the community is all about. Continue to explore the SRL include, look at all of the features that are already available, there's so much there you'd be surprised. Rep+

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  5. #5
    Join Date
    Dec 2011
    Posts
    193
    Mentioned
    5 Post(s)
    Quoted
    51 Post(s)

    Default

    Was using this earlier as I couldn't get any of the other herb scripts to clean properly.

    All started well till it got to the bank screen where it would hover over the first slot (where I placed my grimy herbs) for a few seconds, then it would close the bank and then repeat the process.

    Took a little look at the script and only thing I could see that might have been messing it up was:

    if WaitUptext('rimy', 4000) then

    So I took it out and it worked. But now it doesn't know when to stop withdrawing as it doesn't check if "rimy" is present. Which leads me to ask what's the point of declaring how many herbs I want to clean as a const?
    "HowManyCleaned" Makes no appearance after the initial declare.

    Sorry if it sounds like I'm trying to put you down, I'm actually just trying to learn so these are honest questions.

    Thanks for the script though, I was going to babysit it anyways, although I might try and fix it, I'll make that my first task.

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
  •