[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Highlight Help

Highlight Help

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


Posted by Selyra   (2 posts)  [Biography] 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?
[Go to top] top

Posted by Nick Gammon   Australia  (22,987 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 21 Jan 2014 10:25 AM (UTC)
Message
Can you post your trigger please?

Template:copying 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
[Go to top] top

Posted by Selyra   (2 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,987 posts)  [Biography] 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


Template:regexp 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
[Go to top] 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.


11,421 views.

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

Go to topic:           Search the forum


[Go to top] 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.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]