1. Hello again,

    I'm currently working on another addon and I'd like to be able to bring up the ColorSelect dialogue. I've looked through the book and it mentions the frame type in chapter 10, and the only other reference to this frame type is in the widget API section, which doesn't really help me.

    Now that I think about it, could it be as simple as: local frame = CreateFrame("Color Choice", nil, ColorSelect) ?

    And then will it automatically return the value of the new color selected or will I have to use an API to pull that value?

  2. Hello again,

    I'm currently working on another addon and I'd like to be able to bring up the ColorSelect dialogue. I've looked through the book and it mentions the frame type in chapter 10, and the only other reference to this frame type is in the widget API section, which doesn't really help me.

    Now that I think about it, could it be as simple as: local frame = CreateFrame("Color Choice", nil, ColorSelect) ?

    And then will it automatically return the value of the new color selected or will I have to use an API to pull that value?

  3. If you are just trying to select a color via the in-game color select widget, I suggest you just use the one that is already built (http://www.wowwiki.com/HOWTO:_Use_the_ColorPickerFrame).  More often than not there isn't a need to create a new ColorSelect frame.

  4. Sweet, it is easier than I thought. Since I'm running out the door and don't have time to sit down and fiddle with the code for a little bit, is it possible to change the color of a whisper? Or, is there a way to take the message from a whisper, delete or stop WoW's normal process of display whispers and then rewrite the message in the color that was returned via the ColorPickerFrame?

    I got all the code I need to show the ColorPickerFrame and return the color chosen, just right now, I'm not sure if I can actually use the returned value for what I'm trying to do. 

    I've seen a few chat addons that allow the user to choose the color of the text that is displayed and prevent whispers from being displayed in the chat frame, so I believe this is possible. I'll look into API's dealing with messages and some chat addons when I get home later, just wondering if you know how to do it off the top of your head.

  5. You could ChatMessage filters.  These are added via the following function:

     ChatFrame_AddMessageEventFilter (event, filter)

    The filter should be a function which takes in an event and a message, and returns two arguments.  I've documented this function on our site, you can find it at http://wowprogramming.com/docs/api/ChatFrame_AddMessageEventFilter.

  6. Okay, I've just now begun to fidle around with the code, and this is what I have so far...

    Sfy = {}
    
    function Sfy:Intialize()
       ColorPickerFrame:Show()
       Sfy:Color()
    end
    
    function Sfy:Color()
       local sfyR,sfyG,sfyB = ColorPickerFrame:GetColorRGB();
    end
    
    ColorPickerFrame.func = SfyColor
    
    function Sfy:Filter(msg)
       if msg:match("sfy") then
          Sfy:Message(msg)
          return true, msg
       else
          return false, msg
       end
    end
    
    function Sfy:Message(msg)
       ChangeChatColor("WHISPER", sfyR, sfyG, sfyB)
       print(sfyR .. sfyG .. sfyB)
       print(msg)
       ChangeChatColor("WHISPER", 255, 128, 255)
    end
    
    ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", sfyFilter)
    Sfy:Intialize()

     All I have gotten to work so far is that it will hide any message containing "sfy", but I can't get it to print the message into the chat frame. Okay, I've fiddled around with it for a while now, and I can't seem to get it to work the way I want.

  7. What isn't working?  You're printing two lines to the chat frame, one consisting of the colors concatenated together (why?) and one containing the message itself?  Also, please don't just post code here, use the code formatting button, or Preformatted style or just post it at http://wowprogramming.pastey.net, it makes it much easier to read.

  8. The printing of the concatenated colors is just a little debug message letting me know that the program got that far... and it doesn't get that far.

    When the user enters the world, the little ColorPickerFrame will pop up, and you can select a color. The player can then be whispered anything with "sfy" in it, but neither the colors or the message will be printed. I'll read more about the filtering of chat messages tomorrow, and sorry about posting that big chunk of code.

    Now that I think about it, do I need to specify that the message should be printed to the current chat window?

  9. print() always prints to the DEFAULT_CHAT_WINDOW, which is ChatFrame1.

  10. Okay, I think I finally found the solution to what I'm looking for.

    With the first example, is there anyway I can change "msg" to "msgFrom"? I tried literally changing it, and tested this a few times, but I can't seem to get it to print the message. I guess it wouldn't be that easy, and is there any other code that would need to go with this, or is it just that small and stand-alone?

  11. Why do you need to change the name of the argument?  What it's called really doesn't and shouldn't matter.  If you're saying can you change it from being the MESSAGE itself to being the person who sent the message, the answer is No.

    What you must do (until Blizzard fixes the way the message filters work) is to access the global variable arg2 at the point where you need to do the check.  For example the following should work (untested)

    function OlathFilter(msg)

    local sender = arg2

    if sender:match("Balicnor") then

    print(sender .. " the wise says: '" .. msg .. "'")

    end



    return false, msg

    end
    ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", OlathFilter)
  12. I got confused with "msg" being your name for the argument and actually being the message part of the argument, if that made any sense.

    Works like a charm, thank you once again!