SpeakinSpell

66 - Customized Chat Frame Colors

SpeakinSpell (3.2.2.10) uses hard-coded color codes for all chat channel colors that it implements.  If the user changes the color options in the chat frame, those changes are not reflected in SpeakinSpell.

It should be possible to query the settings of the chat frame to find out the user's selected colors.

This would also greatly alleviate the task of figuring out the hard-coded color codes when adding a new one.

I wonder if it's possible for an addon to register additional chat frame color types so I could jam the color of "SpeakinSpell" in there and stuff like that?

Basically just want to add general integration between SpeakinSpell and the color manager options for the chat frame.

User When Change
rismisner Sun, 22 Nov 2009 12:25:23 Changed status from Accepted to Fixed
rismisner Thu, 08 Oct 2009 01:59:58 Changed priority from Medium to High
rismisner Wed, 07 Oct 2009 05:25:49 Create

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of rismisner rismisner Sun, 22 Nov 2009 12:28:16

    3.2.2.13 adds a GUI to customize the 6 colors currently stored in the saved data. This new GUI is accessible through "/ss colors"

    I was keeping this ticket open until I added the first version of that GUI, so I consider this complete now.

    As new features are added, I will try to remember to add color picker widgets to this GUI if applicable. There should typically not be any need for new tickets along those lines.

    However, if there are any colors used by SS which I have not made configurable in some way, but you'd like to change, please open new tickets for those, to "let me customize the color of _"

  • Avatar of Aetharan Aetharan Sat, 10 Oct 2009 11:47:52

    A quick test of 3.2.2.11's Boss Whisper function shows that the color-usage works perfectly. It mimics the color chosen in the chat frame without error, through multiple posts. In fact, with the chat addon I have in play, the colors change retroactively for the boss whispers SpeakinSpell posted when I change the color of Boss Whisper after the fact.

    Discussion of the Boss Whisper function itself will be elsewhere.

  • Avatar of rismisner rismisner Sat, 10 Oct 2009 10:35:19

    keeping this ticket open until I add a color picker GUI for the color codes that I've moved into the saved data. let's spin off other tickets for any other remaining ideas inspired throughout the discussion here.

  • Avatar of rismisner rismisner Sat, 10 Oct 2009 10:33:41

    3.2.2.11 adds 2 new channels, Boss Whisper, and Mysterious Voice.

    Boss Whisper uses the RAID_BOSS_WHISPER chat type (also labeled "Boss Whisper" in the chat frame's color options) and always uses the ChatTypeInfo color of RAID_BOSS_WHISPER

    Mysterious Voice uses a saved data color code that's a copy of the self-only raid warning color.

  • Avatar of rismisner rismisner Sat, 10 Oct 2009 09:37:09

    I reorganized the SpeakinSpell.Colors table and moved some of the color code definitions into SpeakinSpellSavedData per character. Every color reference in the GUI now uses a color value from an appropriate source.

    except for the color of "SpeakinSpell:" in the SS system messages and self-chat. That wants to be used before saved data has been loaded, so it can't be fixed in this way right now.

    That calls for separating the SS system messages channel ( SpeakinSpell:Print ) from the self-chat option for announcements, which should be split into a separate function that uses a user-defined color and no prefix (or maybe prefix "[SpeakinSpell] whispers: " ??)

    EDIT: the Self-Chat (SpeakinSpell) channel now uses a new function in 3.2.2.11, SelfChat_SpeakinSpellChannel, to separate it from system messages printed with Print. The behavior looks exactly the same, but the color of the word "SpeakinSpell:" in this channel is going to become customizable.


    I added a function to load the color codes from the chat frame settings in ChatTypeInfo[name]. There's an annoying delay before this information becomes available - it's not available yet during SpeakinSpell:OnInitialize of OnVariablesLoaded. It returns all white until later. So I call this function when first starting to SHOW the message settings GUI.


    For the drop-down lists to select a channel, I moved the color coding of that text from hard-coded escape sequences in the GUI definition table, to a function that formats the RGB values returned from ChatTypeInfo and/or stored in SpeakinSpellSavedData.Colors.Channels, and formats it as text color code escape sequences "|cffrrggbb"

    This makes the drop down lists look much nicer because the colors are a perfect match now.


    For the self raid warning channel, I left the default the same for now. It's a little similar to the raid leader channel color, much paler than the RAID_WARNING color, but I prefer it :P The color code is defined in saved data now though, so a GUI is coming soon to make it configurable.

    Last edited on 10 Oct 2009 by rismisner
  • Avatar of rismisner rismisner Sat, 10 Oct 2009 05:11:05

    I'm gonna start with just integrating some use of the chatType queries to get the customized colors in the SpeakinSpell.Colors table, which is used mostly for color-coding the drop-down lists in the channel selection controls under Message Settings.

  • Avatar of rismisner rismisner Sat, 10 Oct 2009 05:06:54

    Nice experiment.

    So the ID passed to AddMessage is ONLY used for color coding (apparently), and is NOT used for filtering out some chat types from some frames, or directing certain chat types to the player's selected chat frames for that chat type - like your RP frame or my Guild frame.

    That behavior actually makes a lot of sense now that I think about it, considering the ID parameter is optional, and you're calling the function on a specific frame... Frame:AddMessage is saying "add this message TO THIS FRAME" so it's actually kinda nice that we have the freedom to override it (looking on the bright side of it not being as automatic as would make this easier LOL)


    So can we go up a layer and use an API like "Frame Master":AddMessageToAppropriateFrames( text, chatType )

    No :(

    The only API I know like that is the "enter key channel" API using

    SpeakinSpellTempEditBox:SetText( text) 
    ChatEdit_SendText( SpeakinSpellTempEditBox )
    

    But that doesn't give us enough control for our purposes because we can only use the player's sticky channel that way as if they pressed ENTER - we can't use boss whisper, or even select a specific channel like PARTY - we might get PARTY or we might get SAY but we can't control it. (Well, we could prefix the text with "/p " to force it into party chat, but that would have the unfortunate side effect on the player next time you hit ENTER)


    Can we SendChatMessage to any chatType ???

    Maybe...

    That would rule - that would do what we want. It does this already for SendChatMessage( "PARTY", text ) if you have party chat showing in more than one chat frame. Can we SendChatMessage( "BOSS_WHISPER", text ) and have it show in the correct frames?

    Does that throw a LUA error? I fear it does...

    If not, does it show in the correct frames? - probably yes

    with the customized color? - probably yes

    what about other people in my group? - probably not an issue, but this is the issue that makes me suspect it just throws a LUA error rather than let you attempt it.


    The other option I see would rely on an API to check a chat frame's select chat type options, in order to loop through all existing chat frames, and check which ones want to receive a given chat type.

    This seems the most plausible

  • Avatar of Aetharan Aetharan Thu, 08 Oct 2009 13:04:43

    The applications for which I tested the AddMessage function didn't test the fade time, although by excluding it I believe it went with the default times for chat fade (I'd have to check again, as it's been a while since I played with it.)

    The way I have my UI set up, I actually have 3 chat frames: 1) General, left to default settings. 2) RP, displaying only the variations on /say, /yell, /emote, and /whisper 3) Combat Log.

    When I used DEFAULT_CHAT_FRAME:AddMessage(message, info.r, info.g, info.b, info.id); the result was that General displayed the message using the chatType whose information I had retrieved to determine my color. Neither RP nor Combat Log showed the message delivered. If I instead use SELECTED_CHAT_FRAME:AddMessage(message, info.r, info.g, info.b, info.id); then it will display the message in whichever frame I have on top at the moment, and leave the other two alone. Still not ideal. If I used the loop described in one of my previous comments, it posted the message in all 3 frames, despite the fact that the Combat Log was in no way supposed to show RAID_BOSS_WHISPER, which was the chatType whose info I had retrieved.

    As a matter of curiosity, I intend to log in to test whether SnS's current use of DEFAULT_CHAT_FRAME:AddMessage touches on both of the frames that I want it to, but not the Combat Log.

    Edit: Test performed, and the behavior is as my previous usage: the test appears in General only, not in RP or Combat Log. I still lack the full understanding of the chat API necessary to find the solution.

    Last edited on 08 Oct 2009 by Aetharan
  • Avatar of rismisner rismisner Thu, 08 Oct 2009 03:22:49

    For reference purposes, listing info about the various APIs that I use for sending chat to the text. These code samples and explanations are taken from SS 3.2.2.10

    SendChatMessage

    -- SendChatMessage("msg" 
    --		[,"chatType=say,party,whisper,etc" 
    --		[,"language=nil,common,dwarvish,etc" 
    --		[,"channel means whisper target name or channel number 1,2,3"]]]);
    

    This is the basic API available to send chat that is publically viewable, i.e. party chat, say channel, etc - chat that other people can read besides you.

    Clickable links like <spelllink> are generated from escape sequences embedded in the "msg" These escape sequences are like "|uilarfhljadnglkdjb" not human-readable codes for actions or modifications to the way text is displayed. It's like the equivalent of WoW performing <substitutions> on the text using a different syntax than SpeakinSpell.

    Color coding a single word in a sentance of text also works off escape sequences, but that's not allowed in public channels like party, say, general, etc, that people other than you can read. You can't spoof chat channel colors for others. It throws a LUA error if you try IIRC.

    Any instance of the | character begins an escape sequences. I have not been able to figure out yet how you print the | character itself, though something automatically happens with it if I type it into a speech via the SS GUI IIRC. More testing/investigation should be done in this area.

    In general, an invalid, unrecognized, or disallowed escape sequence in a SendChatMessage call will give you a LUA error.

    Escape sequences that generate spoofed links will get you DC'd, as will line breaks.

    So you have to be pretty careful in the way you use SendChatMessage, and there are limits.

    Note how color is not a parameter and there is no way to control it here. It will go by the receiving player's color settings for their chat frame and the selected chatType and channel parameters used.


    RaidNotice_AddMessage

    Doesn't have a page on wowwiki. I got this function from a code sample in DBM.

    This function generates the self-only raid warning.

    function SpeakinSpell:SelfRaidWarn( text )
    	-- show the line as a raid warning style popup that only I can see
    	-- this is EXACTLY the same as a real raid warning
    	PlaySound("RaidWarning") --RaidNotice_AddMessage doesn't play sound
    	RaidNotice_AddMessage(RaidWarningFrame, text, SpeakinSpell.Colors.SELFRAIDWARNFrame)
    end
    

    RaidNotice_AddMessage bypasses SendChatMessage( "/rw" ) to add text to your actual raid warning frame.

    'RaidWarningFrame' is a global defined by Blizzard (apparently). It's a frame window object, which is borderless, and non-draggable, usually invisible and completely transparent to clicks. It controls the position, size, and font of all raid warnings - the real kind, generated with "/rw move!".

    'text' is the text of the speech, and may include color code escape sequences. Should be able to include links too.

    'SpeakinSpell.Colors.SELFRAIDWARNFrame' defines the color.

    	SELFRAIDWARNFrame = { -- raid warning color ff-db-ad defined as floating point numbers
    		r = (255/255), --ff
    		g = (219/255), --db
    		b = (173/255), --ad
    	},
    

    I determined that value from experimenting with a color picker and dumping the RGB values to the chat frame until I picked a color that looked right ... it should definitely be replaced by the actual return value of ChatTypeInfo["RAID_WARNING"];

    Note there is one point where it does not match EXACTLY because I can override the color in 2 ways, unlike if I SendChatMessage( "/rw" )

    Our options in this area...

    A) add a GUI control to change the value of SELFRAIDWARNFrame as a global setting and default it to ChatTypeInfo["RAID_WARNING"]

    B) create two separate channel options, one that always uses the color of ChatTypeInfo["RAID_WARNING"], and the other that uses the saved value of (A) above.

    C) Add an Event-specific option in SS to set the color used to report a specific event. - only works in SS channels per restrictions on SendChatMessage above - only talking about self-only raid warnings at this point under heading of RaidNotice_AddMessage - use a checkbox like "[X] Use Selected Color for this Event" and it shows/hides the color picker control. If OFF, it uses the value of ChatTypeInfo["RAID_WARNING"] ... or SpeakinSpellSavedData.SELFRAIDWARNFrame

    D) individual words can also be color-coded using escape sequences - this API could support an option to color code substitutions


    DEFAULT_CHAT_FRAME:AddMessage( text )

    DEFAULT_CHAT_FRAME is a global defined by blizzard which is the frame window object where your chat shows up.

    This adds a message directly into the chat list shown in that window.

    The "SpeakinSpell channel" used for self-chat and system messages is based on this function

    function SpeakinSpell:Print(message)
    	-- Overriding AceConsole-3.0:Print to use localized addon name instead of tostring(self)
    	local text = tostring(SpeakinSpell.Colors.Channels.SPEAKINSPELL).."SpeakinSpell|r: " .. tostring(message)
    	DEFAULT_CHAT_FRAME:AddMessage( text )
    end
    

    Note how the color of the word SpeakinSpell is controled by a color-code escape sequence appended to the text. "|r" returns it to the default color, white (actually it's probably defined by a chatType, maybe "SAY"?)

    This API provides the most extensible well of new SS-driven channel options such as Boss Whisper.

    The full parameter list is

    AddMessage( text, R, G, B, ID, FadeTime )

    R,G,B

    The full parameter list includes a color code, so we can set any color code we want.

    ID

    You can also pass a chat type ID which causes it to use the same color as that chat type - so rather than pass the color retrieved from chatType[ "CHANNEL_NAME" ] we could pass the ID returned from chatType[ "CHANNEL_NAME" ] - I assume that if you pass an ID, then the chat filters also apply, and unselected chat types will not show up in your window - A good question is whether this ID can be used to purposefully send a SS speech to the combat log window, or other custom chat frames, by specifying the chat type ID - The question of adding SpeakinSpell channel colors to the chat frame's color picker is most likely an issue of defining additional chat type IDs - probably not possible, but blizzard did add tons of stuff for addons to be able to do, so maybe there's a way

    FadeTime

    You can also specify a fade time which I assume only applies to certain frames - I haven't tried it on DEFAULT_CHAT_FRAME, but I did experiment with it for self-only raid warnings off that frame. This code sample shows a demonstration of showing an error message on the screen for 5 seconds

    UIErrorsFrame:AddMessage("Testing", 1.0, 0.0, 0.0, 53, 5);
    

    Note there are more global message frames like UIErrorsFrame, DEFAULT_CHAT_FRAME, RaidWarningFrame


    ChatEdit_SendText(SpeakinSpellTempEditBox)

    This API is the basis for being able to execute slash commands such as "/wave". I adapted the code on the wowwiki page linked above into the following code fragment.

    	-- create a hidden edit box to parse and send the slash command
    	if not SpeakinSpellTempEditBox then
    		SpeakinSpellTempEditBox = CreateFrame("EditBox", "SpeakinSpellTempEditBox", UIParent)
    		SpeakinSpellTempEditBox:Hide()
    	end
    	
    	-- send the command
    	SpeakinSpellTempEditBox:SetText(text) 
    	ChatEdit_SendText(SpeakinSpellTempEditBox)
    

    What this does is create an invisible chat entry box just like the one that appears when you hit ENTER or /, except it's never visible.

    ChatEdit_SendText sends text THROUGH that invisible chat input box in a way that it gets parsed and executed as if you had typed it yourself, or written it into a game macro (/m)

    This will also be the basis of the "Default" channel planned by ticket 77 Channel = [Enter Key]

    If you try to use escape sequences in the text in this case, it will come out as if you typed it - verbatim - not processed like an escape sequence, i.e. for color coding, or putting in links.

    There's a /script command you can send through chat this way to create a link to an achievement or spell - Meneldil used it as a work-around to a problem he was having linking things in chat for a while - if I understood him correctly - but I'm not sure what the syntax is.

  • Avatar of rismisner rismisner Thu, 08 Oct 2009 02:10:06

    Hmm, I thought that adding a color picker GUI already had it's own ticket, but I couldn't find it, so I guess not. I know someone suggested that to me before with regard to changing the color of SS system messages and self-chat.

    There is another related issue on the table re: color-coding SS speeches by type of event, such as debuffs announced in one color, and spell casting in another, etc. I can't seem to find an existing ticket for that either.

Facts

Last updated on
22 Nov 2009
Reported on
07 Oct 2009
Status
Fixed - Developer made requested changes. QA should verify.
Type
Enhancement - A change which is intended to better the project in some way
Priority
High - Strongly want to resolve in the specified milestone.

Reported by

Possible assignees

Votes (Total: +2, Average: +2.0)