🧙‍♂️ Brought to you by Peptides.gg — Use code UO20 for 20% off — GLP-1's, 90+ Peptides and more!

Improved Chat Filter

Started by Necronom · 2024-10-23 · 32 posts · General Discussions
#0
Would it be possible to add in a filter for system messages? Filling out BoDs and other things causes a whole lot of spam. There isn't a filter for that, but for other things. Unless I'm missing what option those system messages are considered as?

Thanks thanks.
#1
You can filter chats in Agents meny - > Chat - > you can add filters by type/hue/name/serial/textType/font  - just follow pattern: TYPE OF FILTER =! "TYPE OF MSG" and .....

Open picture in another tab and zoom in or click on miniature below.
#2
Hiya Garret...
I'm guessing that is ClassicUO? Thanks though. I may try it...

Well, I should've specified what client I'm talking about.  It's the Enhanced Client. We can have multiple chat window tabs, but all the tabs would basically be the same. Make 1 tab Guild Chat and another for Party. We would still have to filter system messages with our eyes trying to find any chat messages in every tab.
#3
Oh ye sorry for some reason i thought u asking about web client.
#4
I could for sure do without spam like this. I've no idea if there's a way in CC to weed any of this type spam out or not.
#5
As far as I know there's no way to filter out system messages in either client.
#6
Ok, thanks, Mariah. Would for sure be nice to get rid of it. Especially when in NL there's so much chat where players are trying to share info. Really hard to catch it with constant spam of system messages like this.
#7
In EC you can filter system messages on and off??
#8
McDougle said:
In EC you can filter system messages on and off??

Not that I'm aware. Where is that? or do you mean EC with Pinco's?
#9
Just regular ec right or left click on the chat box
#10
Hmm hmm, and where does it say 'system'?


#11
If you right click left click instead 
#12
This one?
 
Lets you switch between tabs, however system messages appear in both tabs. I can find no way to turn system messages off, which is probably for the best or you would miss things like server down messages.
#13
When fishing I have to change it to system to see it say the fish aren't biting in chat log 
#14
This isn't a new legacy specific response...

You can do pretty much any amount of filtering as you want in EC, as well as changing what things trigger a more visible centered notification with sounds.

Here are some examples:

You can filter out some of the mining messages, similiar to the comment re: dropping the "Very well" spam from commanded undead.  Some example message numbers below.

501869 You loosen some rocks but fail to find any useable ore.
503043 You loosen some rocks but fail to find any useable ore.
1156509 You loosen some dirt but fail to find anything.
1157039 You loosen some rocks but fail to find any useable granite.

#15
Well, you're just talking futuristic space talk now, FF.

I get nervous at the thought of messing with files but I’ll poke around and take a look. Thanks very much @ForeverFun for taking the time to put the info together. 
#16
This isn't a new legacy specific response...

<snip snip>

Thank you very much ForeverFun.

I remember using some of your coding for center text/sound for artifact drops. Wasn't aware that we could control the system messages to this extent. Makes me want to dig back into programming. I'll see how to get the TextID for specific system messages and try to filter it out per your "Very well" coding.

Thanks again!
#17
This isn't a new legacy specific response...

You can do pretty much any amount of filtering as you want in EC, as well as changing what things trigger a more visible centered notification with sounds.
<snip snip>

Okay, unfortunately I am stumped. Not entirely sure where to place the text to add the SystemData.TextID to the actual text that is sent to the window or wherever. I've been trying it in the TextParsing.lua file in every function but it's not working. Heh.. I used

SystemData.Text = SystemData.TextID .. " " .. SystemData.Text

Doesn't seem to work... heh...

#18
If you put this at the top of TextParsing.CenterScreenText(), it will (redundantly) print each system message and the ID for that message.  You'd need to pick the right place to take action on the message (use the ID if applicable), depending on what effect you're trying to obtain (TextParsing.lua, overheadtext.lua, newchatwindow.lua, etc).

Many of the strings are unicode, hence the wstring (instead of string), and L prefix.


	if( SystemData.TextID ~= nil) then
Debug.PrintToChat(towstring(SystemData.TextID).. L" ".. SystemData.Text)
end

Also, note the logic here:

function TextParsing.IgnoreTextManager()

-- 502002 handled in overheadtext.lua ("Very Well." command undead).
if( SystemData.TextID == 502002 ) then
SystemData.Text = L""
return true
end


#19

Thank you! Yes, I was using the Debug.PrintToChat() function, but couldn't get it to work. Also, wasn't sure where to place that line.. Much appreciated.
#20

Hey there... Well, at this moment, something doesn't seem to be working. Heh. I've placed the Debug statement in the CenterScreenText() function and for some reason, it only prints the TextID and not the actual Text. It's blank after the ID.

Also, I placed the other if statement in the IgnoreTextManager() function with a Debug statement and it's not even going into the if statement. Not entirely sure why. It is exactly as you have it above, with the appropriate Unicode and the extra Debug statement.

Thanks in advance.

Sidenote: I have it loading as a separate Custom UI.
#21
@Mariah, can you move this to the general discussion forum?

Also, the EC does have some builtin cases where filtering drops messages on the floor - related to casting and perfection, see
TextParsing.IgnoreTextManager()

necronom, technically SystemData.Text can be nil or an empty UNICODE (wide) string.  Though that would be unusual.

Perhaps you aren't using the L prefix still, from your original post, notice there is no L in front of " ".  Your line below definitely won't work because of that.

SystemData.Text = SystemData.TextID .. " " .. SystemData.Text

Notice the usage of L" " here:

if( SystemData.TextID ~= nil) then
Debug.PrintToChat(towstring(SystemData.TextID).. L" ".. SystemData.Text)
end

Best to assume strings are handled as UNICODE / WIDE / WSTRING.  See:

Debug.PrintToChat(L"type " .. towstring(type(SystemData.Text)))

Many of the strings are unicode, hence the wstring (instead of string), and L prefix.


#22
Well, these are what I have..

function TextParsing.CenterScreenText()

if( SystemData.TextID ~= nil) then
Debug.PrintToChat(towstring(SystemData.TextID).. L" ".. SystemData.Text)
end
function TextParsing.IgnoreTextManager()

if ( SystemData.TextID == 1045169 ) then -- The item is not in the request.
Debug.PrintToChat("Check this: 1045169")
SystemData.Text = L""
return true
end

if (SystemData.TextID == 1045166) then -- The maximum amount of requested items have already been combined to this deed.
Debug.PrintToChat("Check this: 1045166")
SystemData.Text = L""
return true
end

if ( SystemData.TextID == 1045170 ) then -- The item has been combined with the deed.
Debug.PrintToChat("Check this: 1045170")
SystemData.Text = L""
return true
end

Not sure hmm...



#23

None of your "Check this..." strings have the L prefix (for unicode/wide/wstring) in front of them.
Debug.PrintToChat() expects a unicode string as input.

Depending on the context, these are exceptions/faults in the LUA code, and nothing else executes after that in the affected function.
#24

None of your "Check this..." strings have the L prefix (for unicode/wide/wstring) in front of them.
Debug.PrintToChat() expects a unicode string as input.

Depending on the context, these are exceptions/faults in the LUA code, and nothing else executes after that in the affected function.

Ah okay... Well, those statements are now showing in the chat window thanks, but it's still printing out the stuff I'm trying to ignore or not have show up... Hmm I'll see if I can find the right spot. Thanks again ForeverFun.

Btw, the statement actually prints first before everything else in the TextParsing.lua that I've edited in.

<statement>
Check this: Unicode (IgnoreTextManager() entry)
Unicode (CenterScreenText() entry)

So it's being printed before it processes functions in TextParsing.lua...
#25
Yes, the handling for dropping the "Very well" spam from undead followers just drops the overhead text over the animal.

EC has a global way to filter all the system messages, in the UI, but that's disabled by default.
If you want that setting in the UI, as an option for each tab window, you can change 3 lines in chatsettings.lua:

 --   ChatSettings.Channels[ SystemData.ChatLogFilters.SYSTEM ]        = ChatChannel( L"System",         SystemData.ChatLogFilters.SYSTEM,             "Chat",     true,           true,                true,		ChannelColor(255, 255, 255) )    
ChatSettings.Channels[ SystemData.ChatLogFilters.SYSTEM ] = ChatChannel( L"System", SystemData.ChatLogFilters.SYSTEM, "Chat", true, true, false, ChannelColor(255, 255, 255) )

ChatSettings.Ordering = {
SystemData.ChatLogFilters.SYSTEM, -- remove comment out
ChatSettings.Colors = {
{r=235, g=235, b=235, id=1}, -- remove comment out

That's not strictly needed, as you can change it on the fly per below.

In my case, I have a custom chat window named "ChatWindow2"  replace that part of the string below for the window you want to influence:

LogDisplaySetFilterState("ChatWindow2ChatLogDisplay", "Chat", 1, true) -- enable logging of system:
LogDisplaySetFilterState("ChatWindow2ChatLogDisplay", "Chat", 1, false) -- disable logging of system:


"ChatWindowChatLogDisplay" is the name of the window for the default/initial chat tab.

If you disable the system messages by default, you can then delegate printing all of them yourself, except the ones you want to filter out.  I didn't see an obvious better way to do this, maybe somebody else will chime in.  See this as a rough example fragment inserted into IgnoreTextManager(), which I've used for 5 minutes, so use at own risk/etc.


TextParsing.FilteringSystem = nil
function TextParsing.IgnoreTextManager()
    if(TextParsing.FilteringSystem == nil) then
        LogDisplaySetFilterState("ChatWindow2ChatLogDisplay", "Chat", 1, false)    -- disable logging of System messages, assumes window name is "ChatWindow2"
        TextParsing.FilteringSystem = true
    end
    if( SystemData.TextChannelID == 1 and TextParsing.FilteringSystem == true ) then
        -- choose messages to filter ...
        if(SystemData.TextID == 500119) then    -- must wait to perform another action.
            -- drop message
            SystemData.Text = L""
            return true
        end
    
        -- print other messages.  can lead to redundant messages if other chat windows have system logging enabled.
        Debug.PrintToChat(SystemData.Text)    -- could also use TextLogAddEntry()
    end

#26
Hey there @ForeverFun

I will leave out the Spoiler part... if I get too frustrated with this I'll look at it... Heh...  I made the changes to ChatSettings.lua.  I had to look around for it because it's not in the usual Source folder directly under the UI name folder. I made the changes, and I assume it would be under the Chat Filter context menu part of the Chat Window? The only thing is, I'm not sure about how to get it to load with my custom UI.

I have tried to copy the Default folder structure as in:
New Legacy UI\Source\TextParsing.lua
New Legacy UI\UO_ChatWindow\Source\ChatSettings.lua

However, my edited ChatSettings.lua file is not being loaded. I changed the display name for one of the fonts and commented the original out, but it hasn't changed. I've tried placing ChatSettings.lua in the same folder as TextParsing.lua but it still isn't loading.

Do I need to add it into the Script Files section of the interface.xml?

Thanks again!
#27
The short answer:
  1. I have limited time 🙂
  2. The sample in the spoiler does work without the ChatSettings.lua change.
  3. Issuing these directly in the chat window, or via Actions->Other->Command works to enable overall system message filtering, again, no chatsettings.lua change needed.
LogDisplaySetFilterState("ChatWindow2ChatLogDisplay", "Chat", 1, true) -- enable logging of system:
LogDisplaySetFilterState("ChatWindow2ChatLogDisplay", "Chat", 1, false) -- disable logging of system:

in chat window:
/script LogDisplaySetFilterState("ChatWindow2ChatLogDisplay", "Chat", 1, false) -- disable logging of system:

in Actions->Other->Command
script LogDisplaySetFilterState("ChatWindow2ChatLogDisplay", "Chat", 1, false) -- disable logging of system:


The longer answer:
  1. The UO team may want to investigate if/why certain file[paths] aren't loaded by the CustomUI loader.
  2. The UO team may want to [re]enable the System Logging checkbox in the default UI.  Or at least enable it for custom chat window tabs.  Having all messages except SYSTEM disabled in the System tab is nice QoL change, while other tabs can have SYSTEM disabled (or fine grain filtered, again a nice QoL thing).
  3. The UO team may want to investigate putting the contents of default.zip in github, and then setting up some way of integrating public changes to it.
#28
@ForeverFun Thanks again with the codes. Well, yes I could've used the Spoiler coding, but "... use at your own risk." sounds too ominous. Heh.

Well, when was the last time something was done with the EC coding? Heh...
#29
We aren't exactly talking about the simulation or flight management software of the JWST, so weigh the risk accordingly.  That said, making more aggressive changes in this area (and other areas) seems to have little downside (hint).

Here's a little function that can be added to the end of textparsing.lua, invoke TextParsing.DisableSystemMessage() instead of the  LogDisplaySetFilterState() in the spoiler block above.  This will leave the default system tab alone, and disable system messages in all the other tabs.

function TextParsing.DisableSystemMessage()
    for k, v in pairs(ChatWindow.Windows) do

        local WindowName
        
        if(k == 1) then    -- leave the default systemtab alone.
            continue
        end
        
        if(ChatWindow.Windows[k] == nil or ChatWindow.Windows[k].wndName == nil) then
            continue
        end
        
--        WindowName = "ChatWindow"..tostring(k).."ChatLogDisplay"
        WindowName = ChatWindow.Windows[k].wndName .. "ChatLogDisplay"
        
        LogDisplaySetFilterState(WindowName, "Chat", 1, false)    -- disable channel 1 (system)
--        Debug.PrintToChat(L"Filter system, disabled: ".. towstring(WindowName))
    end
end
#30
Thanks again @ForeverFun ... I think that would make things a bit more flexible. That should be how it is but heh.. oh well..
#31
Well it took me a while to figure out how to make a command button to open the Resource Pack, but I made it work... This is fun heh..
← Browse more General Discussions discussions