Dont loot more than 99 of an item

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
RooT
Posts: 12
Joined: Sun Aug 21, 2011 5:25 am

Dont loot more than 99 of an item

#1 Post 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.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Dont loot more than 99 of an item

#2 Post 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.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
RooT
Posts: 12
Joined: Sun Aug 21, 2011 5:25 am

Re: Dont loot more than 99 of an item

#3 Post 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.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Dont loot more than 99 of an item

#4 Post 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
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
RooT
Posts: 12
Joined: Sun Aug 21, 2011 5:25 am

Re: Dont loot more than 99 of an item

#5 Post by RooT »

WOW. Thank you. Works fine.
kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Dont loot more than 99 of an item

#6 Post 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
Scout/Knight/Rogue 70/66/66
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Dont loot more than 99 of an item

#7 Post 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
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Dont loot more than 99 of an item

#8 Post by kanta »

Thank you very much Lisa, once again you are a godsend :)
Scout/Knight/Rogue 70/66/66
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Dont loot more than 99 of an item

#9 Post 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
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Dont loot more than 99 of an item

#10 Post 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.
Scout/Knight/Rogue 70/66/66
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Dont loot more than 99 of an item

#11 Post 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")
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Dont loot more than 99 of an item

#12 Post by kanta »

Right, because the "" would make it a text string instead of a numerical value.
Scout/Knight/Rogue 70/66/66
Post Reply