item.ItemCount

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

item.ItemCount

#1 Post by Romplayer »

How do i use this to get the # of items? I keep getting a nil when i update "item:update(id)"
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: item.ItemCount

#2 Post by rock5 »

To get an item count use

Code: Select all

inventory:itemTotalCount(id or name)
No updates required.
  • 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
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: item.ItemCount

#3 Post by Romplayer »

i use that but i find it too slow when collecting quest items.. It doesn't update when the message pops up with example 9/10 to 10/10 items and i'll keep collecting to like past 10. so in my bag i'll have 11/10 quest items. or sometimes it'll error when collecting and freeze the bot with the cast bar stuck at full. the only way to remedy this is to call a mount to clear the cast bar. then the bot unfreezes
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: item.ItemCount

#4 Post by Romplayer »

i use 14 >= inventory:itemtotalcount in a loop but i still collect 16

could i use item.ItemCount == 15 then break?
if so how do i define item and where ?
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: item.ItemCount

#5 Post by rock5 »

Maybe you are not using it properly. How are you using it and where are you putting it?
  • 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
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: item.ItemCount

#6 Post by Romplayer »

Code: Select all

   while 14 > inventory:itemTotalCount(240627) do 
			-- yrest(500)
		player:target_Object("Thief's Treasure Chest", 500, true, false);
		--item:update(240627)
		yrest(300)
	end
as i was typing this it looted 16 and got stuck trying to loot still i had to ctrl L and reload the waypoint.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: item.ItemCount

#7 Post by rock5 »

Using 'true' as the third argument in 'target_Object' will make it continue collecting all in range until there are none left. If you want it to check the number after each collection, try changing it to false so it only does one at a time.

As to it getting stuck, that is a different issue. Probably just a bug in the game.
  • 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
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: item.ItemCount

#8 Post by Romplayer »

i think i tried it at nil.. it would red out the casting bar so i use this and it collects smooth and fast
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: item.ItemCount

#9 Post by rock5 »

Maybe "smooth and fast" but you can't stop it when you have the right number.

I don't know why it would red the bar. I would suggest adding a pause but you already have one. I can't think of any more advice at the moment except try to increase the 500 to the actual time it takes to collet, or maybe a bit more.
  • 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
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: item.ItemCount

#10 Post by Romplayer »

would this work?

Code: Select all

 while 14 > inventory:itemTotalCount(240627) do 
         -- yrest(500)
      player:target_Object("Thief's Treasure Chest", 500, true, false);
      --item:update(240627)
      if item.ItemCount == 15 then
      break
      end
      yrest(300)
   end
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: item.ItemCount

#11 Post by rock5 »

No. This function wont finish until it has collected all nearby.

Code: Select all

player:target_Object("Thief's Treasure Chest", 500, true, false);
The only way to count them after each collection is to collect one at a time so the third argument must be false.
  • 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
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: item.ItemCount

#12 Post by Romplayer »

ok it works great
another thing i've been wondering is inventory:findItem(id) doesn't seem to work. I just get a table with no values i think.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: item.ItemCount

#13 Post by lisa »

a table with no values?
I am guessing you print the table like this

Code: Select all

print(inventory:findItem(id))
or something similar, that will only print the table number.

Code: Select all

table.print(inventory:findItem(id))
is what you want.
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
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: item.ItemCount

#14 Post by Romplayer »

Code: Select all

			local stuff = inventory:findItem(id)
			for k in pairs(stuff) do
				printf(k)
			end
would this work?
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: item.ItemCount

#15 Post by lisa »

Romplayer wrote:would this work?
kind of

Code: Select all

         local stuff = inventory:findItem(id)
         for k,v in pairs(stuff) do
            printf(v)
         end
would be better, the k would just be numbers for the spot the info is in table.

easier/better to do what I posted tho

Code: Select all

local stuff = inventory:findItem(id)
table.print(stuff)
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
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: item.ItemCount

#16 Post by rock5 »

lisa wrote:

Code: Select all

         local stuff = inventory:findItem(id)
         for k,v in pairs(stuff) do
            printf(v)
         end
Well.... 'v' by it self wouldn't be very informative and printf with no "\n" will cause it to put everything on one line. I'd use

Code: Select all

print(k,v)
  • 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
Post Reply