SRL Archive - Research & Development Lounge

Ultimate Loot Grabber


bg5

2012-03-02 04:13:25

I see a lot of people have problems with collecting loots. I decided to make this tool letting you to pick up from ground whatever you want ,which you can use in your script and edit if you wish.
Basically I ripped off this function from my fighting script and adjusted to be universal.
  • easy and quick to SetUp
  • it's looking for stacks ,not for particular items
  • will grab items ,even if they are covered by another
  • code is clear ,you can edit it to your purpose if you wish.

Setup


All you need is to make function ,which will load properties of objects. Like this. I highly recommend to use ACA for finding colors and tolerance. It doesn't matter how you name this function. Remember to put SetLength ( Result , x ) at beginning ,where x is amount of items you declare.


function SetupLoots : Array of TLoot; // Example
begin
SetLength( Result, 3 ); // Second parameter here should be amount of items you want to find

Result[0].name := ['bone','ones','one'];
Result[0].color := 13948895;
Result[0].tol := 5;
Result[0].CTS := 2;
Result[0].cts2Hue := 0.76;
Result[0].cts2Sat := 1.22;

Result[1].name := ['egg','gg'];
Result[1].color := 65535;
Result[1].tol := 3;
Result[1].CTS := 1;
Result[1].cts2Hue := 0.1; // If you use CTS other then 2 just ignore this
Result[1].cts2Sat := 1.1;

Result[2].name := ['third','item']; // it's example
Result[2].color := 65535;
Result[2].tol := 7;
Result[2].CTS := 1;
Result[2].cts2Hue := 0.1;
Result[2].cts2Sat := 1.1;

end;
Now load this function into LootGrabber ,like this:

LootGrabber(SetupLoots,TRUE,['hicken','icken','aw','chick']);

as you see there are two additional parameters.
  • Debug - TRUE/FALSE - it's obvious
  • ['hicken','icken','aw','chick'] - ListOfUndesirable - TStringArray - it needs explanation:
You write here names of objects ,which could cover your potential loot. For example ,you want to collect bones ,but not raw chickens. Nevertheless bones are below chicken ,so if you hover mouse on stack uptext will show 'Raw chicken' - like on a picture. So you add chicken to the list ,and it will be ok - script will click on stack ,and take only bones from it. Obviously it will not find or clicks on a chickens alone.



Example Script


This simple script shows Grabber in action. First download grabber.simba and put it in Simba\Includes. Leave your character in Varock's hen house ,run script and see ,how it's collecting full inventory of bones.

program HenHouseBones;
{$DEFINE SMART}
{$I SRL/srl.simba}
{$i SRL/SRL/MISC/PAINTSMART.simba}
{$I grabber.simba}

function SetupLoots : Array of TLoot;
begin
SetLength(Result,1);
Result[0].name := ['one','ones'];
Result[0].color := 13948895;
Result[0].tol := 5;
Result[0].CTS := 2;
Result[0].cts2Hue := 0.76;
Result[0].cts2Sat := 1.22;
end;
procedure start;
begin
Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
end;
begin
start;
declareplayers;
MakeCompass('E');
repeat
LootGrabber(SetupLoots,TRUE,['cken','fea','ath']);
until not LootGrabber(SetupLoots,TRUE,['cken','fea','ath']);
end.

bg5

2012-03-02 04:14:38

Basic instruction

  1. Download Grabber.simba
  2. Put Grabber.simba inside Simba/Includes
  3. On the top of your script include it ,example:
  4. program new;
    {$define SMART}
    {$i srl/srl.simba}
    {$i Grabber.simba} // always include grabber after srl.simba
  5. In your script make function SetupLoots : Array of TLoot; and fill it properly. How to fill it read SETUP in post above.
  6. Now add grabing procedure to your MainLoop ,example

  7. procedure MainLoop;
    begin
    FightMonster; //your fighting procedure

    repeat // now repeat grabbing until don't find any more loots on ground
    LootGrabber(SetupLoots,TRUE,['cken','fea','ath']);
    until not LootGrabber(SetupLoots,TRUE,['cken','fea','ath']);

    {...}
    end;

bg5

2012-03-02 04:15:41

Update Log

  • fixed one bigger bug ,and SMART is clean after function

Shatterhand

2012-03-02 07:49:16

nice. :)

anth_

2012-03-02 07:53:28

Thanks, this will help me a lot :)

begginer

2012-03-10 06:59:24

 Result[0].cts2Hue := 0.76; // What's this for?
Result[0].cts2Sat := 1.22; // What's this for too?

Those are what I don;t understand. Check the code. It's written What's this for.

Anyway goodjob :)

bg5

2012-03-10 08:03:06

Result[0].cts2Hue := 0.76; // What's this for?
Result[0].cts2Sat := 1.22; // What's this for too?


There are for cts2 tolerance ,if you use other tolerance ,just ignore them.

Last Legend

2012-03-10 16:18:11

Thanks for the useful post, been trying to find something like this for a while :) My blue dragon killer will now loot! :D
Cheers
Anubis

Kyle Undefined

2012-03-10 16:31:43

You can clean up the code by doing:


with Result[0] do
// settings here
end;

That will make it easier to add/update things in the future, and make it easier to read.

hobofight101

2012-03-10 22:04:01

ima try this out tomorrow :)

Er1k

2012-03-10 22:07:40

From: Kyle Undefined
You can clean up the code by doing:


with Result[0] do
// settings here
end;

That will make it easier to add/update things in the future, and make it easier to read.


I would write function similar to a constructor :)


AddLoot({settings in one line});
Either way should be nice

bg5

2012-03-22 01:00:51

From: Kyle Undefined
You can clean up the code by doing:


with Result[0] do
// settings here
end;

That will make it easier to add/update things in the future, and make it easier to read.


You can make this function in the way you wish :) I had few ideas how to load data ,but I decided to use the simplest syntax as example ,to make it easier to understand for ppl with basic knowladge. It's only data loader ,technically it's not even part of the include. You can use for it other function or even several functions ,as long as you at the end put array of TLoot into main grabber function.

sfs

2012-05-15 16:03:05

Thank you! My item looter will now loot items – which I believe goes without saying is a crucial part of my script. Thanks for this, it helped so much.

Would you know if there's a way to only search a specific area for a stationary, respawning item (instead of the whole screen)? Right now it's detecting a bunch of trees. It still gets the item though. :D

cause

2012-05-16 13:09:21

Very handy, thanks for this.

xtrapsp

2012-05-16 16:19:55

THis is pretty genius, just thinking if. We use mmtiles (cant remember it's name) for wildy and add a boundary we could make a wildy looter :3 just sayin

bg5

2014-01-17 13:08:10

From: xtrapsp
THis is pretty genius, just thinking if. We use mmtiles (cant remember it's name) for wildy and add a boundary we could make a wildy looter :3 just sayin


I've made wildy looter once using MMtiles and canny core (because all items have different colors), but there was 2 problems: first - it's not possible to distinguish between players and loots, because how to tell script which object is what?
Secondly MMtiles was precise only at close distance, because MMtiles can't include such parameter as altitude of ground.

To fix the first problem I've made algoryth:
Get MS tile from MM -> Extract all objects on this tile from background using cannycore -> iterate throught each object by pressing right mouse button (it can't be based on uptext because player's name is showed over item) and finding item on list.

This procedure makes script quite slow, normal players can grab loot faster, not even mentioning reflection bots. So, as you see, color-based wildy looter isn't a good idea.

General_Patrick

2015-03-12 13:41:50

Thanks for posting this! I always wanted to include a looter for a hill giant/moss giant bot i am planning to make, but I did not know how the proper code to do it. I will hopefully get this to work one day. :)

General_Patrick

2015-03-12 16:59:13

From: alkorith
Thanks for posting this! I always wanted to include a looter for a hill giant/moss giant bot i am planning to make, but I did not know how the proper code to do it. I will hopefully get this to work one day. :)


When i was trying to implement the looter to try and test out to get it to pick up big bones, this error popped up before the script even executed

Error: Unknown declaration "IsMoving" at line 38

3Garrett3

2015-03-12 17:05:37

From: alkorith
When i was trying to implement the looter to try and test out to get it to pick up big bones, this error popped up before the script even executed

Error: Unknown declaration "IsMoving" at line 38


Have you considered that this snippet is from 3 years ago? SRL has changed significantly since then and I doubt any code written 3 years ago will still compile.

Luckily @bg5; is still active here so maybe he can mention if it's an easy fix to make this work or not.

General_Patrick

2015-03-12 17:12:50

From: 3Garrett3
Have you considered that this snippet is from 3 years ago? SRL has changed significantly since then and I doubt any code written 3 years ago will still compile.

Luckily @bg5; is still active here so maybe he can mention if it's an easy fix to make this work or not.


Thanks for the info.

bg5

2015-03-14 01:51:36

Loot Grabber was created for old SRL. I'm currently working on the new version, because I've got few requests, but since that time Runescape has changed a lot and SRL even more. I've already rewritten include to Lape, which was an easy part, but now I'm struggling with SRL-6 equivalents of old methods. I haven't played RS for few years and I'm not familiar with it anymore, so my progress is very slow.

I would need some help from someone who knows Runescape and knows SRL-6.

Thomas

2015-03-14 04:20:54

Will help allot of ppl with the bonsai fighter :) i've seen so many Posts about it there..

bg5

2015-03-17 14:53:03

Beta version of new [SRL-6]Grabber is done. :spongebob:

Now I'm looking for testers! Preferably junior+ members with at least intermediate experience in botting and scripting. Please PM if you are interested.

Thomas

2015-03-21 09:00:19

Feel free to send me the grabber, might be usefull for me. Got a few members accounts I can train some combat on.