Page 1 of 1
inventory:useItem Error
Posted: Tue Jul 13, 2010 5:27 pm
by Binafus
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));
Re: inventory:useItem Error
Posted: Tue Jul 13, 2010 10:38 pm
by Binafus
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
Re: inventory:useItem Error
Posted: Wed Jul 14, 2010 1:29 am
by rock5
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;
That should work.
Re: inventory:useItem Error
Posted: Wed Jul 14, 2010 7:29 am
by Binafus
It does work.
I missunderstood how to use the command, thanks for clearing it up.