View Full Version : Can you use regex in zone alert files?
grundy
01-15-2022, 11:47 AM
I tried creating an alert for Saryrn in potorment, but it's not useful because there are a ton of mobs in the zone named "a servant of Saryrn" so there are tons of false positive matches.
I could turn on exact matching in the options, but I don't want to do that because there are other occasions where I do want partial matches.
But I looked at the code for MySEQ and it looks like it is supposed to be using regex to match names if exact match is turned off:
if (MatchFullText)
{
if (string.Compare(mobname, str, true) == 0)
matched = true;
}
else if (isSubstring(mobname, str))
{
matched = true;
}
And the code for isSubstring:
private bool isSubstring(string toSearch, string forSearch)
{
// Compile the regular expression.
Regex regEx = new Regex(".*" + forSearch + ".*", RegexOptions.IgnoreCase);
// Match the regular expression pattern against a text string.
return regEx.Match(toSearch).Success;
}
So I tried making this alert:
<section name="Alert">
<oldfilter><regex>Name:^Saryrn</regex></oldfilter>
</section>
This should be creating a Regex object with the pattern ".*^Saryrn.*" and that pattern does match the string "Saryrn", so theoretically this should work, but it does not. What am I doing wrong?
eqDialup
01-15-2022, 01:40 PM
Remove the oldfilter, regex, and name: portions so that it just looks like this
^Saryrn
See if that helps. I won't be able to test it until tomorrow morning if that doesn't fix it.
grundy
01-15-2022, 04:10 PM
This doesn't work either
<section name="Alert">
^Saryrn
</section>
eqDialup
01-16-2022, 08:56 AM
Bug in the options dialogs. As part of some code modernization efforts, the options dialogs were changed to store the preferences in a new way. Not everything looks to have been completely converted. I had fixed the one that was bothering me (the map circle) but I'll go through them all tonight and verify that they have been converted and I'll push up a fix for you tonight or tomorrow.
grundy
01-17-2022, 04:46 AM
I don't know about that... If the issue is that it wasn't reading the options correctly so MatchFullText was getting set to true instead of reading in false from the options, then it would be searching for an exact match already and "Saryrn" wouldn't be matching on "a servant of Saryrn"
eqDialup
01-17-2022, 08:23 AM
Good point. I don't think we are matched up on the versions we are using. The code you have above doesn't quite match what I have and what's showing in git. Also you are implying that the option is sticking for you. For me, I can't get them to stick. I'm fixing all the options now, and then I have a place to test your issue. As soon as I get options working, I'll start testing that.
And thanks for testing and using the github version. I've been meaning to clean this up and package it up, but life has been busy. With 64 bit around the corner, I don't have much choice now. Need to get it done.
eqDialup
01-17-2022, 09:11 AM
Just a note - fixed the save on the match in my version, and your regex works as you expect it to. I'm working on the rest of the fields now. I did notice that my fix for the maps makes them render better, but still have color issues. I'm looking at that as well.
Doh - the force distinct setting on the map is controlling the colors. Turn it off and everything is fine.
eqDialup
01-17-2022, 10:14 AM
If you pull/build again, does that fix your issue? I've done all the easy objects, going to go back and work on the harder ones now. Note - Don't use the server that this builds. It has some initial 64 bit changes that cause issues. You will need to continue to use the precompiled server for now.
grundy
01-17-2022, 12:15 PM
Do you mean download the code from https://github.com/eqdialup/MySEQ? I downloaded that and built it and the options are saving, but the filter still isn't working.File > Options > Filters > Rare, unchecked Match Full Text. Save. When I go back into options I can verify that it did save.But now I'm not able to match any filters unless they are an exact match. For example, "Saryrn" no longer matches on "a servant of Saryrn" like I would expect, and "^Saryrn" still does not match on "Saryrn". In PoK if I add a rare filter for "Aid", I would expect this to match on "Aid Eino", "Aid Fimli", "Aid Garuuk", and "Aid Grimel", but it's not matching on any of them.I do see correct map colors when I turn off Force Distinct Lines, so that's cool.The Spawn List seems to have changed con colors. Even cons are now white text, but the background is white so it can't be seen. If I change the background color to black (File > Options > Colors > List Background) then the black text in Spawn Timer List & Ground Items is no longer visible. Mobs that are very low level are grey so a grey background doesn't work either. Can't find a background color that makes everything visible. Is there an option to turn even cons back to black that I'm not aware of? (Map > Con Colors > Default, SoD / Titanium, Secrets of Faydwer; all 3 options now show white for even cons). What background color do you use to see everything?
grundy
01-17-2022, 12:17 PM
wow, it really deleted all of my line breaks. and the edit page isn't loading correctly for me to fix it...
grundy
01-17-2022, 12:31 PM
So when I open options it appears to be saving my settings, but it looks like it's not actually reading the settings when it's looking for filter matches. The checkbox is saving as unchecked in options, but FullTxtA is still true when i debug it and put a breakpoint there. I'm not really sure how to fix that i don't get how settings are loaded.
grundy
01-17-2022, 12:37 PM
Actually, it is working now. It looks like I just had to restart the client after changing that option.
eqDialup
01-17-2022, 01:47 PM
To be honest I haven't been using this version because of the spawn colors. When I first merged it last year, it was right around an expansion release, and I didn't have time to look at it. It's on my list now.
Thanks again for all the good feedback. Making it easy to prioritize and tackle these issues. Rather do it now than later when everyone has to update due to 64 bit.
eqDialup
01-17-2022, 02:19 PM
Add this to line 1176 of EQData.cs
SetListColors(si);
Old:
si.refresh = new Random().Next(0, 10);
si.listitem = listView;
return listView;
New:
si.refresh = new Random().Next(0, 10);
si.listitem = listView;
SetListColors(si);
return listView;
Powered by vBulletin® Version 4.1.11 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.