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
➜ Wildcard Triggers
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| C
(10 posts) Bio
|
Date
| Mon 21 Jan 2002 08:37 PM (UTC) |
Message
| Hey,
I want a Trigger that acts on the expression:
JohnDoe tells the group (in common), 'mana'.
Sends: Cast 'give mana' JohnDoe.
I have the following Trigger:
^(\w*) tells the group (in common), 'mana'.*$
To send: cast 'give mana' %1
But it doesn't seem to work, any ideas what I am doing wrong? Any help would be much appreciated :)
Thanks | Top |
|
Posted by
| Nick Gammon
Australia (23,131 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 21 Jan 2002 09:53 PM (UTC) |
Message
| I presume you have checked the "regular expression" box, because you are using "^(\w*)" in the trigger.
In that case, special characters need to be "escaped" or they won't work as you expect. For instance "." is a wildcard, and "( and ")" have special meaning.
Try:
^(\w*) tells the group \(in common\)\, \'mana\'$
You can simplify the process of using regular expressions by entering a simple expression and then clicking the "Convert to Regular Expression" box. That will automatically do the escaping for you. eg.
Enter:
* tells the group (in common), 'mana'
After clicking "Convert to Reg. Exp." you will get:
^(.*?) tells the group \(in common\)\, \'mana\'$
Then you can amend it if you want, for instance by changing ".*" to "\w*".
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| C
(10 posts) Bio
|
Date
| Reply #2 on Tue 22 Jan 2002 03:57 PM (UTC) |
Message
| Thanks Nick,
I tried changing the trigger so it reads:
^(\w*) tells the group \(in common\)\, \'mana\'$
with regular expression ticked. It is set to send:
cast 'give mana' %1
That didn't seem to work for me so I tried to convert it to a regular expression like you showed and sure enough I got:
^(.*?) tells the group \(in common\)\, \'mana\'$
changing the .* to \w, the only difference being the ? instead of * after the \w. The same things are ticked (Regular expression) but again it didn't return anything when I fed the line:
Blah tells the group (in common), 'mana'.
into the client. Sniffle, I'm not sure where to go from here, am I a lost cause? :P
Thanks,
C | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #3 on Tue 22 Jan 2002 06:08 PM (UTC) |
Message
| Am I the only one noticing the extra . at the end of the output line, that is not being looked for on the trigger line?
(An extra \. before the $) |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Nick Gammon
Australia (23,131 posts) Bio
Forum Administrator |
Date
| Reply #4 on Tue 22 Jan 2002 08:34 PM (UTC) |
Message
| You are right. When I looked at the regexp I saw ".*" which I assumed was a wildcard match.
If you want the regexp to match on a dot you need to put \. in it, as Magnum said.
Quote:
Sniffle, I'm not sure where to go from here, am I a lost cause? :P
No, they can be made to work. :) Set the trigger to colour the line, so at least you can confirm when it matches. Then get the response right.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| C
(10 posts) Bio
|
Date
| Reply #5 on Wed 23 Jan 2002 12:45 PM (UTC) |
Message
| Hey again,
Thanks very much for your help all! In the end my trigger looked like this:
^(\w*) tells the group \(in common\)\, \'mana\'\.*
Set to send:
cast 'give mana' %1
It works very nicely now ;)
Thanks again for your help,
C | 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,295 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top