WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Clear chat slash command. (https://www.wowinterface.com/forums/showthread.php?t=52673)

Kkthnx 09-02-15 08:00 PM

Quote:

Originally Posted by Lesteryoung (Post 310719)
Thanks kkThnx, the one you posted works the same as Munk's code basically. It clears selected windows without clearing all windows.

For some reason, it clears the combat log fine, but if you tab between the combat log views (What happened to me?) thing it repopulates the data you previously cleared. If this is unavoidable then it's fine, mainly just wanted to clear chat anyway.

Yah, now we can all thank Phanx as usual! Phanx has some pretty neat ways of coding things. You could learn a couple things.

Petrah 09-03-15 06:48 AM

Quote:

Originally Posted by Seerah (Post 310710)
that was Petrah's that he had quoted

Just to clarify, that's not my code. I got it from someone who shared it a very very long time ago on the official forums.

Lombra 09-03-15 09:39 AM

The combat log entries are not stored in the message frame, so to speak, so it can be repopulated again. There seems to be a function CombatLogClearEntries() which sounds like it might do what you want.

Sormon 12-06-23 07:26 AM

Quote:

Originally Posted by Kkthnx (Post 310718)
Here you go

Code:

SLASH_CLEARCHAT1 = "/clear"
SLASH_CLEARCHAT2 = "/clearchat"

SlashCmdList.CLEARCHAT = function(cmd)
        cmd = cmd and strtrim(strlower(cmd))
        for i = 1, NUM_CHAT_WINDOWS do
                local f = _G["ChatFrame"..i]
                if f:IsVisible() or cmd == "all" then
                        f:Clear()
                end
        end
end

I tested this window by window and this is what you are looking for 100%

Credits to Phanx / PhanxChat
https://github.com/Phanx/PhanxChat/b.../Core.lua#L273



How do you actually implement and use this in the game?

Fizzlemizz 12-06-23 08:06 AM

Copy/paste the code to this website to create/download as an addon like any other. Add it to your AddOns folder and login (or /reload).

Type /clear (or /clearchat) in-game to use.


All times are GMT -6. The time now is 12:05 PM.

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