AIO Looter
Description
This is my basic attempt at making a universal looter. I got really bored while visiting family overseas, so in those slow moments, I decided to get off my ass and try to write something which I thought would be a fun challenge and exercise in scripting! I'm actually not too sure if this is even the right place to put this thread because I honestly don't expect that this will ever be that powerful (and never will be as effective as ogLib), but I wanted to have a place where I could just post some updates maybe every once in a while to keep myself motivated.
I'm looking for feedback and suggestions! Any comments or constructive criticism will be greatly appreciated!
Features and Function List
Initializer
Simba Code:
procedure TLoot.init(_interface : boolean; _names : TStringArray; _exNames : TStringArray; _radius : integer = 10);
This is the heart of the looting object. The first parameter is if you will be using the looting interface, the second is a TStringArray that contains the list of objects that you want to loot, the third parameter is a TStringArray that contains the list of objects to excluded, and the fourth parameter is the radius of the biggest TBox that you can search (default is 10).
Example:
Simba Code:
loot.init(false, ['Coins', 'Water orb', 'Seaweed', 'Mithril Ore'], ['Water rune'], 10);
Issues: Planning to add a parameter that allows you to exclude certain loot, such as bones (because if the mouse over text is bones, then there must be no loot)
Minimap Red Dot Search
Simba Code:
function TLoot.mmCloseSearch() : boolean;
Description: Searches the minimap for the closest red dot and mouses over that point. If the one of the objects within the 'names' array is found, then it will return true. If the point exists on the minimap, but is not found in the mouse over, then the script will try to search for the loot within the search radius you've passed it.
Issues: Doesn't work if the dot on the minimap is being covered. Has trouble mousing over loot if another npc is in the way. Potential problem if you are using mage or ranged and the closest red dot on the minimap may not be the most recent loot. It actually messes up in the video one time.
Mainscreen Point Search
Simba Code:
function TLoot.msPointSearch(p : TPoint) : boolean;
Description: Searches a user granted point (on the mainscreen hopefully) for loot and will try to search for the loot within the search radius you've pass it.
Issues: Implemented, but not actually tested yet
Mainscreen Box Search
Simba Code:
function TLoot.msBoxSearch(box : TBox; initialStep : integer; clockwise : boolean = true ) : boolean;
or
Simba Code:
function TLoot.msBoxSearch(box : TBox) : boolean; overload;
//Default search method
Description: Searches a box on the mainscreen for loot, check out the spoiler for how it works.
There are two parameters for a box search. The first variable is the direction in which the map will move first whcih can be LOOT_RIGHT, LOOT_LEFT, LOOT_UP, or LOOT_DOWN. The second variable is whether or not to search clockwise or not (will search clockwise by default).
This is a picture of all the combinations, but the default loot direction (LOOT_RIGHT, clockwise) should be fine anyways. These are just options which are available for the user to decide. The procedure should also work for TBoxes which aren't squares. Look into the code to see how the points are calculated!
Issues: Only really searches four more points, and won't be very good with large boxes.
Pick Up Dat Loot
Simba Code:
function TLoot.pickLoot() : boolean;
Description: Can only be used if the loot position has been found and moused over. If useInterface is true, it will try to take the first object. If the looting interface is then open, the function exits and will allow the user to do the rest with lootscreen code.
If useInterface is set to false, it will pick up everything it can that is inside of your looting options. (I'm actually proud of this, take a look at how at how it works )
Issues: Implemented, but not fully tested yet. The time inbetween looting objects in a pile may need to be adjusted.
Setup and Example
Setup is very simple! Just download the one file, rename it to 'AIOLooter.simba' and place it in the folder /Simba/Includes/yourule97 (You'll need to make the 'yourule97' folder though)
Simba Code:
program LootTester;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i yourule97/AIOLooter.simba} //Very important this line is here!
begin
clearDebug();
smartPlugins := ['d3d9.dll'];
smartEnableDrawing := true;
smartShowConsole := false;
setupSRL();
loot.init(false, ['Raw beef', 'Cowhide'], ['Bones'], 20); //You must setup the loot object with your own values. See the features and functions list for more detail
if loot.mmCloseSearch() then loot.pickLoot();
end.
How to use in fighting scripts: This include is still in its infant stage so I don't really know how to answer this either. However, I know that in combat situations, the NPC you are currently fighting will always have a red circle around it. Scripts can detect this circle and pass it to the loot.msBoxSearch() function once the monster is dead. They can also hover over the monster while your character is fighting it and use msPointSearch() after passing it your mouse's current location. More information will follow sometimeTM
Credit and Thanks
- Citrus - Hijacked his minimap to mainscreen point conversion code
- SRL (in general) - Thank god it's open source so I can learn how to make my own includes and stuff.
DOWNLOAD HERE