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?
Highlight Help
Posted by Selyra on Mon 20 Jan 2014 08:20 PM — 4 posts, 17,365 views.
Can you post your trigger please?
Also post the exact message you get from the MUD (an example of it).
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).
Trigger:
An example was present in my first post, but here it is again:
[EDIT] Code tags added.
<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.
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.