Thread Tools Display Modes
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
06-30-18, 05:51 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
make sure there is a space between asd and link
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
06-30-18, 05:38 PM   #3
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Oh wow, so I missed putting in a space, knew it would be a simple thing I messed up :0
Thanks for your help Rilgamon
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Getting item details via slash command

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off