Following Calls from Squad?

Presently, I cannot figure out why I'm not tracking squad target calls during bashing trips...


^(.+)/:/ (.+) says/,/ "TARGET (.+)/./"$


target = matches[4]


And ideas as to if this is just messed up or something?

Comments

  • Crenshaw said:
    Presently, I cannot figure out why I'm not tracking squad target calls during bashing trips...


    ^(.+)/:/ (.+) says/,/ "TARGET (.+)/./"$


    target = matches[4]


    And ideas as to if this is just messed up or something?
    You need to use backslash for escaping:

    ^(.+)\:\ (.+)\ says\, \"TARGET (.+)\.\"$

  • I'd probably write it as:

    ^(.*)\: (.*) says\, \"TARGET (.*)\.\"$

    Which is nearly identical, just one less backslash required than what Ayisdra posted. Both will work, but you will also have to factor in how other people might call, as it is case sensitive. So if for example: (Test Squad): Crenshaws says, "Target astralbeast."

    Then you wouldn't capture it, because it is not in all caps. So you can definitely add to it as you find other people who call things differently.
  • edited June 2019
    In addition to what they said, you don't need that many backslashes:

    ^\(.+\): (.+) says, "TARGET (.+)\."$^((.+)): (.+) says, "TARGET (.+)\."$ or 

    It should still work regardless. The backslashes around that first set of parentheses, though, because you're both capturing it as a variable and the () are part of the trigger line.

    Edit: Sorry, should explain something. If you want to capture the name of the squad(matches[2]) then use the first example I gave, with the double parentheses. If you don't care, then the second will work, but your target will actually be matches[3] instead.

    To avoid the issue of case-sensitivity, you can use something like string.upper(convert some word to uppercase). Or just make two separate trigger lines: ^((.+)): (.+) says, "Target (.+)."$ 



  • The blackslashes are to allow perl regex to read it as a character and not part of a function.
  • I'm not a coder, but I'd like to urge you to make sure you have a way to toggle this on and off, and make sure it isn't targetting off your alliance clan.
    Her voice firm and commanding, Terentia, the Even Bladed says to you, "You have kept your oath to Me, Parhelion. You have sworn to maintain Justice in these troubled times."

    Yet if a boon be granted me, unworthy as I am, let it be for a steady hand with a clear eye and a fury most inflaming.
  • Makai said:
    The blackslashes are to allow perl regex to read it as a character and not part of a function.
    Sort of, it's an escape character that says either 'this next character is special syntax' or 'this next character should not be read as special syntax.' If the next character won't be read as special regardless - Quotes, colons, commas - then you shouldn't need to use them. It won't be wrong, but unnecessary. A function is something else.

    Choros makes a good point.
Sign In or Register to comment.