Gammon Forum
Entire forum
MUSHclient
General
Highlightning
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Tsinghahla
Sweden (14 posts) bio
|
Date
| Fri 01 Aug 2008 06:46 PM (UTC) Amended on Fri 01 Aug 2008 07:54 PM (UTC) by Tsinghahla
|
Message
| Hello,
I'm trying to make two highlights in 'one'.
This is the text from the MUD:
Your ouroboros senses Varek, Initiate of the Sanguine at Starlit Ritual Room, on a health of 324 and a mana of 285.
So I made a trigger that looks like this:
<triggers>
<trigger
custom_colour="7"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="\bYour ouroboros senses .+? at\b"
regexp="y"
sequence="90"
>
</trigger>
</triggers>
What I'd like to do is that get the name, inbetween 'Your ouroboros senses' and 'at' highlighted aswell, but in a different colour. It took med about 30 minutes just to get that simple trigger working, so...not all to handy with this. Is this possible to do? | top |
|
Posted by
| Nick Gammon
Australia (22,988 posts) bio
Forum Administrator |
Date
| Reply #1 on Sat 02 Aug 2008 03:42 AM (UTC) |
Message
| Try this:
<triggers>
<trigger
custom_colour="7"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="\bYour ouroboros senses\b"
regexp="y"
sequence="90"
>
</trigger>
<trigger
custom_colour="3"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="(?<=\bYour ouroboros senses\b).+?(?=\bat\b)"
regexp="y"
sequence="90"
>
</trigger>
</triggers>
The first trigger is sort-of what you had. The second one uses a "lookbehind assertion" to check that we have "Your ouroboros senses" *however* an assertion does not becomes part of the matched text, and is thus not coloured. The word "at" is then part of a "lookahead assertion" which anchors the colouring to finish at the word "at". |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Tsinghahla
Sweden (14 posts) bio
|
Date
| Reply #2 on Sat 02 Aug 2008 10:03 AM (UTC) |
Message
| Thanks a lot, works perfectly and that piece of regexp makes me understand a bit more about it. Wonderful! | 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.
9,377 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.