Following Calls from Squad?

CrenshawCrenshaw Member Posts: 2 Inept
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

  • AyisdraAyisdra Member Posts: 1,110 Mythical
    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 (.+)\.\"$

  • MakaiMakai Member Posts: 316 Capable
    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.
  • NyanaNyana Member Posts: 10 Inept
    edited June 10
    In addition to what they said, you don't need that many backslashes:

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

    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 (.+)."$ 



  • MakaiMakai Member Posts: 316 Capable
    The blackslashes are to allow perl regex to read it as a character and not part of a function.
  • ChorosChoros Member Posts: 35 Apprentice
    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.
  • NyanaNyana Member Posts: 10 Inept
    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.