Highlighting (It's been done before, I've checked)

Posted by Underscore on Mon 24 Mar 2003 11:44 PM — 8 posts, 35,316 views.

#0
I'm trying to do a simple highlight for a mud I play on and found the following resource: http://www.gammon.com.au/mushclient/funwithtriggers.htm . I tried doing using the command ^.*Insert tex here.*$ however it's not highlighting the text when that phrase is outputted from the MUD. So, I'm very confoozled. I know what the text is going to be and I know I want to highlight it. I'm using version 3.34, if that helps any. If someone would either kindly answer my question or point me in the direction of something a little less confoozling, I'd be extremely appreciative.
Australia Forum Administrator #1
The first question is, is the trigger matching? When you edit that trigger there will be a "match count" displayed. If that is zero, then for some reason you haven't got an exact match.

You could put something like "trigger matched" in the "send" box and change to "send to output" just to send yourself a message if it matches (temporarily of course).

If it *is* matching then you need to make sure you have set "change colour to" the appropriate colour you want to highlight in.
USA #2
Here is a quick way of highlighting a single word which I use in my script.

sub HW(Word)
World.deletetrigger "Highlight"
World.addtrigger "Highlight", "(" + Word + ")", "", eEnabled + eIgnoreCase + eTriggerRegularExpression , 3,0, "", ""
end sub

If you want to change the color and all that lookup the addtrigger funtion. So in your command window you would just type:/ hw "Gold"
And the word Gold will be highlighted everywhere it comes up. you can change what words get highlighted by executing it again. and if you do not want any words just type: / hw ""
This only highlights a single word at a time. But if you wanted a more permananet highlight just copy the trigger this script creates and use it.

Regards,
Plazgoth
#3
Hmm..Well. I've got my trigger set up in the following way:

Trigger:Strengthen
Match any on any
Send:IT WORKED!

Enabled:checked
Ignore Case:checked
Omit from log file:unchecked
Omit from output:unchecked
Keep evaluating:unchecked
Regular Expression:unchecked
Repeat on same line:grayed
Expand variables:unchecked
Temporary:unchecked

Make wildcards lower-case:unchecked

Custom color is at Custom6
Italic:checked
Underline:checked
Bold:grayed

Send to:World

Picked the sound of a cow mooing, so i can hear if it works also

and left Sequence, Copy Wildcard, Lavel, Script, and group alone

From what I've read, that's supposed to highlight any cases of the word, but It hasn't had one call yet. From that information, can you tell me if I'm doing anything wrong, and how I would apply that to a phrase?
Australia Forum Administrator #4
First, you would find it easier to click on the trigger in the trigger list, then the Copy button, and paste that. It gives us the exact information about your trigger without the possibility of transcription errors.

Second, if you are trying to highlight the single word "Strengthen" you must check "regular expression" (which you haven't) otherwise it only matches an entire line consisting of the word "Strengthen" and nothing else.

Regular expressions are more powerful, they can match on partial lines, and because of that you can colour partial lines.
USA #5

  <trigger
   custom_colour="6"
   enabled="y"
   match="(Strengthen)"
   regexp="y"
   sequence="100"
  >
  </trigger>


try pasting that in your world file
Australia Forum Administrator #6
The brackets aren't really required in this case. Try just using:


match="Strengthen"



This makes it clearer you are matching on that word.
Australia Forum Administrator #7
Quote:

I'm trying to do a simple highlight for a mud I play on ...


This is now easily done with a quick dialog box. See:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=5071