Results 1 to 14 of 14

Thread: Basic Looter Implementation

  1. #1
    Join Date
    Aug 2013
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default Basic Looter Implementation

    Hello:

    I have been recently trying to use Bonsai's Basic Fighter for combat experience, but I wanted to find a way to implement a looter to pick up big bones from the hill giants or moss giants. I was originally planning to use bg5's tutorial on the forums, but it is 3 years old and SRL has changed dramatically over time. If someone could help me out by providing a basic example of how to setup a looter, I would appreciate it.

  2. #2
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    I wrote a lot of proof-of-concept code for fighting scripts in this thread: https://villavu.com/forum/showthread.php?t=111254

    While there's nothing there that is explicitly geared towards the purpose of looting, there are routines to reliably determine the position (onscreen) of the monster you're fighting. This will give you the bounds of the fight - once you've got that, it's a simple matter of searching inside those bounds for the color of your loot pile (usually white unless your monster doesn't drop bones)
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  3. #3
    Join Date
    Aug 2013
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    I wrote a lot of proof-of-concept code for fighting scripts in this thread: https://villavu.com/forum/showthread.php?t=111254

    While there's nothing there that is explicitly geared towards the purpose of looting, there are routines to reliably determine the position (onscreen) of the monster you're fighting. This will give you the bounds of the fight - once you've got that, it's a simple matter of searching inside those bounds for the color of your loot pile (usually white unless your monster doesn't drop bones)
    Thanks!

  4. #4
    Join Date
    May 2012
    Location
    Chaaaaiir
    Posts
    376
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Has anyone made a looter system with this? Been finicking with it for awhile and some things are off on mine.

  5. #5
    Join Date
    Nov 2012
    Posts
    161
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    Has anyone made any progress with adding a loot function?

    I'm going to try to add one early next week when I get some time.

    My plan is to look in the text box for the notification that "a beam of light shines on one of your items"
    then search for the bone color
    then have a list of chooseoptions of valuable drops.

    I briefly tried finding the color of the loot beam but couldn't get it to work as it sort of changes depending on what item drops below it.

    any suggestions?

  6. #6
    Join Date
    Mar 2013
    Location
    Shaolin
    Posts
    863
    Mentioned
    24 Post(s)
    Quoted
    519 Post(s)

    Default

    keepbotting had a really good suggestion with using the minimap point in relation to your player point (due to your fighter likely being right next to the target unless you are using range) and filtering the points for the one closest to the center of the minimap (your player point). If this is complicated you could also change the angle of your mainscreen to high and seach in a 3 square radius of your character for the color of big bones (my suggestion is using a tpa) although a loot function for rs3 will be difficult because of the loot options (you can have that popup will all nearby loot, no popup, etc) and then to implement this all into hoodzfighter may be even more difficult. I find it hard to modify other scripts because many coders have different styles. My style is more modular where you can basically cut and paste any of my procedures with little to no changes, but others have very interwoven functions that are hard to change to your liking and use a ton of functions within the script to get a result. Good luck man
    You have permission to steal anything I've ever made...

  7. #7
    Join Date
    Nov 2012
    Posts
    161
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by Wu-Tang Clan View Post
    keepbotting had a really good suggestion with using the minimap point in relation to your player point (due to your fighter likely being right next to the target unless you are using range) and filtering the points for the one closest to the center of the minimap (your player point). If this is complicated you could also change the angle of your mainscreen to high and seach in a 3 square radius of your character for the color of big bones (my suggestion is using a tpa) although a loot function for rs3 will be difficult because of the loot options (you can have that popup will all nearby loot, no popup, etc) and then to implement this all into hoodzfighter may be even more difficult. I find it hard to modify other scripts because many coders have different styles. My style is more modular where you can basically cut and paste any of my procedures with little to no changes, but others have very interwoven functions that are hard to change to your liking and use a ton of functions within the script to get a result. Good luck man
    So I was messing around with it last night (using Basic Fighter bc bonsai fighter i cannot figure out) but basically I added a small wait time after the kill (like 250-500 ms) so it waits for death and the drop will show (there is a small delay and dying time). Then just made an spiral tolerance atpa based on the loot beam, and if it dropped the same item (ex. mith gauntlets) which is what I based my color on, it would click the loot, open up loot screen, click the first loot location and then close out of lootscreen. But the problem arose when a ruby dropped under the loot beam and I think the loot beam is semi transparent and takes into account the color underneath. I'll have to do more testing. I don't want it to loot every drop, just the drops above the preset loot limit (i.e. 1k, 3k, 10k). would a DTM of the loot beam be more accurate and less subject to small color differences?

    I'll keep messing with it.

  8. #8
    Join Date
    Mar 2013
    Location
    Shaolin
    Posts
    863
    Mentioned
    24 Post(s)
    Quoted
    519 Post(s)

    Default

    Quote Originally Posted by nkd2009 View Post
    So I was messing around with it last night (using Basic Fighter bc bonsai fighter i cannot figure out) but basically I added a small wait time after the kill (like 250-500 ms) so it waits for death and the drop will show (there is a small delay and dying time). Then just made an spiral tolerance atpa based on the loot beam, and if it dropped the same item (ex. mith gauntlets) which is what I based my color on, it would click the loot, open up loot screen, click the first loot location and then close out of lootscreen. But the problem arose when a ruby dropped under the loot beam and I think the loot beam is semi transparent and takes into account the color underneath. I'll have to do more testing. I don't want it to loot every drop, just the drops above the preset loot limit (i.e. 1k, 3k, 10k). would a DTM of the loot beam be more accurate and less subject to small color differences?

    I'll keep messing with it.
    I'm not very familiar with loot beams I don't do much combat. But a dtm is better suited for static objects with static backgrounds such as an item in the inventory or bankscreen I'm not confident in a dtm for a mainscreen object returning good results.
    You have permission to steal anything I've ever made...

  9. #9
    Join Date
    Nov 2012
    Posts
    161
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by Wu-Tang Clan View Post
    I'm not very familiar with loot beams I don't do much combat. But a dtm is better suited for static objects with static backgrounds such as an item in the inventory or bankscreen I'm not confident in a dtm for a mainscreen object returning good results.
    Got it working! I only tried it on 1 floor color but it would be easily customizable for more situations with a simple color picker. So right now, it opens up the loot screen if there is a valuable item there, and takes the first item in the list (blindly) as I think the most valuable drop always appears first? (I hope). Then I guess the next logical step is to add a DTM for bones in the loot screen (big bones/ dbones?)

    So what I have is before it looks for a fight, it quickly checks the mainscreen using a spiraltolerance atpa and then left clicks on it to open up the lootscreen. It just loots slot 1 and then closes. I'll try it in more situations (floor colorings) and let you know how it goes. It's not super dynamic for everyone to use but I think if you can pick a color it can work. If you'd like to see it i'd be happy to send you the code (pretty much just ripped the mayors atpa section out of his AIO tutorial =) thanks @themayor! and added loot lines (out of the mayors other tutorial).

  10. #10
    Join Date
    Mar 2013
    Location
    Shaolin
    Posts
    863
    Mentioned
    24 Post(s)
    Quoted
    519 Post(s)

    Default

    Quote Originally Posted by nkd2009 View Post
    Got it working! I only tried it on 1 floor color but it would be easily customizable for more situations with a simple color picker. So right now, it opens up the loot screen if there is a valuable item there, and takes the first item in the list (blindly) as I think the most valuable drop always appears first? (I hope). Then I guess the next logical step is to add a DTM for bones in the loot screen (big bones/ dbones?)

    So what I have is before it looks for a fight, it quickly checks the mainscreen using a spiraltolerance atpa and then left clicks on it to open up the lootscreen. It just loots slot 1 and then closes. I'll try it in more situations (floor colorings) and let you know how it goes. It's not super dynamic for everyone to use but I think if you can pick a color it can work. If you'd like to see it i'd be happy to send you the code (pretty much just ripped the mayors atpa section out of his AIO tutorial =) thanks @themayor! and added loot lines (out of the mayors other tutorial).
    I'm a pretty heavy user of ismouseovertext. if your loot interface popup is always in the same place you could set a mousecoord (or array of boxes to mouse through lets say the first 3 loot slots) to see what item it is
    something I generally use might look like
    Simba Code:
    mousecircle(747,540,5, MOUSE_MOVE);
       if isMouseOverText(['Raw shrimp','Raw anchovies','Big bones','Bandos Godsword'],500) then
          begin
             writeLn('Found raw shrimp');
             foundShrimp := True;
             //Insert action here (drop,click,etc..)
             mousecircle(Next,Slot,5, MOUSE_MOVE); //Tbox would be best but you get the gist of it
          end;
    This is just a general example that would be a small step above blindly clicking a slot in the loot box because if there is nothing there, my example won't do anything because the "if" statement requires proper uptext.

    EDIT: if you like the array idea this is something i ripped the above example out of

    Simba Code:
    var
    s: integer;

    if (foundShrimp = False) then
        begin
          for S := 2 to 27 do //Will go through slots 2 - 27 in the inventory but this only modifies the variable "S"
            begin
              if tabBackpack.isItemInSlot(S) then // This will stop the array early if there is nothing in the slot
              // Lets say you had 11 items in the inventory and you have moused through 10 of them, this ^ would make sure you don't mouse through empty slots
                begin
                  tabBackpack.mouseSlot((S), MOUSE_MOVE); // This is what makes the array mouse through the slots, because I use variable "s" here
                  wait(250+random(250));
                    if isMouseOverText(['Raw shrimp'],500) then
                      begin
                        shrimpSlot := S;
                        writeLn('There is raw shrimp in slot: ' + intToStr(S) + ' saving slot number for BurnAndCook');
                        foundShrimp := True;
                        mousecircle(747,540,5, MOUSE_LEFT);
                        break; //If the shrimp have been found, the array is finished and we will no longer mouse through the slots
                      end;
                end;
            end;
        end;
    This may look a little complicated because it is out of context but I hope it helps for reference
    You have permission to steal anything I've ever made...

  11. #11
    Join Date
    Nov 2012
    Posts
    161
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by Wu-Tang Clan View Post
    I'm a pretty heavy user of ismouseovertext. if your loot interface popup is always in the same place you could set a mousecoord (or array of boxes to mouse through lets say the first 3 loot slots) to see what item it is
    something I generally use might look like
    Simba Code:
    mousecircle(747,540,5, MOUSE_MOVE);
       if isMouseOverText(['Raw shrimp','Raw anchovies','Big bones','Bandos Godsword'],500) then
          begin
             writeLn('Found raw shrimp');
             foundShrimp := True;
             //Insert action here (drop,click,etc..)
             mousecircle(Next,Slot,5, MOUSE_MOVE); //Tbox would be best but you get the gist of it
          end;
    This is just a general example that would be a small step above blindly clicking a slot in the loot box because if there is nothing there, my example won't do anything because the "if" statement requires proper uptext.

    EDIT: if you like the array idea this is something i ripped the above example out of

    Simba Code:
    var
    s: integer;

    if (foundShrimp = False) then
        begin
          for S := 2 to 27 do //Will go through slots 2 - 27 in the inventory but this only modifies the variable "S"
            begin
              if tabBackpack.isItemInSlot(S) then // This will stop the array early if there is nothing in the slot
              // Lets say you had 11 items in the inventory and you have moused through 10 of them, this ^ would make sure you don't mouse through empty slots
                begin
                  tabBackpack.mouseSlot((S), MOUSE_MOVE); // This is what makes the array mouse through the slots, because I use variable "s" here
                  wait(250+random(250));
                    if isMouseOverText(['Raw shrimp'],500) then
                      begin
                        shrimpSlot := S;
                        writeLn('There is raw shrimp in slot: ' + intToStr(S) + ' saving slot number for BurnAndCook');
                        foundShrimp := True;
                        mousecircle(747,540,5, MOUSE_LEFT);
                        break; //If the shrimp have been found, the array is finished and we will no longer mouse through the slots
                      end;
                end;
            end;
        end;
    This may look a little complicated because it is out of context but I hope it helps for reference
    For the chooseoption version, would you use:
    if lootscreen.isItemInSlot(1) then
    mouse move
    if mouseover text ('anchovie')
    mouse_left
    ?

    In the lootscreen section of SRL 6 theres a function that returns a tboxarray of all lootscreen slot boxes. I'm pretty good at using the example (i.e. if lootscreen.isiteminslot(1) then do something) but how would I use the tbox array of all slot boxes. the function is:
    function TRSLootScreen.getSlotBoxes(): TboxArray;
    with the example "boxArr := lootScreen.getSlotBoxes();
    what I'm getting at is that even after reading the tutorials, I understand how to use a premade function in a procedure but when just given a function like this I don't know how to use it.

    What I'm thinking about using is the lootDTM function from SRL 6.
    code:
    if (lootscreen.lootDTMs([BonesDTM, CopperDTM])) then
    MOUSE_LEFT;

    Thoughts on using the lootDTM? For one, I know how to use it, and secondly, I think it will be faster than mousing over looking for uptext? right?
    Also, are you able to understand my confusion on how to use the code blocks given in the SRL 6 documentation?

  12. #12
    Join Date
    Mar 2013
    Location
    Shaolin
    Posts
    863
    Mentioned
    24 Post(s)
    Quoted
    519 Post(s)

    Default

    Quote Originally Posted by nkd2009 View Post
    For the chooseoption version, would you use:
    if lootscreen.isItemInSlot(1) then
    mouse move
    if mouseover text ('anchovie')
    mouse_left
    ?

    In the lootscreen section of SRL 6 theres a function that returns a tboxarray of all lootscreen slot boxes. I'm pretty good at using the example (i.e. if lootscreen.isiteminslot(1) then do something) but how would I use the tbox array of all slot boxes. the function is:
    function TRSLootScreen.getSlotBoxes(): TboxArray;
    with the example "boxArr := lootScreen.getSlotBoxes();
    what I'm getting at is that even after reading the tutorials, I understand how to use a premade function in a procedure but when just given a function like this I don't know how to use it.

    What I'm thinking about using is the lootDTM function from SRL 6.
    code:
    if (lootscreen.lootDTMs([BonesDTM, CopperDTM])) then
    MOUSE_LEFT;

    Thoughts on using the lootDTM? For one, I know how to use it, and secondly, I think it will be faster than mousing over looking for uptext? right?
    Also, are you able to understand my confusion on how to use the code blocks given in the SRL 6 documentation?
    If you want to use an array of the boxes you could use a repeat loop like this

    Simba Code:
    begin
    repeat
       Count := bankscreen.getPackCount();
       Slot := bankscreen.getPackSlotBox((Count));

    mouse(slot,mouse_move); //This will move to the last slot of the inventory and hover over so we can get uptext
    if (ismouseovertext('kasldkfasf') then
    begin
       dothings;
       dootherthings;
    end;

    if not (ismouseovertext('kasldkfasf') then
    begin
       Slot := bankscreen.getPackSlotBox((Count - 1)); // This changes the slot variable to 1 less than the current inventory count
       mouse(slot,mouse_move); // This moves the mouse to the modified value of "slot" (1 less than inventory count)
       dothings;
       dootherthings;
    end;
    until (conditionhere);
    end;

    or basically plug the same method into the array example I gave before. I use the repeat loop because I feel its easier to understand and work with, but an array may work for you just as well
    You have permission to steal anything I've ever made...

  13. #13
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by nkd2009 View Post
    For the chooseoption version, would you use:
    if lootscreen.isItemInSlot(1) then
    mouse move
    if mouseover text ('anchovie')
    mouse_left
    ?

    In the lootscreen section of SRL 6 theres a function that returns a tboxarray of all lootscreen slot boxes. I'm pretty good at using the example (i.e. if lootscreen.isiteminslot(1) then do something) but how would I use the tbox array of all slot boxes. the function is:
    function TRSLootScreen.getSlotBoxes(): TboxArray;
    with the example "boxArr := lootScreen.getSlotBoxes();
    what I'm getting at is that even after reading the tutorials, I understand how to use a premade function in a procedure but when just given a function like this I don't know how to use it.

    What I'm thinking about using is the lootDTM function from SRL 6.
    code:
    if (lootscreen.lootDTMs([BonesDTM, CopperDTM])) then
    MOUSE_LEFT;

    Thoughts on using the lootDTM? For one, I know how to use it, and secondly, I think it will be faster than mousing over looking for uptext? right?
    Also, are you able to understand my confusion on how to use the code blocks given in the SRL 6 documentation?
    If you wanted to use DTMs you could use something like this (I've just expanded Mayor's tutorial code):

    Simba Code:
    program new;
    {$I SRL-6/SRL.simba}

    var
      BonesDTM, FishDTM: Integer;

    procedure LoadDTMs();
    begin
      BonesDTM := DTMFromString('abcdefg'); // Obviously you need a real DTM string
      FishDTM := DTMFromString('abcdefg');
    end;

    procedure FreeTheDTMs();
    begin
      FreeDTMs([BonesDTM, FishDTM]);
    end;

    procedure LootStuff();
    begin
      if mainScreen.findObject(.....) then //Your findColor code you already have
        if lootScreen.isOpen(5000) then
        begin
          lootScreen.lootDTMs([BonesDTM, FishDTM]); // You can add as many as you want
          writeLn('We looted ALL the bones and fish');
          lootScreen.close();
        end;

    end;

    begin
      LoadDTMs(); // Load the DTMs into memory on startup

      AddOnTerminate('FreeTheDTMs'); // Automatically remove the DTMs from memory
                                     // when script terminates.
      LootStuff();
    end.

  14. #14
    Join Date
    Nov 2012
    Posts
    161
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by Laquisha View Post
    If you wanted to use DTMs you could use something like this (I've just expanded Mayor's tutorial code):

    Simba Code:
    program new;
    {$I SRL-6/SRL.simba}

    var
      BonesDTM, FishDTM: Integer;

    procedure LoadDTMs();
    begin
      BonesDTM := DTMFromString('abcdefg'); // Obviously you need a real DTM string
      FishDTM := DTMFromString('abcdefg');
    end;

    procedure FreeTheDTMs();
    begin
      FreeDTMs([BonesDTM, FishDTM]);
    end;

    procedure LootStuff();
    begin
      if mainScreen.findObject(.....) then //Your findColor code you already have
        if lootScreen.isOpen(5000) then
        begin
          lootScreen.lootDTMs([BonesDTM, FishDTM]); // You can add as many as you want
          writeLn('We looted ALL the bones and fish');
          lootScreen.close();
        end;

    end;

    begin
      LoadDTMs(); // Load the DTMs into memory on startup

      AddOnTerminate('FreeTheDTMs'); // Automatically remove the DTMs from memory
                                     // when script terminates.
      LootStuff();
    end.
    Quote Originally Posted by Wu-Tang Clan View Post
    If you want to use an array of the boxes you could use a repeat loop like this

    Simba Code:
    begin
    repeat
       Count := bankscreen.getPackCount();
       Slot := bankscreen.getPackSlotBox((Count));

    mouse(slot,mouse_move); //This will move to the last slot of the inventory and hover over so we can get uptext
    if (ismouseovertext('kasldkfasf') then
    begin
       dothings;
       dootherthings;
    end;

    if not (ismouseovertext('kasldkfasf') then
    begin
       Slot := bankscreen.getPackSlotBox((Count - 1)); // This changes the slot variable to 1 less than the current inventory count
       mouse(slot,mouse_move); // This moves the mouse to the modified value of "slot" (1 less than inventory count)
       dothings;
       dootherthings;
    end;
    until (conditionhere);
    end;

    or basically plug the same method into the array example I gave before. I use the repeat loop because I feel its easier to understand and work with, but an array may work for you just as well
    This will make it super easy, thanks guys! Now I just need to find a good rs3 f2p monster that semi consistently drops good things to test it on. Any suggestions? Maybe the lesser demons in the wild? I need it to trigger the 1k limit.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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