Results 1 to 11 of 11

Thread: [Need Help] Herb Cleaner

  1. #1
    Join Date
    Dec 2006
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [Need Help] Herb Cleaner

    Hello all, this is my first attempt at an herb cleaning script and I am having an issue compiling.

    SCAR Code:
    program HerbCleaner;
    {$DEFINE SMART}
    {$i srl/srl.simba}

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
    end;

    Procedure CleanHerb;
      Var
        GKWuarm, SWChest, CKwuarm, x, y, c1: integer;


    Begin

        GKwuarm := DTMFromString('m1gAAAHic42JgYOABYnEgFgNiISDmZIAARiDmAmJ+qDiIzQSlBaGYF4jZoOqZoWw7Q2moSvxYhIE4wEgkRgAA8nsBmQ==');
        SWChest := DTMFromString('mggAAAHicY2NgYBACYnkgVgFiZgYI4AJiASibH4gVoOoYgTjYzZzh3NEjDGcOH2YoLchn6G5tZbh+7iyDHAN2wIgDQwAAIbALsw==');
        CKwuarm := DTMFromString('mwQAAAHic42RgYOAGYh4gFgNicSAWBGIOBghggbJ5oHxmIOYCYiEo5gNiNqg6A2uQSia8mImBMGAkAsMBALkzAVY=');

      If not InvFull Then
        Exit;
      If InvFull Then
      Begin
      c1 := 0
      Repeat
      If FindDTM(GKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, True);
        Wait(20+Random(35));
        c1 := c1+1;
      Until (c1=27);
      End;
    End;

    Procedure Bank;
    Begin
      MakeCompass('S');
      If FindDTM(SWChest, x, y, MSX1, MSY1, MSX2, MSY2) Then
        Mouse(x, y, 5, 5, True);
        Wait(1500+Random(250));
      If FindDTM(CKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, False);
        ChooseOption('All');
        Wait(250+Random(100));
      If FindDTM(GKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, False);
        ChooseOption('All');
    End;



    begin
      SetUpSRL;
      ActivateClient;
      DeclarePlayers;
      LoginPlayer;
      Repeat
      CleanHerb;
      Bank;
      Until (1=2);
    end.

    I am getting an error "Unknown identifier 'SWChest' at line 45" and I'm not quite sure why as I defined SWChest as a variable and my other two DTM variables don't seem to have the same issue. Any help would be much appreciated including tips/criticism!

  2. #2
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Its defined in the wrong scope. To fix it, i would suggest moving all your var declarations to global (just after your includes) and then defining SWChest in the bank function to make sure that it is defined before its used.

    But mainly as previously stated, it has the wrong scope.
    Simba Code:
    program HerbCleaner;
    {$DEFINE SMART}
    {$i srl/srl.simba}

      Var
        GKWuarm, SWChest, CKwuarm, x, y, c1: integer;
    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
    end;

    Procedure CleanHerb;
    Begin
      GKwuarm := DTMFromString('m1gAAAHic42JgYOABYnEgFgNiISDmZIAARiDmAmJ+qDiIzQSlBaGYF4jZoOqZoWw7Q2moSvxYhIE4wEgkRgAA8nsBmQ==');
      CKwuarm := DTMFromString('mwQAAAHic42RgYOAGYh4gFgNicSAWBGIOBghggbJ5oHxmIOYCYiEo5gNiNqg6A2uQSia8mImBMGAkAsMBALkzAVY=');

      If not InvFull Then
        Exit;
      If InvFull Then
      Begin
      c1 := 0
      Repeat
      If FindDTM(GKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, True);
        Wait(20+Random(35));
        c1 := c1+1;
      Until (c1=27);
      End;
    End;

    Procedure Bank;
    Begin
      SWChest := DTMFromString('mggAAAHicY2NgYBACYnkgVgFiZgYI4AJiASibH4gVoOoYgTjYzZzh3NEjDGcOH2YoLchn6G5tZbh+7iyDHAN2wIgDQwAAIbALsw==');
      MakeCompass('S');
      If FindDTM(SWChest, x, y, MSX1, MSY1, MSX2, MSY2) Then
        Mouse(x, y, 5, 5, True);
        Wait(1500+Random(250));
      If FindDTM(CKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, False);
        ChooseOption('All');
        Wait(250+Random(100));
      If FindDTM(GKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, False);
        ChooseOption('All');
    End;

    begin
      SetUpSRL;
      ActivateClient;
      DeclarePlayers;
      LoginPlayer;
      Repeat
      CleanHerb;
      Bank;
      Until (1=2);
    end.
    Last edited by Turpinator; 05-07-2012 at 01:34 AM.

  3. #3
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Orrr... you could also define your DTMs in the main program so you arent defining it over and over again.

    Also, there is a bank function built in for sw and bankers, so i would suggest using that.

    (ughh the edit failed. oops on the double post)


    And heres the SW bank function.
    Simba Code:
    OpenBankChest(SRL_BANK_SW);
    Make sure to SetAngle(SRL_ANGLE_HIGH) before hand though so it can find the chest.
    Last edited by Turpinator; 05-07-2012 at 01:33 AM.

  4. #4
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Have a look at what I changed I would do a more detailed response but I am tired and need to go to bed...

    Simba Code:
    program HerbCleaner;
    {$DEFINE SMART}
    {$i srl/srl.simba}

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
    end;

    Procedure CleanHerb;
      Var
        GKWuarm, x, y, c1: integer;


    Begin

        GKwuarm := DTMFromString('m1gAAAHic42JgYOABYnEgFgNiISDmZIAARiDmAmJ+qDiIzQSlBaGYF4jZoOqZoWw7Q2moSvxYhIE4wEgkRgAA8nsBmQ==');

      If not InvFull Then
        Exit;
      If InvFull Then
      Begin
      c1 := 0
      Repeat
      If FindDTM(GKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, True);
        Wait(20+Random(35));
        c1 := c1+1;
      Until (c1=27);
      End;
    End;

    Procedure Bank;
    Var
      GKwuarm, SWChest, CKwuarm, x, y : integer;     //You need to have these in every procedure you use them in :)
    Begin
      GKwuarm := DTMFromString('m1gAAAHic42JgYOABYnEgFgNiISDmZIAARiDmAmJ+qDiIzQSlBaGYF4jZoOqZoWw7Q2moSvxYhIE4wEgkRgAA8nsBmQ==');
      SWChest := DTMFromString('mggAAAHicY2NgYBACYnkgVgFiZgYI4AJiASibH4gVoOoYgTjYzZzh3NEjDGcOH2YoLchn6G5tZbh+7iyDHAN2wIgDQwAAIbALsw==');
      CKwuarm := DTMFromString('mwQAAAHic42RgYOAGYh4gFgNicSAWBGIOBghggbJ5oHxmIOYCYiEo5gNiNqg6A2uQSia8mImBMGAkAsMBALkzAVY=');
      MakeCompass('S');
      If FindDTM(SWChest, x, y, MSX1, MSY1, MSX2, MSY2) Then
        Mouse(x, y, 5, 5, True);
        Wait(1500+Random(250));
      If FindDTM(CKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, False);
        ChooseOption('All');
        Wait(250+Random(100));
      If FindDTM(GKwuarm, x, y, MIX1, MIY1, MIX2, MIY2) Then
        Mouse(x, y, 5, 5, False);
        ChooseOption('All');
    End;



    begin
      SetUpSRL;
      ActivateClient;
      DeclarePlayers;
      LoginPlayer;
      Repeat
      CleanHerb;
      Bank;
      Until (1=2);
    end.

  5. #5
    Join Date
    Dec 2006
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for the quick replies you guys! I moved the variable declarations to the beginning (as suggested by Turpinator) and it compiled with no errors I'll look into the SW bank function though as that seems much more specialized to what I'm trying to do. Does it have functions to click the deposit inventory button and such?

  6. #6
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Xerocide View Post
    Thanks for the quick replies you guys! I moved the variable declarations to the beginning (as suggested by Turpinator) and it compiled with no errors I'll look into the SW bank function though as that seems much more specialized to what I'm trying to do. Does it have functions to click the deposit inventory button and such?
    Simba Code:
    DepositAll;

    There ya go

  7. #7
    Join Date
    Feb 2012
    Posts
    61
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Like Turpinator said, using the built in bank function for the soul wars chest would make your life a million times easier.


  8. #8
    Join Date
    Dec 2006
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by GOOGLE View Post
    Simba Code:
    DepositAll;

    There ya go
    Thank you. I have a new issue though which is that my script is killing my already-running SMART windows/RS clients and restarting in the case of SMART or just doing nothing in the case of RS client. Trying to find how to prevent it by reading through Narcle's Fast Fighter but I'm not exactly sure what I'm looking for.

  9. #9
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    So Ive been playing around with this and well, (1) it cant seem to find the kwaurms in the bank, and (2) when it actually withdraws them, and cleans, it usually double clicks each one and will sometimes click backwards, causing it to only do about half the inventory.

    Heres the new bank function with the SW chest and deposit all.
    Simba Code:
    Procedure Bank;
    Begin
      repeat
        SetAngle(SRL_ANGLE_HIGH);
        OpenBankChest(SRL_BANK_SW);
      until BankScreen or PinScreen;
      if PinScreen then
      begin
        repeat
         InPin(Players[0].Pin);
        until BankScreen or not (LoggedIn);
      end;
      if BankScreen then
      begin
        DepositAll;
        Withdraw(0, 0, 28);
        CloseBank;
      end
    End;
    (1) is a simple fix, i just put it in slot 1 and and used Withdraw(0, 0, 28);

    For (2), Im still not sure as to the best way to approach this and still use the DTMs without adding a long wait in between each DTM search.

    Sidenote:
    I used
    Simba Code:
    {.include SRL/SRL/Misc/Smart.simba}
    {.include SRL/SRL.simba}
    for my includes and it works fine after adding
    Simba Code:
    Cleardebug;
    Smart_Server := 10;
    Smart_Members := false;
    Smart_Signed := false;
    Smart_SuperDetail := false;
    to the main portion.
    Last edited by Turpinator; 05-07-2012 at 06:02 AM.

  10. #10
    Join Date
    Dec 2006
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, putting in a long wait would sort of defeat the purpose because I'm going for speed but I know what you're talking about. It's because I had it loop 27 times and since it would likely click the same herb twice or go back to a previously cleaned herb it wouldn't finish the inventory. I never got the withdrawing to work properly though. I'm assuming it had to do with the method of withdrawing I was trying to use (find DTM, right click, findoption containing 'all') as I'm not sure if it would work as I had hoped. Is there a way to just click an inventory slot or should I just use coordinates in lieu of using DTM?

  11. #11
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    using
    Simba Code:
    Withdraw(0, 0, 28);
    will withdraw the item on screen at 0,0 and 28 of them. so that would be the first slot. (column, row,amount)
    The thing with stackable dtms like in a bank is that when you create them, you need to make sure you stay away from the upper left corner where the numbers show.

    I believe the best way to clean would just be to do a double loop with pseudo code similar to
    Code:
    for column = 0 until  > 3
       for row = 0 until > 6
          click(x+column*(distance between spaces), y+row*(distance between spaces))  //With random pixels ofc.
          wait(small adjustable random time)
       end
    end
    So if i wrote that correctly, it would clean vertically row by row with an adjustable speed. this way may not clean every single herb, but play with the speed till it works. you could still even implement your dtm search after the loops to make sure it got the whole inventory.
    Last edited by Turpinator; 05-07-2012 at 07:13 PM.

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
  •