Hightlighting Multiple Words in One Line

Posted by Aheram on Wed 22 Dec 2004 12:43 AM — 7 posts, 28,021 views.

#0
I am currently pulling out my hair in frustration, trying to figure this problem out.

At the moment, I am trying to figure out how to highlight words (WORDSSSS) in battle messages.

Here are examples.

You smashed Beggar with a bone-crushing sound.
You smashed Beggar to no avail.
You eradicate Beggar to no avail.
You eradicate Beggar with a bone-crushing sound.

What I am trying to do is have a trigger that looks at a line and colors the hit and have another trigger that looks at the same line and then colors the damage. Do I need to script this (bear in mind that the thought scares me, the last time I tried scripting, my alias list vanished)?
Australia Forum Administrator #1
You don't need scripting.

  • Make a trigger.
  • Make it a regular expression (check the Regular Expression box)
  • Choose the word to colour (eg. Beggar) and put that in the Trigger box.
  • Choose the colour to set it to (eg. Custom2)
  • Make it keep evaluating (check the Keep Evaluating box).
  • Repeat this process for any other words you are interested in (ie. make more triggers)


If you want to colour different things the same way, put the "|" symbol (for this OR that) into the match text, eg.

Trigger: to no avail|with a bone-crushing sound

#2
Thanks! It was "Keep Evaluating" that I needed!


And wow, what a timely response!

By the way, would there be any updates to MUSH client?



And I have another problem. It is a multiline trigger that I want colored, but it has variables that I want colored differently.

(You|> You|> > You) hurl a fireball at (.*).

And...

(You|> You|> > You) (singed|scorched|severely scorched|burned) (.*).

"You hurl fireball at Target." and "You (damage) Target." will be pale yellow, while the damage "(singed|scorched|severely scorched|burned)" will be colored differently. I want it to be a Multiline trigger because "You (wildcard) (wildcard)" will cause the client to color things I do not want colored.
Australia Forum Administrator #3
Quote:

By the way, would there be any updates to MUSH client?


Depends which version you currently have, but see this for the latest available right now:

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

However version 3.61 is about to be released.

Quote:

It is a multiline trigger that I want colored ...


Is this really multiple lines with line breaks? Or just a long line which wraps?

The genuine multiple lines are harder to do, because although MUSHclient supports multi-line triggers, it won't go back and retrospectively colour them.

A line-wrap trigger is OK, you just need to get the wildcards right. Rather than using something like "You (wildcard) (wildcard)" use regular expressions that narrow down what you are looking for. You can always have multiple triggers, if one doesn't match it tries another.


USA #4
Instead of multiline (since that won't allow you to color them at all, let alone differently) how about you have a series of triggers.
In this case two.

Your first trigger would be:
^(You|> You|> > You) hurl a fireball at (.*)\.$
(You have to escape that last period, and the other things ^ and $ are regexp things)
Give it a name (Label).
Make your second trigger match on the second line:
^(You|> You|> > You) (singed|scorched|severely scorched|burned) (.*)\.$
give it a label as well.
Uncheck 'enabled' on the second one.

Then when your first one matches, we're going to enable your second. We do this by changing the 'send to' to script, and sending (assuming youre using VB)
EnableTrigger "Trigger2", 1
where Trigger2 is the label of the second trigger.
We will do the exact same ting on the second one, except it will be disabling itself (EnableTrigger "Trigger2", 0)

This way the second trigger only works after the first one has matched, and will only work once per.

That of course assumes that the first one always is followed by the second. If something else comes up for the second line (if you miss?) then you will get it matching on something else.
However with this, you can indeed match on:
^(> ){0,2}You (.*) (.*)\.$
(which is the same as ^(You|> You|> > You) (.*) (.*)\.$)

As for your first question, yes, MC is updated often. Or at least actively developed. The updates sometimes are a month in between, sometimes a couple hours, depending on what needs to be changed and how many changes comprise an update.
#5
Heh. :) MUSH client just became even better!

Thank you for the trick. I love it!
#6
Taking what Nick and Flannel taught me, I was FINALLY able to do this.

<triggers>
<trigger
custom_colour="2"
enabled="y"
match="^(You|&gt; You|&gt; &gt; You) hurl a fireball at (.*)\.$"
name="Fireball"
regexp="y"
send_to="12"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>EnableTrigger &quot;FireballDam1&quot;, 1
EnableTrigger &quot;FireballDam2&quot;, 1
EnableTrigger &quot;FireballDam3&quot;, 1</send>
</trigger>
<trigger
custom_colour="2"
keep_evaluating="y"
match="^(You|&gt; You|&gt; &gt; You)"
name="FireballDam1"
regexp="y"
send_to="12"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>EnableTrigger &quot;FireballDam1&quot;, 0</send>
</trigger>
<trigger
custom_colour="7"
enabled="y"
keep_evaluating="y"
match="(singed|scorched|severely scorched|burned)"
name="FireballDam2"
regexp="y"
send_to="12"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>EnableTrigger &quot;FireballDam2&quot;, 0</send>
</trigger>
<trigger
custom_colour="2"
keep_evaluating="y"
match="(.*)\.$"
name="FireballDam3"
regexp="y"
send_to="12"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>EnableTrigger &quot;FireballDam3&quot;, 0</send>
</trigger>
</triggers>

Thanks guys. :)