Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Changing color with if/then trigger

Changing color with if/then trigger

You need to log onto the forum to reply or create new threads.

  Refresh page


Posted by Themindkiller   (2 posts)  Bio
Date Tue 09 Dec 2025 04:26 AM (UTC)

Amended on Tue 09 Dec 2025 04:29 AM (UTC) by Themindkiller

Message
Might be overthinking how to do this. Probably a simpler way. This seems to work (as in, the right triggers are being enabled at the right times), but the colors aren't changing and I don't know why:

The goal is for the line that looks like "** HP: 202/202" in MUD to change color based on how much HP I have.


<triggers>
  <trigger
   enabled="y"
   group="HP Colors"
   match="^(.*?)\*\* HP\: (.*?)\/202$"
   name="hp_color_start"
   regexp="y"
   send_to="12"
   sequence="50"
  >
  <send>if %2 &gt; 165 then

&#9;
EnableTrigger ("hp_color_green", true)
EnableTrigger ("hp_color_red", false)
EnableTrigger ("hp_color_orange", false)
EnableTrigger ("hp_color_yellow", false)

elseif %2 &gt; 130 and %2 &lt; 166 then

EnableTrigger ("hp_color_yellow", true)
EnableTrigger ("hp_color_green", false)
EnableTrigger ("hp_color_red", false)
EnableTrigger ("hp_color_orange", false)

elseif %2 &gt; 90 and %2 &lt; 131 then

EnableTrigger ("hp_color_orange", true)
EnableTrigger ("hp_color_green", false)
EnableTrigger ("hp_color_yellow", false)
EnableTrigger ("hp_color_red", false)

elseif %2 &lt; 91 then

EnableTrigger ("hp_color_red", true)
EnableTrigger ("hp_color_orange", false)
EnableTrigger ("hp_color_green", false)
EnableTrigger ("hp_color_yellow", false)

end</send>
  </trigger>
  <trigger
   custom_colour="7"
   group="HP Colors"
   match="^(.*?)\*\* HP\: (.*?)\/202$"
   name="hp_color_red"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   custom_colour="2"
   group="HP Colors"
   match="^(.*?)\*\* HP\: (.*?)\/202$"
   name="hp_color_yellow"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   custom_colour="11"
   group="HP Colors"
   match="^(.*?)\*\* HP\: (.*?)\/202$"
   name="hp_color_orange"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   custom_colour="3"
   enabled="y"
   group="HP Colors"
   match="^(.*?)\*\* HP\: (.*?)\/202*$"
   name="hp_color_green"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>
Top

Posted by Fiendish   USA  (2,547 posts)  Bio   Global Moderator
Date Reply #1 on Tue 09 Dec 2025 05:48 AM (UTC)

Amended on Tue 09 Dec 2025 05:50 AM (UTC) by Fiendish

Message
When a trigger matches MUSHclient does not evaluate any further triggers unless "Keep Evaluating" is set on the trigger. But I'm not sure that an activated trigger will fire on the line that triggered its activation anyway. If not, I would probably omit the line from output and print it fresh in whatever color I wanted.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Themindkiller   (2 posts)  Bio
Date Reply #2 on Tue 09 Dec 2025 06:16 AM (UTC)
Message
Oh gosh, yah, needed Keep Evaluating on the initial trigger for it to work. Silly mistake. But works fine now, thanks.
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.


289 views.

You need to log onto the forum to reply or create new threads.

  Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.