We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2010
    Location
    your mind
    Posts
    3,880

    Question Lua pattern "not"?

    Setting up an alert in Lotro Alerts...

    I want to match: "defeated" group member name

    I don't want to match: "defeated the" MOB

    I also don't want to match: "defeated" boss name

    So currently I have "defeated %u" setup, which'll match "defeated" Name, but not "defeated the" MOB, which is fairly good, but will have some false alerts. (<--edit, this didn't work, as case currently isn't discriminated in Lotro Alerts, see post #5 below)

    I can't find a "not" ability in Lua patterns from my web searching. Does anyone with more experience know of such? Optimally it would be "defeated" excluding/not " the ".



    "Sometimes survival comes down to not being hit. Actually, most times." -the chicken skill, Bob and Weave
    Last edited by RJFerret; Apr 21 2012 at 01:27 PM.
    Link to our community LOTRO store google spreadsheet pricelist and conversion rates, please contribute too!: https://goo.gl/wxPqCm

  2. #2

    Re: Lua pattern "not"?

    You might be able to use the set's complement operator ^ to exclude patterns with the word "the" in them.

    For example:
    Code:
    defeated [^t][^h][^e]
    this basically translates to:
    • the word defeated
    • followed by anything except a lowercase t (you might be able to stop your pattern here)
    • followed by anything except a lowercase h
    • followed by anything except a lowercase e

    Edit: You actually should just stop your pattern after defeated [^t] since otherwise it might reject players who have an h and e as the second and third characters of their names. Since no player will ever have a name starting with a lowercase t, this pattern should suffice.
    Last edited by Fredelas; Apr 21 2012 at 03:15 AM.

  3. #3

    Re: Lua pattern "not"?

    Yes, but it's incredibly messy.

    Honestly, your easiest solution is just to add alerts for "defeated <player name>" for each player name you're interested in. It's not static, but it'll probably be less work in the long run.

    Your other option is... say you want to exclude "Kalbak". The way to do this is to add seven alerts:

    "defeated [A-JL-Z]"
    "defeated K[^a]"
    "defeated Ka[^l]"
    "defeated Kal[^b]"
    "defeated Kalb[^a]"
    "defeated Kalba[^k]"
    "defeated Kalbak[^%.]"

    And then you'd need to redo those every time you added a name.

    I'm not aware of any other ways to do it, I'm afraid.

  4. #4
    Join Date
    Mar 2007
    Posts
    1,780

    Re: Lua pattern "not"?

    Well for what you want, the best thing I can think of would be:

    "defeated [%a]*%.$"

    That won't match "defeated the ..." (because it includes a space)
    And it won't match on any boss names that include special characters.

    But it should (fingers crossed) match everything else.
    [B]Elendilmir - [COLOR=#3333ff]Evenwyn[/COLOR][/B] Burglar[B] - [COLOR=#3333ff]Evendale[/COLOR][/B] Guardian
    [FONT=Verdana][COLOR=#ff0000][SIZE=2][B]Combat Analysis[/B] [/SIZE][/COLOR][SIZE=2]([B]v4.2.3b[/B]) - [/SIZE][/FONT]Download "[URL="http://www.lotrointerface.com/downloads/info502-CombatAnalysis.html"]here[/URL]"

  5. #5
    Join Date
    Aug 2010
    Location
    your mind
    Posts
    3,880

    Re: Lua pattern "not"?

    Thank you both, I've learned ^ is mostly the "not" operator I was seeking. But only within sets--hence my having missed it. Some documentation refers to it as a complement, which is a confusing use of a sub definition of that word, it makes sense within the context of sets in Lua technically, but beyond that.

    I've also learned that case is apparently stripped in Lotro Alerts currently, as [^t] excluded both t and T. Further testing revealed %l matched everything and %u matched nothing in this version.

    So "defeated%s%a%a%a[^%s]" was necessary to achieve what I first described (I'll edit that post accordingly).

    ([^t][^h][^e] didn't, as that match excluded "joe"--just the first [^t] would have worked, if case did, but currently excludes "Ted" too.)

    Thanks, I've wanted such an operator for other things in the past, so this will help with future alerts too.



    "Sometimes survival comes down to not being hit. Actually, most times." -the chicken skill, Bob and Weave
    Link to our community LOTRO store google spreadsheet pricelist and conversion rates, please contribute too!: https://goo.gl/wxPqCm

  6. #6
    Join Date
    Oct 2011
    Posts
    4,084

    Re: Lua pattern "not"?

    Looks like you're asking about regular expressions, not Lua specifically. You might find http://www.regular-expressions.info/ useful.
    [size=1][i]A spaceship from another star / They ask me where all the people are
    I tell them I'm the only one / There was a war, but I must have won[/i][/size]

  7. #7

    Re: Lua pattern "not"?

    The solution in this case is simple: do not group with players whose names begin with a T, and do not fight bosses whose names begin with T.


  8. #8
    Join Date
    Mar 2007
    Posts
    1,171

    Re: Lua pattern "not"?

    AFAIK there is no way in Lua to specify to not match on a specific token that is longer than a single character other than to create multiple comparisons (as moebius92 suggested with multiple alerts).

    LotRO Alerts will be adding a special token in the future to match against party names and a "Does not match" option to allow creating triggers for when a pattern does not match. I purposely made the pattern matching case insensitive but I can see how in this case that can be a problem. I may add a flag for case sensitivity in the future. I am in the middle of several other projects atm so the next version of LotRO Alerts is probably a month or more away.

    Meanwhile, if you want your copy of LotRO Alerts version 1.04 to be case sensitive, edit main.lua and change line 1972 from
    Code:
    local captures=({string.match(string.lower(args.Message),string.lower(Alerts[tmpIndex][8]))});
    to
    Code:
    local captures=({string.match(args.Message,Alerts[tmpIndex][8])});
    and the %u will work other than for bosses where you will get false matches.
    Last edited by Garan; Apr 21 2012 at 03:25 PM. Reason: typo

  9. #9
    Join Date
    Aug 2010
    Location
    your mind
    Posts
    3,880

    Re: Lua pattern "not"?

    Quote Originally Posted by Nakiami View Post
    Looks like you're asking about regular expressions, not Lua specifically.
    There are differences, and so there are cautions to not conflate the two. I won't pretend to know all the specifics, so am just passing along that caution. A quick search pulled up this page comparing differences: lua-pattern-matching-vs-regular-expressions

    Quote Originally Posted by Garan View Post
    Meanwhile, if you want your copy of LotRO Alerts version 1.04 to be case sensitive, edit main.lua and change line 1972 from...
    Awesome, once again you rock, thank you, but since I share so many patterns, I'll retain the functionality to match the downloaded version compatible with others, rather than trying to remember I modified mine. It's one thing to copy/paste an alert into raid chat, it's entirely another to direct them to edit the code and reload first. ;-) It'll also presumably smooth out upgrading to future versions.



    "Sometimes survival comes down to not being hit. Actually, most times." -the chicken skill, Bob and Weave
    Link to our community LOTRO store google spreadsheet pricelist and conversion rates, please contribute too!: https://goo.gl/wxPqCm

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

This form's session has expired. You need to reload the page.

Reload