Originally Posted by Phanx
Something like this should work:
Code:
local function apply(editBox)
editBox:SetAttribute("chatType", "GUILD")
editBox:SetAttribute("stickyType", "GUILD")
end
-- apply change to all existing chat frames
for i = 1, 10 do
local editBox = _G["ChatFrame"..i.."EditBox"]
if editBox then
apply(editBox)
end
end
-- apply change to all future chat frames when they are created
hooksecurefunc(ChatEdit_OnLoad, apply)
|
Yes, rather. Erm. I follow that code -- what do I do with it? ^_^;
Armed with this reply, I was able to track down the chat mod that I used that provided this functionality - it was Cirk's ChatManager, accomplished with a slightly more robust (at that time) bit of code, to support D/Cs when grouped, raiding, PvPing, etc. I've attempted to produce something similar:
Code:
local function apply(editBox)
if ((IsInInstance() == "pvp") and (GetNumRaidMembers() > 0)) then
editBox:SetAttribute("chatType", "BATTLEGROUND");
editBox:SetAttribute("stickyType", "BATTLEGROUND");
elseif (GetNumRaidMembers() > 0) then
editBox:SetAttribute("chatType", "RAID");
editBox:SetAttribute("stickyType", "RAID");
elseif (GetNumPartyMembers() > 0) then
editBox:SetAttribute("chatType", "PARTY");
editBox:SetAttribute("stickyType", "PARTY");
elseif IsInGuild() then
editBox:SetAttribute("chatType", "GUILD");
editBox:SetAttribute("stickyType", "GUILD");
end
end
-- apply change to all existing chat frames
for i = 1, 10 do
local editBox = _G["ChatFrame"..i.."EditBox"]
if editBox then
apply(editBox)
end
end
-- apply change to all future chat frames when they are created
hooksecurefunc(ChatEdit_OnLoad, apply)
Would this code provide initial chat channel selection based on login conditions to support logging back in from a DC into a BG, raid, or party, followed by default guild support unless the chosen character is guildless wherein it will do nothing (leaving the default as SAY)?