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 ➜ Tips and tricks ➜ Multicolouring words/names

Multicolouring words/names

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by NeoFryBoy   USA  (42 posts)  Bio
Date Sat 15 Jul 2006 11:26 PM (UTC)
Message
Well, I was tired of having just one colour for my name so I decided to make a set of triggers that do a dual colour scheme, and show it to people with some explanation.

Essentially you could use this concept and the basic regexp syntax here to create an alternating colour name which colours every letter a different colour.

Basically this is one trigger set to fire off with a sequence of one, and colour my name 'tealos' or the shortened version (some people use ' 'los' or ' los') red.

So this one matches on (tea|')los and ignores case, repeats on line, etc.

The second one is the tricky bit. What it does is looks for tealos, 'los, or los and colours only the los part a different colour.

The match for this is: (?<=tea|'| )los(?=[,\s.'?>:]\*\!])

Explanation on the expression:
(?<= - This is called a pos lookbehind assertion. It matches when any word begins with what's in the pattern, but (this is the important part) doesn't include that pattern in the match.

los - The only part that isn't wrapped in assertions, so it will be what's coloured.

(?=[,\s.'?>:]\*\!]) - All this crap is basically the same as the first. Since we don't want it to match on lost or lose it simply defines what characters may follow my character's name (\s is a space, etc.), but doesn't try to colour them in. It uses a character class, but you could use |'s over and over.)


<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(?&lt;=tea|'| )los(?=[,\s.'?&gt;:\]\*\!])"
   regexp="y"
   repeat="y"
   sequence="50"
   other_text_colour="maroon"
  >
  </trigger>
  <trigger
   custom_colour="7"
   colour_change_type="1"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(tea|')los"
   regexp="y"
   repeat="y"
   sequence="1"
   other_text_colour="#FF0080"
  >
  </trigger>
</triggers>
Top

Posted by NeoFryBoy   USA  (42 posts)  Bio
Date Reply #1 on Sat 15 Jul 2006 11:26 PM (UTC)
Message
Alternation at it's finest.

On a further note I was able to make a second trigger set that only goes off when it sees the word tea followed by a space, period, colon, etc.

This one alternates colours, and goes from red to maroon back to red.


<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(?&lt;=t)e(?=a[,\s.'?&gt;:\]\*\!])"
   regexp="y"
   repeat="y"
   sequence="100"
   other_text_colour="maroon"
  >
  </trigger>
  <trigger
   custom_colour="17"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(?&lt;=te)a(?=[,\s.'?&gt;:\]\*\!])"
   regexp="y"
   repeat="y"
   sequence="100"
   other_text_colour="red"
  >
  </trigger>
  <trigger
   custom_colour="17"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="t(?=ea(?=[,\s.'?&gt;:\]\*\!]))"
   regexp="y"
   repeat="y"
   sequence="100"
   other_text_colour="red"
  >
  </trigger>
</triggers>


Note: this... t(?=e)a(?=l)o(?=s) doesn't match tealos
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.


9,803 views.

It is now over 60 days since the last post. This thread is closed.     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.