Page 1 of 1

5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 11:53 am
by C3PO
Hello community,

since the last patch I get problems with same scripts that uses

Code: Select all

inventory:useItem(id)
It worked fine before. May someone has the same problem, or better someone has a solution ...

thx

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 6:22 pm
by lisa
works fine for me.

Code: Select all

Type in 'q' (without quotes) to quit.
Command> if inventory:useItem(207203) then print("it works fine") end
it works fine
Command>
it used the item and I got the luck pot buff, maybe the item you are using has changed Id?
they have done that in previous patches, might be a good idea to check the item Ids.

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 8:25 pm
by C3PO
I will try that! thanks

PS: is there a code to find the ID? (I always used Runesdatabase to find out the id's)

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 8:38 pm
by rock5
I don't believe there is any simple command that returns item ids. There are addons that can give you ids. I use DailyNotes but I believe the option to show item ids is not usually available. ItemPreview is always a good addon to have. You can search for any items you want, even ones you don't have.

Of course you can also use the bot. Put the item in the first bag slot, start the commandline and type the following

Code: Select all

print(inventory.BagSlot[61].Name, inventory.BagSlot[61].Id)

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 8:46 pm
by C3PO
Of course you can also use the bot. Put the item in the first bag slot, start the commandline and type the following
print(inventory.BagSlot[61].Name, inventory.BagSlot[61].Id)
thx, thats all I need

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 8:57 pm
by C3PO
maybe someone has another idea ...

The ID's are still the same.

Edit: I also tried Lisa's

Code: Select all

if inventory:useItem(207203) then print("it works fine") end
and it didn't work

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 9:22 pm
by rock5
Hey I did figure out a command that you can use in game.

Code: Select all

/script SendSystemChat(tonumber("0x"..string.match(GetBagItemLink(GetBagItemInfo(1)),"item:(%x*)")))
That prints the id of the first bag slot item but like I said, not simple.

Anyway, what I can tell you is, if Lisas command didn't print "it works fine" then it thinks it didn't find the item. Why, I don't know.

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 9:36 pm
by C3PO
you are right. the bot isn't able to find the item ... but the bot could get the itemTotalCount() ...

at the moment I'm debugging inventory.lua findItem() and it looks like one of the boolean in the first "if" are false ...

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 9:44 pm
by lisa
I am thinking things like profile autosell from and to numbers but I thought the inventory class didn't use those, it just checks what bag slots are actually available.

Maybe start up with commandline and do this function

Code: Select all

function printinventory()
	local bags = {}
	inventory:update()
	for slot = 61, 240 do
		item = inventory.BagSlot[slot]
 	    if item.Available and  item.Name ~= "<EMPTY>" then
			table.insert(bags, {Name = item.Name, Id = item.Id, Rlevel = item.RequiredLvl, stats = item.Stats})
		end;
	end;
	table.print(bags)
end

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 10:05 pm
by C3PO
I think I found the reason. It's not the first "if" but the second.

os.clock get's -2031146.139
lastuse 0
reuse 1

and that's why ((os - lastuse) > reuse) is false ...

After restarting micromacro os.clock returns correct values and the item useage worked again.

thanks for your help

Re: 5.0.6 problem with bag-items

Posted: Fri Dec 21, 2012 10:48 pm
by lisa
os.clock() is the time in seconds since the programme was started, in this case micromacro.

So to get a negative maybe your operating system clock went backwards?
I am thinking day light savings or maybe you just adjusted the time?

Re: 5.0.6 problem with bag-items

Posted: Sat Dec 22, 2012 1:43 am
by C3PO
no more simple ... I had started micromacro a very very long time ago :)

Re: 5.0.6 problem with bag-items

Posted: Sat Dec 22, 2012 1:49 am
by lisa
C3PO wrote:no more simple ... I had started micromacro a very very long time ago :)
So I am guessing you restarted MM and it all works fine now =)