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
➜ Highlight Help
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Selyra
(2 posts) Bio
|
| Date
| Mon 20 Jan 2014 08:20 PM (UTC) |
| Message
| | I play a game where certain actions have a chance of rewarding 'salvage' of five different types: Mechanical, electronic, energy, edible, and chemical. Tasks have different messages displaying how much of what you get, so I figured it would be useful to monitor my salvage gain easier. I don't want to highlight the entire line one color, so I used highlight word, but I would appreciate a method of reading any number. For example, the first message I'm trying to highlight is 'You manage to secure X Chemical salvage'. The X could be any number ranging from 1-100, but using \byou manage to secure * chemical salvage\b doesn't seem to highlight the message at all when the * value is any number. Is there a trick I can use that will highlight messages despite any number of salvage I receive? Or do I have to add a trigger for each and every number possibility? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 21 Jan 2014 10:25 AM (UTC) |
| Message
| Can you post your trigger please?
 |
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
Also post the exact message you get from the MUD (an example of it). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Selyra
(2 posts) Bio
|
| Date
| Reply #2 on Tue 21 Jan 2014 05:18 PM (UTC) Amended on Tue 21 Jan 2014 11:06 PM (UTC) by Nick Gammon
|
| Message
| Trigger:
<triggers>
<trigger
custom_colour="17"
enabled="y"
group="Highlighted Words"
ignore_case="y"
keep_evaluating="y"
match="\bYou manage to secure * Chemical salvage\b"
regexp="y"
repeat="y"
sequence="90"
other_text_colour="yellowgreen"
>
</trigger>
</triggers>
An example was present in my first post, but here it is again:
You manage to secure 8 Chemical salvage.
[EDIT] Code tags added. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Tue 21 Jan 2014 11:08 PM (UTC) Amended on Tue 21 Jan 2014 11:09 PM (UTC) by Nick Gammon
|
| Message
|
You manage to secure * Chemical salvage
OK, with regular expressions a wildcard is not * but <something>*.
In other words, the * means "zero or more of the preceding thing" which in this case is a space.
So you want one or more digits, eg.
You manage to secure [0-9]+ Chemical salvage
or:
You manage to secure \d+ Chemical salvage
 |
Regular expressions
- Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
- Also see how Lua string matching patterns work, as documented on the Lua string.find page.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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,417 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top