Hi all
@Rilgamon, I didn't even think of that, I've been so focused on getting and using the hover to get the itemID that even the simplest of things passed over my head; thanks for reminding me
@Fizzlemizz, I have tried your code however I still have the exact same issues.
I have to /reload after entering world for the first time to get the button clicks to work, and, the list is still empty when I /qwe, I have also got the SavedVariables lua open so I can see if the itemIDs are saved on /reload just to ensure my /qwe was not working properly.
I repaced my orriginal addItemToTable function with your chunk and I also renamed my table, button and vars, (i went a bit overboard with the names).
Here is my current code;
Lua Code:
local myTestingKeybindingItemName, myTestingKeybindingItemLink, myTestingKeybindingItemID
if not myTestingKeybindingTableOfItems then
myTestingKeybindingTableOfItems = {}
end
local function addItemToTable(itemLink)
local found
for k, v in pairs(myTestingKeybindingTableOfItems) do
if v == itemLink then
print("Item all ready listed")
found = true
break
end
end
if not found then
table.insert(myTestingKeybindingTableOfItems, 1, itemLink)
print("Item added to list",itemLink)
end
end
SLASH_MYTEST1 = "/qwe"
function SlashCmdList.MYTEST(msg, editbox)
if #myTestingKeybindingTableOfItems == 0 then
print("empty table")
else
for k, v in pairs(myTestingKeybindingTableOfItems) do
print("item", k, v)
end
end
end
local myTestingKeybindingButton = CreateFrame("BUTTON", "myTest")
SetBindingClick("F5", "myTest", "b1")
SetBindingClick("G", "myTest", "b3")
myTestingKeybindingButton:SetScript("OnClick", function(self, button)
GameTooltip:HookScript("OnTooltipSetItem", function(self)
myTestItemName, myTestItemLink = self:GetItem()
myTestItemID = tonumber(strmatch(myTestItemLink, "item:(%d+):"))
end)
if button == "b1" then
addItemToTable(myTestItemLink)
print("F5 button clicked", myTestItemLink, myTestItemID)
elseif button == "b3" then
print("G button clicked")
end
end)
I still have the issue that I have to /realod before the keybinds work.
How do I ensure that the keybinds are available when I first log in?