WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Chat Frames not retaining filter settings (https://www.wowinterface.com/forums/showthread.php?t=45435)

TGifallen 12-13-12 03:31 PM

Chat Frames not retaining filter settings
 
So I am messing with kgpanels to try to set up some sort of hacky chat tabs so i can have my Log, guild and loot windows on the right side and my general and whisper windows on the left. My code shows and hides the windows properly but the windows never save their filter settings.

Code:

-- on load
HackTabs = HackTabs or {}
local tab = GetClickFrame(\"ChatFrame3Tab\")
tab:Hide()

local Frame = GetClickFrame(\"ChatFrame3\")
HackTabs.ChatFrame3 = {
    Frame = Frame,
    Parent=Frame:GetParent(),
    Tab = tab,
}

-- on click
local Frame =HackTabs.ChatFrame3
Frame.Frame:SetParent(Frame.Parent)
Frame.Frame:Show()
for k,v in pairs(HackTabs) do
    if not (v == Frame) then
        v.Frame:SetParent(nil)
        v.Frame:Hide()
    end
end


Vlad 12-13-12 04:22 PM

I can't believe that compiles, since you use \" (escaping quotes) in a place that isn't even a string.

Should just be this, no?

"ChatFrame3Tab"

Example when to use \"

"You can \"quote\" a word that is in quotes already."

Phanx 12-13-12 05:58 PM

It's obviously not his real and/or whole code.

@TGifallen - Please post your entire, actual code. There's nothing in the fake snippet you posted that would affect the game's chat frame settings in any way. Posting fake snippets is just a waste of time, for both you -- because nobody can help you, and you just have to come back and post the real thing anyway -- and everyone else -- because we have to spend time looking at your useless fake code and telling you to post your real code. :(

TGifallen 12-13-12 08:37 PM

Quote:

Originally Posted by Phanx (Post 270649)
It's obviously not his real and/or whole code.

@TGifallen - Please post your entire, actual code. There's nothing in the fake snippet you posted that would affect the game's chat frame settings in any way. Posting fake snippets is just a waste of time, for both you -- because nobody can help you, and you just have to come back and post the real thing anyway -- and everyone else -- because we have to spend time looking at your useless fake code and telling you to post your real code. :(

I guess I wasn't clear when I said these events are using kgpanels events to make fake buttons, and this is my real and entire code. that's the reason it has escapes, because i'm reading it from the kgpanels config lua file, the two big blobs of text you see on the right are the code for 2 buttons. The code is exactly the same except for one button uses ChatFrame3 and the other uses ChatFrame4.

I cleaned it up again.

Lua Code:
  1. --[[ LOAD EVENT --]]
  2. HackTabs = HackTabs or {}
  3. local tab = GetClickFrame("ChatFrame3Tab")
  4. tab:Hide()
  5. local Frame = GetClickFrame("ChatFrame3")
  6.  
  7. HackTabs.ChatFrame3 = {
  8.     Frame = Frame,
  9.     Parent=Frame:GetParent(),
  10.     Tab = tab,
  11. }
  12. for k,v in pairs(HackTabs) do
  13.     if not (v.Frame == Frame) then
  14.         --v.Frame:SetParent(nil)
  15.         -- v.Frame:Hide()
  16.     end
  17. end
  18.  
  19. --[[CLICK EVENT--]]
  20.  
  21. local Frame = HackTabs.ChatFrame3
  22.  
  23. Frame.Frame:SetParent(Frame.Parent)
  24. Frame.Frame:Show()
  25.  
  26. for k,v in pairs(HackTabs) do
  27.     if not (v == Frame) then
  28.         v.Frame:SetParent(nil)
  29.         v.Frame:Hide()
  30.     end
  31. end
  32.  
  33. --[[UPDATE EVENT --]]
  34. HackTabs.ChatFrame3.Tab:Show()

Edit:
I deeply apologize for wasting your time, it turns out it was an error with Chatter, and not my code, sorry. But if anyone does want to help more pointing me in the right direction to where I can learn to make a full blown addon would be great.

Edit2:
I would also appreciate it if anyone told me how I can set channel filters through lua, so i can have lua hide and set up filters (like guild chat, officer chat) on chat frames.

Phanx 12-13-12 10:52 PM

For message types:
  • ChatFrame_AddMessageGroup(ChatFrame1, "GUILD")
  • ChatFrame_RemoveMessageGroup(ChatFrame1, "RAID")

For individual numbered channels (eg. trade, general):
  • ChatFrame_AddChannel(ChatFrame1, "Trade")
  • ChatFrame_RemoveChannel(ChatFrame1, "General")

Note that for both, the first argument must be a reference to the chat frame you want to affect, not a string containing its name.


All times are GMT -6. The time now is 09:41 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI