Hello everyone. Just as the title says I am looking for help to create and inventory button to use specific container slot, bag 1 slot 1 for example. I want it to act just like a normal inventory right click: use or move on Right Button. Here is a piece of my code:
local icon, itemCount, locked, quality, readable, lootable, itemLink, isFiltered, noValue, itemID = GetContainerItemInfo(1, 1)
local btn = CreateFrame("Button", "1_01", UIParent,"SecureActionButtonTemplate");
btn:SetPoint("CENTER",UIParent,"CENTER")
btn:SetSize(40,40)
local texture = btn:CreateTexture("1_01_Texture", "BACKGROUND")
texture:SetTexture(icon)
texture:SetAllPoints()
btn:RegisterForClicks("AnyUp")
btn:SetAttribute("type2", "item")
btn:SetAttribute("item", 1,1)
btn:SetScript("OnClick", function(self, button)
UseContainerItem(1,1)
print(button.." "..1.." - "..1)
end)
It woks just fine with transfering items to bank, vendoring, etc, but I get a “AddOn tried to call the protected function” error when I try to use any kind of consumables, hearthstones. Please help me find an error, because I feel like I hit a wall.