Register forum user name Search FAQ

Gammon Forum

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 ➜ MUSHclient ➜ General ➜ Regular Expressions

Regular Expressions

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Toruk   (15 posts)  Bio
Date Tue 22 Apr 2008 12:23 PM (UTC)

Amended on Tue 22 Apr 2008 12:30 PM (UTC) by Toruk

Message
Can Anyone explain to me what I'm doing wrong on this expression

I want it to send a page to me if someone else other then Jordan sends me a tell..

If I take out (?!Jordan ) the expression works fine.
And Yes i know its matching my prompt. I cant get it to work with out having it match my Prompt. ^ wouldnt work at all. But it's fine that it matches my prompt because I only want this trigger to run when im crafting and I will have full health when Im crafting.

<triggers>
<trigger
enabled="y"
match="698H 717M 947S &gt; (?!Jordan ) (\w*) (gossips|say|states|tells you)\, '(.*?)$"
regexp="y"
sequence="100"
>
<send>Page Joe
</send>
</trigger>
</triggers>

Heres a line from the game


698H 717M 947S > Jordan tells you, 'I'll give you 50000 coins for that'
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 22 Apr 2008 09:13 PM (UTC)

Amended on Tue 22 Apr 2008 09:15 PM (UTC) by Nick Gammon

Message
Check out this page for a description of how to do exactly that:

http://www.gammon.com.au/regexp

Scroll down to where it says "Negative lookbehind assertions".

The example given there is similar to what you are doing. With a bit of re-arranging it works fine:


<triggers>
  <trigger
   enabled="y"
   match="698H 717M 947S &gt; (\w+)(?&lt;!Jordan) (gossips|say|states|tells you)\, '(.*?)$"
   regexp="y"
   sequence="100"
  >
  <send>Page Joe
</send>
  </trigger>
</triggers>



However you should be able to get rid of the prompt numbers. Won't that be a hassle when your max health changes?

Just replace each of the numbers with \d+ - that means one or more digits. Then it will match on any numbers.


<triggers>
  <trigger
   enabled="y"
   match="\d+H \d+M \d+S &gt; (\w+)(?&lt;!Jordan) (gossips|say|states|tells you)\, '(.*?)$"
   regexp="y"
   sequence="100"
  >
  <send>Page Joe
</send>
  </trigger>
</triggers>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Toruk   (15 posts)  Bio
Date Reply #2 on Tue 22 Apr 2008 09:19 PM (UTC)
Message
Ah works like a charm

and thanks for the page on regexp I think it will help alot more then what i seen under scripting.
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.


15,764 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.