Page 1 of 1

Doubt with regexp

Posted: 15 Sep 2017, 17:57
by Pachu
I have the following automacro

Code: Select all

automacro AspersioOthers {
   console /\[dist=(.*)\] (.*) \((\d+)\): \*asp|aspersio|holy|asper|aspe\*$/
   status Blessing
   status Increase AGI
   sp > 30%
   run-once 1
   timeout 30
   exclusive 1
   overrideAI 1
   call {
      do ai manual
      $dist = $.lastMatch1
      if ($dist > 6) stop

      $name = $.lastMatch2
      $PlayerID = $.lastMatch3
      pause 1
      do sp 68 $PlayerID 5
      log  Finish macro: AspersioOthers at $.datetime
      pause 1
      do ai on
      release AspersioOthers
   }
}
The macro works fine except if the entered text is "asp" or "aspe" (forgot to try with "holy"). The same happens with an automacro that buffs, it works with many variations except, for example, "agi". Is there any way to make it work with "asp", etc?


Thanks.

Re: Doubt with regexp

Posted: 16 Sep 2017, 15:44
by Mortimal

Code: Select all

/\[dist=(.*)\] (.*) \((\d+)\): \*asp|aspersio|holy|asper|aspe\*$/
this is incorrect....
1.| splits parts only inside () else it splits all message...
2. use \s* as replacement for possible spaces
3. do u really need \* there? cause it will trigger only like *holy* message
4. $ is not really needed there...

Code: Select all

/\[dist=(.*)\] (.*) \((\d+)\):\s*\*(asp|aspersio|holy|asper|aspe)\*/

Re: Doubt with regexp

Posted: 16 Sep 2017, 21:58
by Pachu
i tried your modifications and the macro stopped working at all. after several tries, i ended up with

Code: Select all

/\[dist=(.*)\] (.*) \((\d+)\): (asp|aspersio|holy|asper|aspe)/

which is the simplest way to go. that happens when you base your macro on an old macro