item.ItemCount
item.ItemCount
How do i use this to get the # of items? I keep getting a nil when i update "item:update(id)"
Re: item.ItemCount
To get an item count use
No updates required.
Code: Select all
inventory:itemTotalCount(id or name)- 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
Re: item.ItemCount
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
Re: item.ItemCount
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 ?
could i use item.ItemCount == 15 then break?
if so how do i define item and where ?
Re: item.ItemCount
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
Re: item.ItemCount
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)
endRe: item.ItemCount
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.
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
Re: item.ItemCount
i think i tried it at nil.. it would red out the casting bar so i use this and it collects smooth and fast
Re: item.ItemCount
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.
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
Re: item.ItemCount
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)
endRe: item.ItemCount
No. This function wont finish until it has collected all nearby.
The only way to count them after each collection is to collect one at a time so the third argument must be false.
Code: Select all
player:target_Object("Thief's Treasure Chest", 500, true, 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
Re: item.ItemCount
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.
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.
Re: item.ItemCount
a table with no values?
I am guessing you print the table like this
or something similar, that will only print the table number.
is what you want.
I am guessing you print the table like this
Code: Select all
print(inventory:findItem(id))Code: Select all
table.print(inventory:findItem(id))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
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: item.ItemCount
Code: Select all
local stuff = inventory:findItem(id)
for k in pairs(stuff) do
printf(k)
endRe: item.ItemCount
kind ofRomplayer wrote:would this work?
Code: Select all
local stuff = inventory:findItem(id)
for k,v in pairs(stuff) do
printf(v)
end
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
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: item.ItemCount
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 uselisa wrote:Code: Select all
local stuff = inventory:findItem(id) for k,v in pairs(stuff) do printf(v) end
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