Openkore.com
http://forums.openkore.com/

Doubt with regexp
http://forums.openkore.com/viewtopic.php?f=32&t=212331
Page 1 of 1

Author:  Pachu [ 15 Sep 2017, 17:57 ]
Post subject:  Doubt with regexp

I have the following automacro

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

Author:  Mortimal [ 16 Sep 2017, 15:44 ]
Post subject:  Re: Doubt with regexp

Code:
/\[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:
/\[dist=(.*)\] (.*) \((\d+)\):\s*\*(asp|aspersio|holy|asper|aspe)\*/

Author:  Pachu [ 16 Sep 2017, 21:58 ]
Post subject:  Re: Doubt with regexp

i tried your modifications and the macro stopped working at all. after several tries, i ended up with

Code:
/\[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

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/