Page 1 of 1
Dont loot more than 99 of an item
Posted: Fri Aug 26, 2011 9:27 am
by RooT
How can i say if the bot got 99 of an item then dont loot it again until its 98 or less?
Thanks for help.
Re: Dont loot more than 99 of an item
Posted: Fri Aug 26, 2011 10:59 am
by rock5
You can't tell the bot not to loot. It doesn't loot. It just attacks the dead mob and your lootfilter addon does the looting. All you could do is have a function that you could run occationally to drop the excess items.
Re: Dont loot more than 99 of an item
Posted: Fri Aug 26, 2011 11:20 am
by RooT
can you help me with the function?
I think i need commands like
RoMScript("PickupBagItem("..slotitem.BagId..")")
RoMScript("DeleteCursorItem()")
but i dont know how i find the bagid of the item i want to delete.
Re: Dont loot more than 99 of an item
Posted: Fri Aug 26, 2011 11:33 am
by rock5
Assuming that if you have more than 99 you will have a big stack and a small stack then
Code: Select all
SmallStack = inventory:findItem("item name")
will return the smallest stack. You can then drop it by doing.
SmallStack:delete()
So
Code: Select all
if inventory:itemTotalCount("item name") > 99 then
local SmallStack = inventory:findItem("item name")
SmallStack:delete()
end
Re: Dont loot more than 99 of an item
Posted: Fri Aug 26, 2011 2:48 pm
by RooT
WOW. Thank you. Works fine.
Re: Dont loot more than 99 of an item
Posted: Sat Aug 27, 2011 12:16 pm
by kanta
Hmmm... this has me thinking now... Would there be a way to make that look at an item table instead of ("item name")? Trying to think how to word this for it to make sense. Ok, say I want to add that function to my onleavecombat section. There are several things I would like it to check for such as the 10% phirius pots, mana and hp stones, amulets of light, etc. It would be much easier to add another item to a table (and much cleaner coding) if it would look at a table instead of making a new code block for each item.
Like having one instance of the code in my onleavecombat:
Code: Select all
if inventory:itemTotalCount(item_table) > 99 then
local SmallStack = inventory:findItem(item_table_entry)
SmallStack:delete()
end
and a table like
Code: Select all
item name/ID #1
item name/ID #2
item name/ID #3
Re: Dont loot more than 99 of an item
Posted: Sat Aug 27, 2011 8:14 pm
by lisa
create your table, for this example
Code: Select all
keptitems = {"Amulet of Light", "phitius pot", "some other item", "Something else", "blah blah"}
You can have that in onload or somewhere. Maybe even make a userfunction out of the entire thing. Anyway then to check use this
Code: Select all
for k,v in pairs(keptitems) do --looks into the table keptitems, v is the names you added. k is just the ordered number.
if inventory:itemTotalCount(v) > 99 then
local SmallStack = inventory:findItem(v)
SmallStack:delete()
end
end
Re: Dont loot more than 99 of an item
Posted: Sat Aug 27, 2011 10:06 pm
by kanta
Thank you very much Lisa, once again you are a godsend

Re: Dont loot more than 99 of an item
Posted: Sat Aug 27, 2011 10:25 pm
by rock5
The only problem with that is, if the goal is to keep only 1 stack, not all items have a stack size of 99. We would have to check the stack size. The inventory items have that value so to use it you would have to get it first before the check. Try
Code: Select all
for k,v in pairs(keptitems) do --looks into the table keptitems, v is the names you added. k is just the ordered number.
local SmallStack = inventory:findItem(v)
if SmallStack and inventory:itemTotalCount(v) > SmallStack.MaxStack then
SmallStack:delete()
end
end
Re: Dont loot more than 99 of an item
Posted: Sat Aug 27, 2011 11:32 pm
by kanta
lisa wrote:create your table, for this example
Code: Select all
keptitems = {"Amulet of Light", "phitius pot", "some other item", "Something else", "blah blah"}
One other question. Instead of using the item names, could I do something like
Code: Select all
keptitems = {itemID#1, itemID#2, itemID#3, itemID#4, itemID#5}
I sometimes have trouble with item names, I don't know why, so I try to use ID's as much as I can.
Re: Dont loot more than 99 of an item
Posted: Sat Aug 27, 2011 11:51 pm
by lisa
I don't see why not, I would try without the " " though.
So
Code: Select all
keptitems = {500544, 586755, 699776, 273737}
Would obviously need testing, I don't recall using numbers in a table before.
Reason I said not to use the " " is because when it goes to use it in
Code: Select all
local SmallStack = inventory:findItem(v)
you don't want
Code: Select all
local SmallStack = inventory:findItem("500544")
Re: Dont loot more than 99 of an item
Posted: Sun Aug 28, 2011 2:17 pm
by kanta
Right, because the "" would make it a text string instead of a numerical value.