There’s been a chat hiding macro floating about for a while, and while it’s lovely as a macro; I feel like it’d be easier to use as a slash command. I think this is what it would look like as a lua format, but I’ve just been trying to wrap my head around making it a slash command. Some help would be very much appreciated! 
_CHATHIDE = not _CHATHIDE
for i = 1, NUM_CHAT_WINDOWS do
for _,v in pairs{"",“Tab”} do
local f = _G[“ChatFrame”…i…v]
if _CHATHIDE then
f.v = f:IsVisible()
end
f.ORShow = f.ORShow or f.Show
f.Show = _CHATHIDE and f.Hide or f.ORShow
if f.v then
f:Show()
end
end
end
I haven’t verified the content of the code but to turn it into a shash command, paste the following into the website addon.bool.no, change the name of the addon to something other than “MyFirstAddon”, press the “Create my addon and give me my files” button and install like any other addon.
/kc
to use or change /kc to whatever you want, keeping in mind other addon shash commands might overwrite whatever you choose if they load after your addon.
local _CHATHIDE
SLASH_KREDAELCHAT1 = "/kc"
SlashCmdList["KREDAELCHAT"] = function(msg)
_CHATHIDE = not _CHATHIDE
for i = 1, NUM_CHAT_WINDOWS do
for _,v in pairs{"", "Tab"} do
local f = _G["ChatFrame"..i..v]
if _CHATHIDE then
f.v = f:IsVisible()
end
f.ORShow = f.ORShow or f.Show
f.Show = _CHATHIDE and f.Hide or f.ORShow
if f.v then
f:Show()
end
end
end
end
1 Like
It would seem we had similar ideas; I tried this yesterday before coming to the forums and it didn’t seem to work. I’ll try condensing it more if possible and hopefully it’ll work
Do you have the actual working macro?
In a macro form, it’s the same; just condensed to 254 characters
/run _CHATHIDE=not _CHATHIDE for i=1,NUM_CHAT_WINDOWS do for _,v in pairs{"",“Tab”}do local f=_G[“ChatFrame”…i…v]if _CHATHIDE then f.v=f:IsVisible()end f.ORShow=f.ORShow or f.Show f.Show=_CHATHIDE and f.Hide or f.ORShow if f.v then f:Show()end end end
Some characters in your original post are malformed and were copied in mine.
I’ve re-done my original post and it appears to have stuck so copy/paste again.
if _G[“ChatFrame”…i…v] has 2 lots of three dots then it’s wrong and needs changing to 2 and the quotes in the pairs call probably need changing also.
1 Like
That slight edit was all I was missing?! Holy moly… That made it work perfectly. Not really sure how I missed that the whole time… But thank you. I’m gonna try condensing it a bit so it’s a bit cleaner, but this is amazing. Thank you so much!