Highlightning

Posted by Tsinghahla on Fri 01 Aug 2008 06:46 PM — 3 posts, 13,587 views.

Sweden #0
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?
Amended on Fri 01 Aug 2008 07:54 PM by Tsinghahla
Australia Forum Administrator #1
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="(?&lt;=\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".
Sweden #2
Thanks a lot, works perfectly and that piece of regexp makes me understand a bit more about it. Wonderful!