Register forum user name Search FAQ

Gammon Forum

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.
 Entire forum ➜ MUSHclient ➜ Lua ➜ Selective text hightlighting?

Selective text hightlighting?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ashass   (50 posts)  Bio
Date Wed 10 Dec 2008 03:34 PM (UTC)
Message
I made a very basic target trigger, and am now looking to make a more advanced one. Currently the text is matched by name, and blanket changes everything on the line to orange.

Is there a way to =just= match the name and change it to orange?

Typically the format for the name would be in

* name
* name *
name *

I don't want the surrounding text highlighted, just the name.


Current (annoying) target trigger:
<aliases>
<alias
match="target *"
enabled="y"
variable="target"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>

<triggers>
<trigger
custom_colour="17"
enabled="y"
expand_variables="y"
match="*@target*"
sequence="100"
other_text_colour="orangered"
>
</trigger>
</triggers>
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Wed 10 Dec 2008 06:01 PM (UTC)
Message
Try: \b@target\b

with regular expression activated. The \b means it will be processed as a word, meaning it needs a space, comma, dot, quote, etc next to it so you won't match stuff halfway in a word.
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #2 on Wed 10 Dec 2008 07:08 PM (UTC)
Message
That works, except there is a minor issue of matching the entire name now -- when I'm out pking, I would typically only use 2-3 letters from someones name (like m ela for murder elanesse)

I would need ela* to be highlighted, with anything after the space to not be matched.

so m ela

highlights

Elanesse stands here.
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #3 on Wed 10 Dec 2008 09:42 PM (UTC)
Message
\b@target\w*\b

will do that.
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #4 on Wed 10 Dec 2008 11:04 PM (UTC)
Message
100% perfect! Thank you!
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,928 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.