Question about custom_colour

Posted by Blixel on Tue 20 Sep 2011 02:48 PM — 5 posts, 20,587 views.

#0
I have a trigger set up to give me a visual cue when I take damage. It's real basic. It works like this:

<triggers>
  <trigger
   group="Status Check"
   match="^\&gt;?You have (.*?)\/(.*?) hitpoints.*?$"
   name="HealthCheck"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTrigger("HealthCheck", false)
if (%1 &lt; (%2 * .20)) then
  EnableTrigger("FlaskEmergency", true)
  Send ("drink flask")
elseif (%1 &lt; (%2 * .35)) then
  ColourNote ("black", "red", "Health is %1")
elseif (%1 &lt; (%2 * .45)) then
  ColourNote ("black", "orange", "Health is %1")
end</send>
  </trigger>
</triggers>


I noticed MUSHclient can replace the color of text. So I was wondering if instead of using these ColourNotes - which add more text to the screen - if I could instead use custom_colour to do the same thing?

When I tried to replace ColourNote with custom_colour in this trigger, I got compile errors. Is it the case that you can only use the custom_colour that is defined in the trigger header? Can you not set the custom_colour inside of the trigger? Something like this:

<triggers>
  <trigger
   enabled="y"
   group="Tests"
   keep_evaluating="y"
   match="^\&gt;?You have (.*?)\/(.*?) hitpoints.*?$"
   name="colour_test"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if (%1 &lt; (%2 * .85)) then
  custom_colour="7"
elseif (%1 &lt; (%2 * .90)) then
  custom_colour="11"
elseif (%1 &lt; (%2 * .95)) then
  custom_colour="3"
end</send>
  </trigger>
</triggers>


#1
Select 'Omit from output' in the trigger to remove the original trigger text, after that use ColourNote("black", "red", "%0") etc. to rewrite the same line but now with colour. %0 holds the entire match text by the way.
#2
Ada said:
Select 'Omit from output' in the trigger to remove the original trigger text, after that use ColourNote("black", "red", "%0") etc. to rewrite the same line but now with colour. %0 holds the entire match text by the way.


Hmm... that sounds good, but it doesn't seem to have the desired effect. The output color is ordinary white/gray text on black.

Screenshot: http://i.imgur.com/MDxLn.png

Is my trigger missing anything?

<triggers>
  <trigger
   enabled="y"
   group="Status Check"
   keep_evaluating="y"
   match="^\&gt;?You have (.*?)\/(.*?) hitpoints.*?$"
   name="HealthCheck"
   omit_from_output="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTrigger("HealthCheck", false)
if (%1 &lt; (%2 * .25)) then
  EnableTrigger("FlaskEmergency", true)
  Send ("drink flask")
  ColourNote("black", "red", "%0")
elseif (%1 &lt; (%2 * .35)) then
  --ColourNote ("black", "orange", "Health is %1")
  ColourNote("black", "orange", "%0")
elseif (%1 &lt; (%2 * .45)) then
  --ColourNote ("black", "orange", "Health is %1")
  ColourNote("black", "yellow", "%0")
elseif (%1 &lt; (%2 * .7)) then
  ColourNote ("black", "green", "%0")
else
  ColourNote ("black", "blue", "%0")
end</send>
  </trigger>
</triggers>
#3
You forgot to select 'Regular expression' checkbox.
#4
Ada said:
You forgot to select 'Regular expression' checkbox.


... and now it works. (I'm a moron.)

Thanks. This is going to be very useful.