Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ Programming
➜ General
➜ Problems matching pattern
|
Problems matching pattern
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Ashass
(50 posts) Bio
|
| Date
| Fri 03 Oct 2008 10:16 PM (UTC) |
| Message
| 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="^\<(.*?)\/(.*?)hp\, (.*?)\/(.*?)m\, (.*?)\/(.*?)mv\, (.*?)\> (?<hour>\d+)\:(?<minute>\d+)(am|pm)\. (.*?)$"
match_inverse="y"
regexp="y"
send_to="12"
sequence="100"
variable="health"
>
<send>if %<hour> ~= old_hour or
%<minute> ~= old_minute then
old_hour = %<hour>
old_minute = %<minute>
DoAfterNote (34, "TICK IN 7 SECONDS!") -- 7 seconds warning
end -- if</send>
</trigger>
</triggers>
Any suggestions? | | Top |
|
| Posted by
| Worstje
Netherlands (899 posts) Bio
|
| Date
| Reply #1 on Sat 04 Oct 2008 12:17 AM (UTC) |
| Message
| Try:
match="^<(\d+)/(\d+)hp, (\d+)/(\d+)m, (\d+)/(\d+)mv, \((.*)\)\[(.*)\]\> (?<hour>\d+)\:(?<minute>\d+)(am|pm)\. (.*?)$"
I adjusted it a bit without testing, but I think it should work now. | | Top |
|
| Posted by
| Ashass
(50 posts) Bio
|
| Date
| Reply #2 on Sat 04 Oct 2008 01:09 AM (UTC) |
| Message
| | Doesn't seem to work =/ | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sat 04 Oct 2008 03:35 AM (UTC) |
| Message
| This worked for me:
<triggers>
<trigger
custom_colour="2"
enabled="y"
keep_evaluating="y"
match="^\<(\d+)\/(\d+)hp\, (\d+)\/(\d+)m\, (\d+)\/(\d+)mv\, (.*)\> (?<hour>\d+)\:(?<minute>\d+)(am|pm)\."
regexp="y"
send_to="12"
sequence="100"
variable="health"
>
<send>if %<hour> ~= old_hour or
%<minute> ~= old_minute then
old_hour = %<hour>
old_minute = %<minute>
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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Ashass
(50 posts) Bio
|
| Date
| Reply #4 on Sat 04 Oct 2008 03:59 AM (UTC) |
| Message
| | Absolutely awesome, its working again =D | | Top |
|
| Posted by
| English Lad
(4 posts) Bio
|
| Date
| Reply #5 on Wed 03 Dec 2008 10:36 AM (UTC) |
| Message
| 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? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Wed 03 Dec 2008 07:26 PM (UTC) |
| Message
| | 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
23,847 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top