View Single Post
09-09-19, 03:42 PM   #1
Furyswipes
A Kobold Labourer
Join Date: Sep 2019
Posts: 1
Trying to make my vanilla frame work in Classic--SendAddonMessage

Hi folks.
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?
SLASH_FIND1="/find"
SlashCmdList["FIND"]=function(item)
if UnitInRaid("player") then
C_ChatInfo.SendAddonMessage("NORMAL","FSMB_FIND",item,"RAID")
else
C_ChatInfo.SendAddonMessage("NORMAL","FSMB_FIND",item)
end
end
C_ChatInfo.RegisterAddonMessagePrefix("FSMB_FIND")
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"
FSMB:RegisterEvent("CHAT_MSG_ADDON")
FSMB:RegisterEvent("CONFIRM_SUMMON")
FSMB:RegisterEvent("RESURRECT_REQUEST")
FSMB:RegisterEvent("PLAYER_LOGIN")
FSMB:RegisterEvent("UI_ERROR_MESSAGE")
FSMB:RegisterEvent("AUTOFOLLOW_END")
FSMBtooltip=CreateFrame("GAMETOOLTIP", "FSMBtooltip", UIParent, "GameTooltipTemplate")
Print=print
function FSMB:OnEvent()
if (event == "CHAT_MSG_ADDON") then
Print("Addon message recieved from"..arg3)
if arg1=="FSMB_FIND" then
print("Got find request for "..item)
item=arg2
MB_Find(item)
end
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
end
end
FSMB:SetScript("OnEvent", FSMB.OnEvent) -- event handler
  Reply With Quote