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 ➜ Trigger That Matches Strings in an Array of Vaiables

Trigger That Matches Strings in an Array of Vaiables

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

  Refresh page


Posted by Errigour   USA  (42 posts)  Bio
Date Mon 06 Apr 2026 08:40 PM (UTC)
Message
I want to make a trigger that will change the color of strings
that I put in a variable. Is it possible.

I want to match 10 monster names and put them in a variable.
Then change the color of text that matches those strings until
they are removed from the variable.

If I can't do it then that would be an awesome feature to add.
Top

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #1 on Tue 07 Apr 2026 02:54 AM (UTC)

Amended on Tue 07 Apr 2026 02:55 AM (UTC) by Fiendish

Message
I'm having a hard time understanding what you mean. Could you give an example?

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 07 Apr 2026 06:11 AM (UTC)

Amended on Tue 07 Apr 2026 06:12 AM (UTC) by Nick Gammon

Message
Make a variable (in the GUI interface), like this:


Name: mobs
Value: naga|kobold|wolf


Put the various mob names in the variable, separated by the "|" character.

Then make a trigger:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   expand_variables="y"
   match="(@!mobs)"
   regexp="y"
   repeat="y"
   sequence="100"
  >
  </trigger>
</triggers>


This expands out the variable "mobs" without escaping anything, and that becomes what is matched. Then in this example they are coloured yellow.

Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Errigour   USA  (42 posts)  Bio
Date Reply #3 on Tue 07 Apr 2026 11:02 AM (UTC)
Message
It isn't matching. Does that have to be in a script file or can I just put (@!mobs) in the trigger pattern?
Top

Posted by Errigour   USA  (42 posts)  Bio
Date Reply #4 on Tue 07 Apr 2026 03:17 PM (UTC)
Message
Oh it worked i just had to expand variables. Thank you so much!
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.


370 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.