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
➜ Add a multiline trigger with addtriggerex alias?
Add a multiline trigger with addtriggerex alias?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| RichKK
(33 posts) Bio
|
Date
| Wed 17 Jun 2009 09:52 PM (UTC) Amended on Wed 17 Jun 2009 09:56 PM (UTC) by RichKK
|
Message
| I'd like to make triggers that match on room descriptions and output my own notes, I know it's possible with world.DoCommand "MakeMultiLineTrigger"
However I plan on doing quite a few of these triggers so I was hoping to move the trigger creation to the command line for speed and less futzing around through the full list of triggers.
I thought one way I could set it up would be similar to an addtriggerex alias but it would also have to parse the clipboard text into a multiline trigger the same way world.DoCommand "MakeMultiLineTrigger" does to the input box... I'd be grateful for any insight.
<aliases>
<alias
match="room * "
enabled="y"
group=""
send_to="12"
sequence="100"
>
<send>
AddTriggerEx ("", GetClipboard(), "%1", trigger_flag.Enabled, custom_colour.NoChange, 0, "", "", 0, 0)
</send>
</alias>
</aliases>
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 18 Jun 2009 10:05 PM (UTC) |
Message
| You might find it easier to use addxml (see http://www.gammon.com.au/forum/?id=7123).
However your core problem, if I understand the question correctly, would be to take a multi-line room description, and turn it into a regular expression.
This would basically involve these things:
- Converting things (like *, + and brackets) into an escaped form, so that they don't get misinterpreted. A simple string.gsub should do it, with a list of characters you need to escape, and put a backslash in front of them. I think basically any character except A-Z, 0-9 could use such a conversion (excepting newlines). So something like this might do it:
s = string.gsub (s, "[^%d%a%c]", "\\%1")
- Converting newlines to \n in the string
- Put \A (start of subject) at the front, and \z (end of subject) at the end.
- Count the newlines, and make that, plus one, be the number of lines to check in the multi-line trigger.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| RichKK
(33 posts) Bio
|
Date
| Reply #2 on Sat 20 Jun 2009 03:45 AM (UTC) Amended on Sat 20 Jun 2009 03:46 AM (UTC) by RichKK
|
Message
| Bah, I haven't found success yet but thanks for pointing me in the right direction. | 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.
11,965 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top