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
➜ Multi-line Trigger Question
Multi-line Trigger Question
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Maelwys
(2 posts) Bio
|
Date
| Wed 23 Feb 2005 01:28 AM (UTC) Amended on Wed 23 Feb 2005 01:33 AM (UTC) by Maelwys
|
Message
| I have a trigger that I set up to highlight some text whenever it appears in the description of a room. The text is, basically:
A lovely birch tree is growing here.
and my trigger looks like this:
(a|an) (lovely|exotic|droopy|...) (birch|elm|maple|...) tree .*
The problem I run into is that this line can appear on one or 2 lines of the desc, so if the line breaks like this:
Blah blah blah blah blah. A lovely
birch tree is growing here.
my trigger won't fire. I've tried playing with the multi-line feature but it doesn't seem to make a difference. Anyone have any suggestions?
Cheers,
Maelwys | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #1 on Wed 23 Feb 2005 04:57 AM (UTC) |
Message
| Is it multiple lines because of a server linebreak? or just a wrap on the client end?
You cannot color a multiline trigger. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Scypio
Poland (50 posts) Bio
|
Date
| Reply #2 on Wed 23 Feb 2005 04:01 PM (UTC) |
Message
|
Quote: You cannot color a multiline trigger.
Unless you write a small script, catching the input, gagging it and outputting it in colour. | Top |
|
Posted by
| Maelwys
(2 posts) Bio
|
Date
| Reply #3 on Wed 23 Feb 2005 04:23 PM (UTC) |
Message
| It's multiline because of a server newline. The room descriptions are set to only be a specific width no matter what your line width setting is. | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #4 on Wed 23 Feb 2005 07:37 PM (UTC) |
Message
| This seems to do the trick:
import re
pat = re.compile("(glass(?: \x0d\x0a| )and(?: \x0d\x0a| )stonework(?: \x0d\x0a| ))")
col_pat = re.compile("(\x1B[\d+m)")
def OnPluginPacketReceived(strText):
m = pat.search(strText)
if not m:
return strText
else:
start = m.start()
end = m.end()
part1 = strText[:start]
part2 = strText[end:]
colours = col_pat.findall(part1)
last_colour = colours[len(colours)-1]
part1 += "\x1B[31m"
part2 = m.group(1) +last_colour + part2
return part1+part2
That's Python however, as I don't want to try and mess with this in some other language. But maybe someone can translate it to Lua for you. It needs to go into a plugin, and you'll need to replace the three words ('glass', 'and', and 'stonework') with the groups that you want to actually match. This is just an example of how it can be done though, and doesn't pretend to be unversal in any way. It also won't help if your text is broken up between two packets, in which case nothing that I can think of can help, save for redrawing the entire output window by hand. | 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.
16,027 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top