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 ➜ Trigger help

Trigger help

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


Posted by Assassin   (73 posts)  Bio
Date Fri 19 Mar 2004 12:22 AM (UTC)

Amended on Fri 19 Mar 2004 12:49 AM (UTC) by Assassin

Message
* the * * has just left

*>Bob the builder has just arrived
*>Bob the builder has just left

Its capturing *> and storing that to my variable.

How can i avoid this?

Also when im attacked by a dog

Output says You are attacked by the dog!

Again its storing ! along with dog, how can i stop this
too

Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #1 on Fri 19 Mar 2004 06:12 AM (UTC)
Message
The easiest and most effective way is to make your triggers more precise. If you know the punctualtion will always be at the beginning or end of a line, modify the trigger to include the punctuation.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 19 Mar 2004 09:04 PM (UTC)
Message
Click on "convert to regular expression". For your example that gives this:


^(.*?) the (.*?) (.*?) has just left$


Then you can make it more precise. For example an optional thing like *> could be added at the start:


^(?:\*\>)?(.*?) the (.*?) (.*?) has just left$



The extra bit I added (in bold) looks for 0 or 1 occurrence of *>. I "escaped" them with a backslash because the * (at least) has a special meaning in regular expressions. The ?: at the start says to not make it a wildcard (so wildcard %1 is still the same thing).

Read up here:


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



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


13,850 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.