inventory:useItem Error

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Binafus
Posts: 23
Joined: Thu Jul 09, 2009 1:22 pm

inventory:useItem Error

#1 Post by Binafus » Tue Jul 13, 2010 5:27 pm

I put this in my Waypoint File and it will equip a item, but it crashes MM and gives an error Bad Argument #1 to 'sub' (string expected, got boolean) .

I can not get it to work doing the name instead becuase the name has a ' in it and can't seem to make that work.

Code: Select all

sendMacro(inventory:useItem(211494));

Binafus
Posts: 23
Joined: Thu Jul 09, 2009 1:22 pm

Re: inventory:useItem Error

#2 Post by Binafus » Tue Jul 13, 2010 10:38 pm

Best I can tell you can not call an item by its number from a waypoint file.

I did fix it where it will work but made a new function.

Would it be worth adding to the current functions file?

To call the function from your waypoint file it would be.

EquipItemByID(ItemNumber);

This would need to be added in the functions.lua

Code: Select all

function EquipItemByID(_ItemID)
	local hf_return, hf_itemid, hf_name = inventory:useItem( _ItemID );	
	if ( hf_return ) then
		cprintf(cli.lightblue, language[171], hf_name );	-- Equip Item
	else
		cprintf(cli.lightred, language[174], _ItemID );	-- Item Not Found
	end
	inventory:update();			-- update slots
end

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: inventory:useItem Error

#3 Post by rock5 » Wed Jul 14, 2010 1:29 am

Binafus wrote:

Code: Select all

sendMacro(inventory:useItem(211494));
This is wrong. inventory:useItem is a rombot function, you don't send it ingame.

Just use;

Code: Select all

inventory:useItem(211494)
That should work.
  • 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

Binafus
Posts: 23
Joined: Thu Jul 09, 2009 1:22 pm

Re: inventory:useItem Error

#4 Post by Binafus » Wed Jul 14, 2010 7:29 am

It does work.

I missunderstood how to use the command, thanks for clearing it up.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests