Hi all
I am looking for a bit of guidance with hooking secure functions and/or triggering events for opening and closing the backpack.
I already have PLAYER_LOGIN, MERCHANT_SHOW and MERCHANT_CLOSED events working without issue.
On Townlong Yak I can find the BAG_OPEN and BAG_CLOSED events, as well as the ToggleBackpack, OpenBackpack and CloseBackpack functions yet I still have not been able to get any results when I run my code.
Here are my code chunks:
Lua Code:
-- my hook functions
hooksecurefunc(
"CloseBackpack",function()
print("CloseBackpack hookedfunction fired")
end
)
hooksecurefunc(
"OpenBackpack",function()
print("OpenBackpack hookedfunction fired")
end
)
hooksecurefunc(
"ToggleBackpack",function()
print("ToggleBackpack hookedfunction fired")
end
)
Lua Code:
-- my event triggers
TestFrame:SetScript("OnEvent",function(self, event, ...)
if event == "BAG_OPEN" then
print("BAG_OPEN event triggered")
elseif event == "BAG_CLOSED" then
print("BAG_CLOSED event triggered")
end
end
)
TestFrame:RegisterEvent("BAG_OPEN")
TestFrame:RegisterEvent("BAG_CLOSED")
Any sort of guidance and explanation of where I am going wrong would be great.