WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Getting item details via slash command (https://www.wowinterface.com/forums/showthread.php?t=56313)

Walkerbo 06-30-18 02:21 AM

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.

Rilgamon 06-30-18 05:51 AM

make sure there is a space between asd and link

Walkerbo 06-30-18 05:38 PM

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


All times are GMT -6. The time now is 11:40 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI