Quantcast "Creating" chat frames via lua - WoWInterface
Thread Tools Display Modes
09-22-17, 10:47 PM   #1
cormanthor
A Warpwood Thunder Caller
 
cormanthor's Avatar
AddOn Compiler - Click to view compilations
Join Date: Nov 2008
Posts: 97
"Creating" chat frames via lua

I've searched this forum and wowwiki and wowprogramming.com to no avail.

Is there a way -- via lua -- to create ChatFrame3? It's easy enough to do in game, but I was hoping I could do it inside an addon (for new character setup purposes).

Any help is appreciated!
Best Regards,
Cormanthor
__________________
Some days it's just not worth chewing through the restraints...
  Reply With Quote
09-23-17, 12:00 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,642
Lua Code:
  1. local Frame = FCF_OpenNewWindow("chat window title")
  2. ChatFrame_RemoveAllMessageGroups(Frame)
  3. ChatFrame_RemoveAllChannels(Frame)
  4. ChatFrame_AddMessageGroup(Frame, "WHISPER")
  5. ChatFrame_AddMessageGroup(Frame, "GUILD")
  6. ChatFrame_AddChanngel(Frame, "Trade")

This will insert a new frame, it'll be whatever index the game assigns it to.
If you want to specifically do ChatFrame3, replace the first line with this:

Lua Code:
  1. local Frame = ChatFrame3

A full example of how I set up my chat frames on first login:
https://github.com/p3lim-wow/Inomena...aster/chat.lua

There's some other things in there that helps facilitate it, which you can ignore, the whole addon is about setting up on fresh characters (chat, cvars, bindings, scaling).
  Reply With Quote
09-23-17, 12:05 AM   #3
cormanthor
A Warpwood Thunder Caller
 
cormanthor's Avatar
AddOn Compiler - Click to view compilations
Join Date: Nov 2008
Posts: 97
Thanks p3lim! I'll have to give that a try in the morning.
__________________
Some days it's just not worth chewing through the restraints...
  Reply With Quote
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

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » "Creating" chat frames via lua

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off