Doubt with regexp

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

Message
Author
Pachu
Plain Yogurt
Plain Yogurt
Posts: 55
Joined: 04 Apr 2008, 14:21
Noob?: No

Doubt with regexp

#1 Post 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.

Mortimal
Developers
Developers
Posts: 389
Joined: 01 Nov 2008, 15:31
Noob?: No

Re: Doubt with regexp

#2 Post 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)\*/
Please use pin function for uploading your file contents!

Pachu
Plain Yogurt
Plain Yogurt
Posts: 55
Joined: 04 Apr 2008, 14:21
Noob?: No

Re: Doubt with regexp

#3 Post 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

Post Reply