Problems matching pattern

Posted by Ashass on Fri 03 Oct 2008 10:16 PM — 7 posts, 25,162 views.

#0
I'm having problems matching my patterns again, I managed to get them working before, but this time my prompt is (slightly) more complex, and I'm failing pretty hard.

Here is my prompt:
<1803/1803hp, 570/570m, 406/406mv, (Chamber of Rest)[SWD]> 8:00pm. 


Where the hp, m, mv, stuff withing (...)[...], time can all change.

(The parenthesis around chamber of rest NEVER change, and neither do brackets around SWD)

Here is my regular expression:
<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   inverse="y"
   keep_evaluating="y"
   match="^\&lt;(.*?)\/(.*?)hp\, (.*?)\/(.*?)m\, (.*?)\/(.*?)mv\, (.*?)\&gt; (?&lt;hour&gt;\d+)\:(?&lt;minute&gt;\d+)(am|pm)\. (.*?)$"
   match_inverse="y"
   regexp="y"
   send_to="12"
   sequence="100"
   variable="health"
  >
  <send>if %&lt;hour&gt; ~= old_hour or
%&lt;minute&gt; ~= old_minute then
old_hour = %&lt;hour&gt;
old_minute = %&lt;minute&gt;
DoAfterNote (34, "TICK IN 7 SECONDS!") -- 7 seconds warning
end -- if</send>
  </trigger>
</triggers>



Any suggestions?
Netherlands #1
Try:

match="^&lt;(\d+)/(\d+)hp, (\d+)/(\d+)m, (\d+)/(\d+)mv, \((.*)\)\[(.*)\]\&gt; (?&lt;hour&gt;\d+)\:(?&lt;minute&gt;\d+)(am|pm)\. (.*?)$"

I adjusted it a bit without testing, but I think it should work now.
#2
Doesn't seem to work =/
Australia Forum Administrator #3
This worked for me:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   keep_evaluating="y"


match="^\&lt;(\d+)\/(\d+)hp\, (\d+)\/(\d+)m\, (\d+)\/(\d+)mv\, (.*)\&gt; (?&lt;hour&gt;\d+)\:(?&lt;minute&gt;\d+)(am|pm)\."


   regexp="y"
   send_to="12"
   sequence="100"
   variable="health"
  >
  <send>if %&lt;hour&gt; ~= old_hour or
%&lt;minute&gt; ~= old_minute then
old_hour = %&lt;hour&gt;
old_minute = %&lt;minute&gt;
DoAfterNote (34, "TICK IN 7 SECONDS!") -- 7 seconds warning
end -- if</send>
  </trigger>
</triggers>


Note that you are matching on inverse text - I cleared that flag so that the text I copied and pasted worked.
#4
Absolutely awesome, its working again =D
#5
Hmm came across this thread when trying to make my own tick timer - and realised that the OP was trying to write one for the same Mud i play..

What would I need to edit to make this work with my Prompt?

example:

<1596/1596hp 304/304m 376/376mv 11:00am>
Shalonesti Storehouse (WD) -Defensive-

I figure I could trigger just off the first line right?
Australia Forum Administrator #6
The first line should be fine. The simplest thing is to make a non regular expression (standard trigger) from a copy of your prompt, substituting an * for anything that might change.