Hello,
i am trying to revive an old Addon (KeyBinder). I only have little knowledge about LUA coding. But somehow I've managed it quite well so far.
But i‘ve came around the problem that only the Keys 1, 2, 3, …, 8, 9, with ACTIONBUTTON1, ACTIONBUTTON2, etc. are working.
The other keys for example Q with MULTIACTIONBAR4BUTTON11 arent working.
Lua Code:
-- SetKey(button) - Determines the texture or text displayed on the button based on the key binding.
function addon:SetKey(button)
local spell = GetBindingAction(modif.CTRL .. modif.SHIFT .. modif.ALT .. (button.label:GetText() or "")) or ""
if spell:find("^SPELL") then
button.icon:Show()
spell = spell:match("SPELL%s(.*)")
button.icon:SetTexture(GetSpellTexture(spell))
button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
button.type = "spell"
elseif spell:find("^MACRO") then
button.icon:Show()
spell = spell:match("MACRO%s(.*)")
button.icon:SetTexture(select(2, GetMacroInfo(spell)))
button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
button.type = "macro"
elseif spell:find("^ITEM") then
button.icon:Show()
spell = spell:match("ITEM%s(.*)")
button.icon:SetTexture(select(10, GetItemInfo(spell)))
button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
button.type = "item"
else
button.icon:Hide()
local found = false
for i = 1, GetNumBindings() do
local a = GetBinding(i)
if spell:find(a) then
local slot = spell:match("ACTIONBUTTON(%d+)") or spell:match("BT4Button(%d+)")
if slot then
button.icon:SetTexture(GetActionTexture(slot))
button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
button.icon:Show()
button.slot = slot
end
spell = GetBindingText(spell, "BINDING_NAME_") or spell
button.type = "interface"
found = true
end
end
if not found then
button.type = "none"
end
end
button.macro:SetText(spell)
end