Trying to make my vanilla frame work in Classic--SendAddonMessage
In vanilla, I had written a /find command that would have everyone report an item in their bags (for multiboxing) using the SendAddonMessage command.
I created the frame in Classic, and no errors (lua errors ARE enabled), but it doesn't do anything. I don't think the CHAT_ADDON_MSG event is even firing in my party members.
Can you see what i'm doing wrong?
if UnitInRaid("player") then
FSMB = CreateFrame("Button","FSMB",UIParent)
-- register the events we want to use (this is why we made the frame)
FSMB:RegisterEvent("ADDON_LOADED") -- register event "ADDON_LOADED"
FSMBtooltip=CreateFrame("GAMETOOLTIP", "FSMBtooltip", UIParent, "GameTooltipTemplate")
if (event == "CHAT_MSG_ADDON") then
Print("Addon message recieved from"..arg3)
if arg1=="FSMB_FIND" then
print("Got find request for "..item)
elseif event == "CONFIRM_SUMMON" then
elseif event == "RESURRECT_REQUEST" then
-- this event fires when you get a resurrect request
AcceptResurrect() -- accepts resurrection
StaticPopup_Hide("RESURRECT_NO_TIMER"); -- hides popup frame
StaticPopup_Hide("RESURRECT_NO_SICKNESS"); -- hides popup frame
StaticPopup_Hide("RESURRECT"); -- hides popup frame
elseif (event == "UI_ERROR_MESSAGE") then
elseif (event == "AUTOFOLLOW_END") then
FSMB:SetScript("OnEvent", FSMB.OnEvent) -- event handler
I've not used this element of the addon api so am not 100% sure of the accuracy of what I am saying but ..
I believe Blizzard has made changes to Classic so that certain automated/communication addons will not work.
It could also be that a later change made to the api since the original Classic has been retained in the new Classic and that is affecting your addon.
So, have you tested your addon code in the Retail version to see if it works there. If it doesn't work there in a similar way then that could mean my last suggestion is the more likely.
Are there any addons that do something similar that does work in Classic that you can look at to see what they do to make it work ?
Hopefully someone with more knowledge to these types of addons will be able to add more.
If the sendChat does work, your event handler doesn't have any parameters to "receive" any events and the if/elseif checks will always fail.
Implicit arg1, arg2, etc. was removed long ago. Now you must define any parameters passed to your function that you wish to use. (See Fizzlemizz's post above.)
I'm sure I explained it poorly,but the : Vs . Rule is what I use (or if the function requires self as first parameter which is functionally equivalent to having the : ).
The debate of colon and dot notation of calling is off topic here and doesn't even apply to your own example. It's not even a function call, you're just storing a local reference of a function.
|All times are GMT -6. The time now is 11:55 PM.|
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI