Color settings

Posted by Nightcaste on Sun 16 Sep 2007 01:43 AM — 6 posts, 21,483 views.

#0
I'm new to MUSHing, and this is the client my friend recommended. What I would like to know is if there is a way that I could set the different channels to different colors.

For example, lines starting with "so-and-so says," would be blue, stuff from a different chat channel would be green, or red, or whatever...

I get the idea that this is probably not easy to do, since the couple other people I have asked don't know how, and they've been doing this kind of stuff for a long time.

Thanks!!
Australia Forum Administrator #1
That's pretty easy to do.

Go into world configuration (Alt+Enter) and add a trigger. Make it match what you expect to see, with asterisks in place of the variable stuff.

eg. Trigger: * says, *


Then click on "Change colour and style to" and select a colour from the drop-down list, or select "Other" which will give you two colour swatches. You can then click on those to select a foreground and background colour for matching lines.

Click OK, and then add other triggers for other channels (like chat channels).
#2
I think we tried something like that, but I don't think it was exactly that way... I think we forgot the second wildcard. I will give this another go, and see what happens.

Is there a way to limit how many characters can be before "says"? Just to prevent it from triggering on something like "According to what this book says, you should..." in the middle of someone's statement...
USA #3
Quote:
Is there a way to limit how many characters can be before "says"? Just to prevent it from triggering on something like "According to what this book says, you should..." in the middle of someone's statement...

Sure. You could get the length of %1 and then do an ifcheck.

Or if you know a say will be only one word, you could also match off of that.
Australia Forum Administrator #4
Quote:

Is there a way to limit how many characters can be before "says"?


Click on "convert to regular expression" (when editing the trigger) and the amend the first asterisk to have some sort of conditions. See:

http://www.gammon.com.au/regexp

In my example below (see http://www.gammon.com.au/pasting for how to copy and paste directly), I have limited the name of the person who "says" something to between 1 and 10 characters, and consisting of A-Z, a-z, space or underscore. You may need to edit what is inside the brackets a bit depending on your MUD naming conventions. For example, if numbers were allowed you could add 0-9 inside the brackets.


<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   match="^([A-Za-z _]{1,10}) says\, (.*?)$"
   regexp="y"
   sequence="100"
   other_text_colour="tomato"
   other_back_colour="palegoldenrod"
  >
  </trigger>
</triggers>

Australia Forum Administrator #5
Also, if the MUD quotes what you say, you could add that into the match text. Eg. rather than:

Match: * says, *

You could have:

Match: * says, '*'


Or, change the regular expression in a similar way.