Thread Tools Display Modes
11-17-12, 04:16 PM   #1
Deathshiver
A Defias Bandit
Join Date: Aug 2012
Posts: 2
Advanced chat format

I've been working on coding a UI, and I wanted to do something more unique with the chat boxes. There was a couple of ideas that I came up with; but to be honest, I have no idea how to go about them.
  • Is there any way to split the chat into two separate columns so that the names of the senders can be right aligned to some "center divider" and the rest of the chat can be left aligned to the divider? If so, is there a way to maintain both columns while scrolling back through history?
  • Can I toggle making the chatbox interactable/static through other functions? (Such as holding a hotkey or pressing a button)

If these are possible, can someone refer me to a place where I can learn more or perhaps a project that has already accomplished this? My primary goal from the project is to learn more about Lua and XML interfaces in WoW.
  Reply With Quote
11-17-12, 09:13 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
In order to have the names and messages split up like you describe, you would need to actually use two frames, placed side by side to give the illusion of being a single frame. Names would go in one frame, and messages in the other. You would simply alter your scroll buttons/functions to scroll both frames at the same time. You could probably hook into the existing chat frame system to remove the names, and only have to write the second frame for the names, but that's still going to be a lot of work, especially for someone unfamiliar with Lua and/or the WoW API.

On a side note, you don't need to know anything about XML unless you are writing secure templates for inheritance by unit frames or action buttons. Frame creation and manipulation is more straightforward and far less verbose in Lua. The only reason you still need XML for secure templates is because Blizzard does not currently provide a way to create virtual frames (templates that don't actually exist as frames themselves) in Lua.

If by "toggle making the chatbox interactible/static" you mean toggling the Blizzard UI's "Make Interactive" toggle in the right-click menu, yes, just call the same function that gets called when you click on that menu option:

Code:
FCF_ToggleUninteractable()
... will toggle interactibility for the current chat frame.

Code:
FCF_SetUninteractible(ChatFrame1, interactible)
... will set a specific state of interactibility for a specific chat frame, where ChatFrame1 is a reference to the chat frame, and interactible is either true/false or 1/nil. You'd need to look at the value of ChatFrame1.isUninteractible to see whether the states are true/false or 1/nil; Blizzard originally used 1/nil for everything, but has been slowly converting to true/false.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-18-12, 09:14 AM   #3
Deathshiver
A Defias Bandit
Join Date: Aug 2012
Posts: 2
I really appreciate the reply.

I had guessed something along the lines of using two frames, but honestly it seems like it would be a massive headache to account for messages that span multiple lines -- I'm not even sure of a way to detect that for adding in blank lines on the player name frame. Is there perhaps a way to detect when it automatically line breaks the messages? (Or perhaps manually break them so you can count?) If I were to go about doing this, is using a chat frame even the right way to go about it?

I have no problem getting pretty advanced in Lua as I'm proficient in other languages, but I still have yet to learn it.

P.S. Is there any reason you would use XML interfaces over Lua interfaces? (efficiency perhaps?)
  Reply With Quote
11-18-12, 10:10 AM   #4
Farmbuyer
A Cyclonian
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 43
Originally Posted by Deathshiver View Post
P.S. Is there any reason you would use XML interfaces over Lua interfaces? (efficiency perhaps?)
Originally Posted by Phanx View Post
The only reason you still need XML for secure templates is because Blizzard does not currently provide a way to create virtual frames (templates that don't actually exist as frames themselves) in Lua.
That's pretty much it. Everything that once required XML can now be done in Lua with less hassle and better control over global name pollution, with the exception of virtual frame templates.
  Reply With Quote
11-18-12, 01:43 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Deathshiver View Post
... messages that span multiple lines -- I'm not even sure of a way to detect that for adding in blank lines on the player name frame. Is there perhaps a way to detect when it automatically line breaks the messages? (Or perhaps manually break them so you can count?) If I were to go about doing this, is using a chat frame even the right way to go about it?
Probably the simplest solution would be to replace the default chat frame altogether with totally new frames. Then, you can just use anchoring to take care of things:

Code:
*------* *---------------------*
| name | | single-line message |
*------* *---------------------*
*------* *---------------------*
| name | | this message wraps  |
*------* | to multiple lines   |
         *---------------------*
*------* *---------------------*
| name | | single-line message |
*------* *---------------------*
The topleft of each message is anchored to the topright of each name, and the topright of each name is anchored to the bottomleft of the previous message.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Advanced chat format

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