Thread Tools Display Modes
09-02-15, 08:00 PM   #21
Kkthnx
A Cobalt Mageweaver
 
Kkthnx's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2011
Posts: 247
Originally Posted by Lesteryoung View Post
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.
__________________
Success isn't what you've done compared to others. Success is what you've done compared to what you were made to do.
  Reply With Quote
09-03-15, 06:48 AM   #22
Petrah
A Pyroguard Emberseer
 
Petrah's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2008
Posts: 2,988
Originally Posted by Seerah View Post
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.
__________________
♪~ ( ) I My Sonos!
AddOn Authors: If your addon spams the chat box with "Addon v8.3.4.5.3 now loaded!", please add an option to disable it!
  Reply With Quote
09-03-15, 09:39 AM   #23
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
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.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
12-06-23, 07:26 AM   #24
Sormon
A Kobold Labourer
Join Date: Dec 2023
Posts: 1
Originally Posted by Kkthnx View Post
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?
  Reply With Quote
12-06-23, 08:06 AM   #25
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
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.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 12-06-23 at 08:58 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Clear chat slash command.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off