Hi all
I would like to find a way to get an itemID from an item that I am currently hovering over using a keybind.
So far I have been able to get this working by hooking the "OnTooltipSetItem" function as follows;
Lua Code:
local tableOfItems, itemLink, itemID = {}, "", ""
GameTooltip:HookScript(
"OnTooltipSetItem",
function(self)
_, itemLink = self:GetItem()
if itemLink == "" or itemLink == nil then
return
else
itemID = tonumber(strmatch(itemLink, "item:(%d+):"))
end
end
)
function ADDITEMTOLISTFUNCTION()
if itemLink == "" then
print("no item found")
else
addItemToList(tableOfItems, itemID)
print(itemLink, "added to list")
end
itemLink = ""
itemID = ""
end
Though this does work it will pick up any item when I mouse over my bags no matter how fast I move even while not pressing the player set keybinding.
Is there a better way to get the itemID only whilst pressing the keybind?