Results 1 to 14 of 14

Thread: Can you use regex in zone alert files?

  1. #1
    Registered User
    Join Date
    Nov 2019
    Posts
    8

    Can you use regex in zone alert files?

    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:

    Code:
                    if (MatchFullText)
                    {
                        if (string.Compare(mobname, str, true) == 0)
                            matched = true;
                    }
                    else if (isSubstring(mobname, str))
                    {
                        matched = true;
                    }
    And the code for isSubstring:

    Code:
            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:

    Code:
        <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?

  2. #2
    Registered User
    Join Date
    Dec 2020
    Posts
    121

    Re: Can you use regex in zone alert files?

    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.

  3. #3
    Registered User
    Join Date
    Nov 2019
    Posts
    8

    Re: Can you use regex in zone alert files?

    This doesn't work either

    Code:
        <section name="Alert">
    ^Saryrn
        </section>

  4. #4
    Registered User
    Join Date
    Dec 2020
    Posts
    121

    Re: Can you use regex in zone alert files?

    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.

  5. #5
    Registered User
    Join Date
    Nov 2019
    Posts
    8

    Re: Can you use regex in zone alert files?

    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"

  6. #6
    Registered User
    Join Date
    Dec 2020
    Posts
    121

    Re: Can you use regex in zone alert files?

    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.

  7. #7
    Registered User
    Join Date
    Dec 2020
    Posts
    121

    Re: Can you use regex in zone alert files?

    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.
    Last edited by eqDialup; 01-17-2022 at 09:51 AM.

  8. #8
    Registered User
    Join Date
    Dec 2020
    Posts
    121

    Re: Can you use regex in zone alert files?

    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.

  9. #9
    Registered User
    Join Date
    Nov 2019
    Posts
    8

    Re: Can you use regex in zone alert files?

    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?

  10. #10
    Registered User
    Join Date
    Nov 2019
    Posts
    8

    Re: Can you use regex in zone alert files?

    wow, it really deleted all of my line breaks. and the edit page isn't loading correctly for me to fix it...

  11. #11
    Registered User
    Join Date
    Nov 2019
    Posts
    8

    Re: Can you use regex in zone alert files?

    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.

  12. #12
    Registered User
    Join Date
    Nov 2019
    Posts
    8

    Re: Can you use regex in zone alert files?

    Actually, it is working now. It looks like I just had to restart the client after changing that option.

  13. #13
    Registered User
    Join Date
    Dec 2020
    Posts
    121

    Re: Can you use regex in zone alert files?

    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.

  14. #14
    Registered User
    Join Date
    Dec 2020
    Posts
    121

    Re: Can you use regex in zone alert files?

    Add this to line 1176 of EQData.cs

    Code:
                SetListColors(si);
    Old:

    Code:
                si.refresh = new Random().Next(0, 10);
    
    
                si.listitem = listView;
                return listView;
    New:
    Code:
                si.refresh = new Random().Next(0, 10);
    
    
                si.listitem = listView;
                SetListColors(si);
                return listView;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

You may post new threads
You may post replies
You may post attachments
You may edit your posts
HTML code is Off
vB code is On
Smilies are On
[IMG] code is On