Clear chat slash command.
I'm trying to create a command function that simply clears the chat that you currently have selected, whether it be the combat log or the main chat or any other chat frame.
This is what I have, but the code is off. Code:
SlashCmdList["CLEAR"] = function() SELECTED_CHAT_FRAME() end |
Quote:
Code:
SlashCmdList.CLEAR_CHAT = function() https://github.com/Kkthnx/KkthnxUI/b...e/Commands.lua |
This is what I'm currently using. Someone shared it on a forum, I think it was the official forums, but I cannot recall who. I've been using it for quite a long time added in one of the files for ElvUI.
Code:
SlashCmdList["CLEAR"] = function() |
seems kinda gross to add 255 blank messages rather than simply clearing them
|
Quote:
Lua Code:
|
http://wow.curseforge.com/addons/cle...earing-method/ (couple years back since I submitted this but I expect it still works)
|
Quote:
|
I'm no longer playing, but have you tested it?
I'd been using it for quite a while with no issues, I don't think chatcode has changed significantly. |
As expected:
Quote:
|
Quote:
As an example, when you create a frame or button, it will inherit a lot of global functions which can be used to modify the widget, but these functions expect the widget to pass itself as the first argument. This is what the colon operator does in lua. What you attempt to do in that snippet is call the function Clear() that is attached to SELECTED_CHAT_FRAME, without giving the function the actual frame that you intend to clear. Example of difference between dot and colon operator: Lua Code:
|
I have no reason to doubt my version is broken now, but it was absolutely working in 50200 (and for a while before that).
|
Been using MunkDev's version and it works fine. Is this the preferable way to clear chat? Obviously creating 255 blank lines seem egregious.
Only complaint is that it doesn't clear the combat log when it's selected. There's a code floating around on arenajunkies but it doesn't work either. They must have changed chat API within the last few years. |
Quote:
Here I'll post it again and quote myself. Quote:
|
Quote:
Take another look at MunkDev's actual posted solution. Quote:
|
Quote:
|
Seerah, I did use MunkDev's code, and it work's fine on chat but doesn't clear the combat log.
The one kkthnx posted clears all chats, not the one you have selected. And the one Petrah posted creates 255 blank lines which everyone has said is stupid. |
Quote:
|
It clears the combat for about a second, and then the data just repopulates instantly.
And if you have the combat log targeted and /clear, it clears all other windows as well. So far MunkDev's code has worked the best, in that it only clears selected windows, but among them can't be the combat log for some reason. |
Quote:
Code:
SLASH_CLEARCHAT1 = "/clear" Credits to Phanx / PhanxChat https://github.com/Phanx/PhanxChat/b.../Core.lua#L273 |
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. |
All times are GMT -6. The time now is 12:39 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI