Colourful nicknames :) version 0.2

By s00p on May 09, 2011

This script permits one to stylise their nickname with colours. It also defines a representation for colourful nicknames that is compatible with all IRC networks and is completely invisible to most IRC clients; If others are using this script, they will also be able to see the colours one defines.

A similar script has been developed for XChat by Sir_Burpalot of irc.icq.com.

On 22/06/2011 I updated this; It now has a mechanism for spanning colours across multiple characters. Still bug testing. Let me know if anything unexpected happens.

; Colourful nicknames :) version 0.2 by seb@geekycode.net

; To set colours you'll need to /set the %nickcolour_list variable, eg: /set %nickcolour_list 0407080911
; Each colour spans one character in your nickname, unless you specify a number in the "background colour"
; field; The "background colour" field is instead a length/span modifier. You can use it to cause colours to span
; multiple characters. For example:
; 04 would represent red.
; 04,0307 would represent 3 characters of red followed by orange.
; 04,0307,0608 would represent 3 characters of red followed by 6 characters of orange followed by yellow.
; The last colour spans all remaining characters of the nickname.

alias show_prefixes {
  ; Returning $false here will hide nickname prefixes in channel messages (eg. @ % +)
  return $true
}

alias Colourise {
  var %colours = $remtok({,{,},}) $3 45,56 0 32
  var %nick = $6

  noop $iif(1 == 1,$v1 $v2,$v1 $v2)
  echo -ctlbfmr $1-2 $+({,{,},}) $4 $5 $regsubex($str(*,$len(%nick)),/[*]/g,$gettok($gettok(%colours,\n,32),1,44) $+ $mid(%nick,$v1,$iif($v1 + $gettok($gettok(%colours,\n,32),2,44) == $v1 + 0,$iif($calc($v1 + 1) == 1,1,1),$iif($v1 $gettok($gettok(%colours,\n,32),2,44) == $v1 $null,$iif($calc($v1 1) == 1,1,1),$iif($calc($v1) == $gettok($gettok(%colours,\n,32),2,44),$v2,$v2))))) $7 $8
  haltdef
}

alias RemoteColourise {
  var %reColour = /(\x03\d{1,2}(?:,\d{1,2})?)(?=\x03|$)/g
  var %text = $1
  var %destination = $iif($chan != $null,$chan,$2)
  var %colour = $3
  var %begin = $4
  var %end = $5
  var %prefix = $iif($show_prefixes == $true && $left($nick($chan,$nick).pnick,1) isin $prefix,$v1,$null)
  noop $regsubex($1,%reColour,$iif(\n == 1,$Colourise(%colour,%destination,\a,%begin,%prefix,$nick,%end,%text)))
}

on ^1:TEXT:*:*: {
  noop $RemoteColourise($1-,$nick,Normal,<,>)
}

on ^1:NOTICE:*:*: {
  noop $RemoteColourise($1-,$nick,Notice,-,$+(,$iif($chan != $null,: $+ $chan),-))
}

on ^1:ACTION:*:*: {
  noop $RemoteColourise($1-,$nick,Action,* ,)
}

on 1:INPUT:*: {
  var %reException = /^\/(me|notice)$/
  if ($chan == #c || %nickcolour_list == $null || $ctrlenter == $true || ($left($1,1) == / && $regex($1,%reException) == 0)) {
    return
  }
  else if ($1 == /me) {
    noop $RemoteColourise($2- %nickcolour_list,$target,Action,* ,)
    .describe $target $+({,{,{) $2- 45,56 %nickcolour_list
  }
  else if ($1 == /notice) {
    .notice $2 $+({,{,{) $3- 45,56 %nickcolour_list
    echo -> $+(-,$2,-) $3-
  }
  else {
    noop $RemoteColourise($1- %nickcolour_list,$target,Own,<,>)
    .msg $target $+({,{,{) $1- 45,56 %nickcolour_list
  }
  halt
}

Comments

Sign in to comment.
FreeHuman   -  Jun 22, 2011

Good,Very Good

 Respond  
s00p   -  Jun 22, 2011

Updated to v.0.2. See description + comments.

 Respond  
chorao   -  May 17, 2011

nice! \o/

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.