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
➜ Total noob needs help
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #15 on Thu 27 Aug 2009 07:00 AM (UTC) Amended on Thu 27 Aug 2009 07:01 AM (UTC) by Nick Gammon
|
| Message
|
Quote:
[^yells]
I don't think that will work properly. That matches a single letter, which is *not* one of: y, e, l, s.
If you are trying to exclude multiple things, the simplest way to go about it is probably to match anything, and then test for the exclusions in a small script, like this:
<triggers>
<trigger
enabled="y"
group="Eagle Eye/Farsight"
keep_evaluating="y"
match="^\*(.*)\*\s+(.*)$"
regexp="y"
send_to="12"
sequence="100"
>
<send>
-- exclusions
if string.match ([===[%2]===], "^yells") or
[===[%2]===] == "is here." then
return
end
-- not excluded? send it
Send ("gt *%1* is at %2")
</send>
</trigger>
</triggers>
That doesn't try to exclude things like "is here" in the regular expression, but it then tests in the script for a match on "yells <something" or "is here.".
I used the slightly unusual form of Lua quotes because someone might cause your script to fail by putting quotes in what they say. eg.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Twisol
USA (2,257 posts) Bio
|
| Date
| Reply #16 on Thu 27 Aug 2009 07:17 AM (UTC) |
| Message
| | I did some experimentation way back about the %1 placeholder strings, and it turns out that MUSHclient escapes the quotes for you before inserting into the script code. You really can just use "%1" and not worry about it. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #17 on Thu 27 Aug 2009 07:38 AM (UTC) |
| Message
| Yes, I keep forgetting it does that. :)
So this will work:
<triggers>
<trigger
enabled="y"
group="Eagle Eye/Farsight"
keep_evaluating="y"
match="^\*(.*)\*\s+(.*)$"
regexp="y"
send_to="12"
sequence="100"
>
<send>
-- exclusions
if string.match ("%2", "^yells") or
"%2" == "is here." then
return
end
-- not excluded? send it
Send ("gt *%1* is at %2")
</send>
</trigger>
</triggers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Treant
USA (10 posts) Bio
|
| Date
| Reply #18 on Thu 27 Aug 2009 01:50 PM (UTC) |
| Message
| | So send to 12, thats script, i need to put exclusions and all that stuff after the trigger in a script, or if i copy paste that as a plugin, it'll work as is? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #19 on Thu 27 Aug 2009 08:48 PM (UTC) |
| Message
| It's not a plugin, it is a single trigger. Just copy that into the client:
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
Yes, 12 is send-to-script. Don't try to copy and paste individual lines, follow the instructions on the link there.
It should work as-is, the exclusions are in the small bit of script that is there. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Treant
USA (10 posts) Bio
|
| Date
| Reply #20 on Fri 28 Aug 2009 04:28 AM (UTC) |
| Message
|
Nick Gammon said:
It's not a plugin, it is a single trigger. Just copy that into the client:
(pasting)
Yes, 12 is send-to-script. Don't try to copy and paste individual lines, follow the instructions on the link there.
It should work as-is, the exclusions are in the small bit of script that is there.
Works like a charm, thanks for the help guys. | | 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.
81,815 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top