View Single Post
06-30-18, 02:21 AM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Getting item details via slash command

Hi all

I am having an issue with getting the item string of an item linked in chat using a slash command.

Here is my code;

Code:
SLASH_TESTC1 = '/asd'
function SlashCmdList.TESTC(msg, editbox)
   print('*** Chat Link Test Start ***')
   local itemID = tonumber(string.match(msg, 'item:(%d+):'))
   if msg=="" or msg==nil then
      print('no message')
   else
      print('message =', msg)
   end   
   if itemID then
      print('itemID =', itemID)
   else 
      print('no item')
   end   
   print('*** Chat Link Test End ***')
end

I am running this in game using the hack addon with the following results;
Code:
-- /asd
*** Chat Link Test Start ***
no message 
no item
*** Chat Link Test End ***
Code:
-- /asd<<shift clicked item link
Type'help' for a listing of a few commands.

I am not getting any errors in bugsack.

The first result is what I expect but the second result I dont understand when I do link an item why i do not get the opening and closing and the full message prints.

How do I correctly get the item ID of an item linked in chat?

Any help will be greatly appreciated.
  Reply With Quote