[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  Multicolouring words/names

Multicolouring words/names

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


Posted by NeoFryBoy   USA  (42 posts)  [Biography] 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>
[Go to top] top

Posted by NeoFryBoy   USA  (42 posts)  [Biography] 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
[Go to top] 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.


8,747 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]