Quantcast
WoWInterface - View Single Post - "Creating" chat frames via lua
View Single Post
09-24-17, 01:24 AM   #4
cormanthor
A Warpwood Thunder Caller
 
cormanthor's Avatar
AddOn Compiler - Click to view compilations
Join Date: Nov 2008
Posts: 97
Sorry it took so long to reply. I've gotten 99% of what I wanted.
I am including the code I have so far (please forgive the sloppiness, as I am not very good with variable 'for loops' yet)
Code:
local function InitChatFrames()
-- Start from scratch
	ResetChatWindows()

-- Setup ChatFrame1
	ChatFrame_RemoveAllMessageGroups(ChatFrame1)
	ChatFrame_RemoveAllChannels(ChatFrame1)
	SetChatWindowName(1,"People")
	SetChatWindowSavedPosition(1,"BOTTOMRIGHT",0,0)
	SetChatWindowSavedDimensions(1,500,200)

-- Setup ChatFrame3
	FCF_OpenNewWindow("General")
	ChatFrame_RemoveAllMessageGroups(ChatFrame3)
	ChatFrame_RemoveAllChannels(ChatFrame3)
	SetChatWindowDocked(3,0)
	SetChatWindowSavedPosition(3,"BOTTOMLEFT",0,0)
	SetChatWindowSavedDimensions(3,500,200)
	
-- ChatFrame1 message groups
	ChatFrame_AddMessageGroup(ChatFrame1,'SAY')
	ChatFrame_AddMessageGroup(ChatFrame1,'EMOTE')
	ChatFrame_AddMessageGroup(ChatFrame1,'YELL')
	ChatFrame_AddMessageGroup(ChatFrame1,'GUILD')
	ChatFrame_AddMessageGroup(ChatFrame1,'OFFICER')
--	ChatFrame_AddMessageGroup(ChatFrame1,'GUILD_ACHEIVEMENT')
	ChatFrame_AddMessageGroup(ChatFrame1,'WHISPER')
	ChatFrame_AddMessageGroup(ChatFrame1,'BN_WHISPER')
	ChatFrame_AddMessageGroup(ChatFrame1,'PARTY')
	ChatFrame_AddMessageGroup(ChatFrame1,'PARTY_LEADER')
	ChatFrame_AddMessageGroup(ChatFrame1,'RAID')
	ChatFrame_AddMessageGroup(ChatFrame1,'RAID_LEADER')
	ChatFrame_AddMessageGroup(ChatFrame1,'RAID_WARNING')
	ChatFrame_AddMessageGroup(ChatFrame1,'INSTANCE_CHAT')
	ChatFrame_AddMessageGroup(ChatFrame1,'INSTANCE_CHAT_LEADER')
	ChatFrame_AddMessageGroup(ChatFrame1,'SYSTEM')
	ChatFrame_AddMessageGroup(ChatFrame1,'ERRORS')
	ChatFrame_AddMessageGroup(ChatFrame1,'IGNORED')
	ChatFrame_AddMessageGroup(ChatFrame1,'CHANNEL')
	ChatFrame_AddMessageGroup(ChatFrame1,'TARGETICONS')

-- ChatFrame3 message groups
--	ChatFrame_AddMessageGroup(ChatFrame3,'BG_SYSTEM_ALLIANCE')
--	ChatFrame_AddMessageGroup(ChatFrame3,'BG_SYSTEM_HORDE')
--	ChatFrame_AddMessageGroup(ChatFrame3,'BG_SYSTEM_NEUTRAL')
--	ChatFrame_AddMessageGroup(ChatFrame3,'BATTLEGROUND')
--	ChatFrame_AddMessageGroup(ChatFrame3,'BATTLEGROUND_LEADER')
	ChatFrame_AddMessageGroup(ChatFrame3,'MONSTER_SAY')
	ChatFrame_AddMessageGroup(ChatFrame3,'MONSTER_EMOTE')
	ChatFrame_AddMessageGroup(ChatFrame3,'MONSTER_YELL')
	ChatFrame_AddMessageGroup(ChatFrame3,'MONSTER_WHISPER')
	ChatFrame_AddMessageGroup(ChatFrame3,'MONSTER_BOSS_EMOTE')
	ChatFrame_AddMessageGroup(ChatFrame3,'MONSTER_BOSS_WHISPER')
	ChatFrame_AddMessageGroup(ChatFrame3,'ACHIEVEMENT')
	ChatFrame_AddMessageGroup(ChatFrame3,'PET_BATTLE_COMBAT_LOG')
	ChatFrame_AddMessageGroup(ChatFrame3,'PET_BATTLE_INFO')
	ChatFrame_AddMessageGroup(ChatFrame3,'LOOT')
	ChatFrame_AddMessageGroup(ChatFrame3,'MONEY')
	ChatFrame_AddMessageGroup(ChatFrame3,'COMBAT_XP_GAIN')
	ChatFrame_AddMessageGroup(ChatFrame3,'COMBAT_HONOR_GAIN')
	ChatFrame_AddMessageGroup(ChatFrame3,'COMBAT_FACTION_CHANGE')
	ChatFrame_AddMessageGroup(ChatFrame3,'SKILL')
	ChatFrame_AddMessageGroup(ChatFrame3,'CURRENCY')

	ChatFrame_AddChannel(ChatFrame3,'General')
	ChatFrame_AddChannel(ChatFrame3,'Trade')
	ChatFrame_AddChannel(ChatFrame3,'LocalDefense')

-- Now to reload
	ReloadUI()
end
I call this function from a slash command and it fixes up my chat and reloads my screen. I have a few outlying issues remaining however:
ChatFrame1 - I cannot add the message groups for Guild Announce or Blizzard Services Alerts
(not sure how important those are to me yet)
ChatFrame3 - I cannot add the pvp horde/alliance/neutral messages.
(not a big deal, but now I want to know)

The commented out lines did nothing, hence their comments.
I've tried finding the correlating event and getting the message groups from there, which is how I got most of the chat figured out.

Thanks again for your help. It has been invaluable!
__________________
Some days it's just not worth chewing through the restraints...
  Reply With Quote