Add to a new remotes file then /hop or join a room it will color the nicks in the nicklist depending on their status voice mod owner halfop reguser
thanks napa and scakk for the help
ok added a second version for those of you who would like to be able to change colors easily. it now has a right click menu where you can choose colors for each type of mode. also you can easily unset them to make it go back to what its normally set as and has an on/off function so be sure to turn it on then set your colors. also has a check colors feature so you dont have to /hop everytime. after setting your colors just go to the check color click on it and it will auto do the nicklist colors you have chosen. forwarning not every site has all the modes some modes are strictly ircd so if your on chatspace and you try setting colors for those modes do not expect to se em. chatspace modes would be the op +o voice +v or + and regular user +r
has been made and tested on v6.32
ok i added a second version that uses the internal address book nick coloring system. its faster with the changes and works better. i have left both versions up though. the new one was made on v6.32 i do not know if it will work on any other version of mirc
on *:join:#: { .timer 1 1 nc $chan }
alias nc {
if (%nc == on) {
var %t 1 | while (%t <= $nick($1,0,r)) {
cline %r $1 $nick($1,%t,r)
inc %t
}
var %t2 1 | while (%t2 <= $nick($1,0,+)) {
cline %v $1 $nick($1,%t2,+)
inc %t2
}
var %t3 1 | while (%t3 <= $nick($1,0,%)) {
cline %h $1 $nick($1,%t3,%)
inc %t3
}
var %t4 1 | while (%t4 <= $nick($1,0,@)) {
cline %o $1 $nick($1,%t4,@)
inc %t4
}
var %t5 1 | while (%t5 <= $nick($1,0,&)) {
cline %& $1 $nick($1,%t5,&)
inc %t5
}
var %t6 1 | while (%t6 <= $nick($1,0,~)) {
cline %~ $1 $nick($1,%t6,~)
inc %t6
}
}
}
on *:RAWMODE:#:{
if (+o isin $1) {
nc $chan
}
if (-o isin $1) {
nc $chan
}
if (+q isin $1) {
nc $chan
}
if (-q isin $1) {
nc $chan
}
if (+a isin $1) {
nc $chan
}
if (-a isin $1) {
nc $chan
}
if (+h isin $1) {
nc $chan
}
if (-h isin $1) {
nc $chan
}
if (+v isin $1) {
nc $chan
}
if (-v isin $1) {
nc $chan
}
}
! *
Menu nicklist, {
Nicklist Color Changer
..on: { .set %nc on }
..off: { .unset %nc }
..Unset All: { .unset %r | .unset %v | .unset %~ | .unset %& | .unset %o | .unset %h }
..Check Colors: { .nc $chan }
.Regular User(+R)
..unset: { .unset %r }
..0(White): { .set %r 0 }
..1(Black): { .set %r 1 }
..2(Dark Blue): { .set %r 2 }
..3(Dark Green): { .set %r 3 }
..4(Red): { .set %r 4 }
..5(Brown): { .set %r 5 }
..6(Purple): { .set %r 6 }
..7(Orange): { .set %r 7 }
..8(Yellow): { .set %r 8 }
..9(Light Green): { .set %r 9 }
..10(Teal): { .set %r 10 }
..11(Aqua): { .set %r 11 }
..12(Light Blue): { .set %r 12 }
..13(Pink): { .set %r 13 }
..14(Dark Grey): { .set %r 14 }
..15(Light Grey): { .set %r 15 }
.voice(+V,+)
..unset: { .unset %v }
..0(White): { .set %v 0 }
..1(Black): { .set %v 1 }
..2(Dark Blue): { .set %v 2 }
..3(Dark Green): { .set %v 3 }
..4(Red): { .set %v 4 }
..5(Brown): { .set %v 5 }
..6(Purple): { .set %v 6 }
..7(Orange): { .set %v 7 }
..8(Yellow): { .set %v 8 }
..9(Light Green): { .set %v 9 }
..10(Teal): { .set %v 10 }
..11(Aqua): { .set %v 11 }
..12(Light Blue): { .set %v 12 }
..13(Pink): { .set %v 13 }
..14(Dark Grey): { .set %v 14 }
..15(Light Grey): { .set %v 15 }
.halfop(%,+h)
..unset: { .unset %h }
..0(White): { .set %h 0 }
..1(Black): { .set %h 1 }
..2(Dark Blue): { .set %h 2 }
..3(Dark Green): { .set %h 3 }
..4(Red): { .set %h 4 }
..5(Brown): { .set %h 5 }
..6(Purple): { .set %h 6 }
..7(Orange): { .set %h 7 }
..8(Yellow): { .set %h 8 }
..9(Light Green): { .set %h 9 }
..10(Teal): { .set %h 10 }
..11(Aqua): { .set %h 11 }
..12(Light Blue): { .set %h 12 }
..13(Pink): { .set %h 13 }
..14(Dark Grey): { .set %h 14 }
..15(Light Grey): { .set %h 15 }
.Op(+o,@)
..unset: { .unset %o }
..0(White): { .set %o 0 }
..1(Black): { .set %o 1 }
..2(Dark Blue): { .set %o 2 }
..3(Dark Green): { .set %o 3 }
..4(Red): { .set %o 4 }
..5(Brown): { .set %o 5 }
..6(Purple): { .set %o 6 }
..7(Orange): { .set %o 7 }
..8(Yellow): { .set %o 8 }
..9(Light Green): { .set %o 9 }
..10(Teal): { .set %o 10 }
..11(Aqua): { .set %o 11 }
..12(Light Blue): { .set %o 12 }
..13(Pink): { .set %o 13 }
..14(Dark Grey): { .set %o 14 }
..15(Light Grey): { .set %o 15 }
.Protected/channel admin(+a,&)
..unset: { .unset %& }
..0(White): { .set %& 0 }
..1(Black): { .set %& 1 }
..2(Dark Blue): { .set %& 2 }
..3(Dark Green): { .set %& 3 }
..4(Red): { .set %& 4 }
..5(Brown): { .set %& 5 }
..6(Purple): { .set %& 6 }
..7(Orange): { .set %& 7 }
..8(Yellow): { .set %& 8 }
..9(Light Green): { .set %& 9 }
..10(Teal): { .set %& 10 }
..11(Aqua): { .set %& 11 }
..12(Light Blue): { .set %& 12 }
..13(Pink): { .set %& 13 }
..14(Dark Grey): { .set %& 14 }
..15(Light Grey): { .set %& 15 }
.owner(+q,~)
..unset: { .unset %~ }
..0(White): { .set %~ 0 }
..1(Black): { .set %~ 1 }
..2(Dark Blue): { .set %~ 2 }
..3(Dark Green): { .set %~ 3 }
..4(Red): { .set %~ 4 }
..5(Brown): { .set %~ 5 }
..6(Purple): { .set %~ 6 }
..7(Orange): { .set %~ 7 }
..8(Yellow): { .set %~ 8 }
..9(Light Green): { .set %~ 9 }
..10(Teal): { .set %~ 10 }
..11(Aqua): { .set %~ 11 }
..12(Light Blue): { .set %~ 12 }
..13(Pink): { .set %~ 13 }
..14(Dark Grey): { .set %~ 14 }
..15(Light Grey): { .set %~ 15 }
}
___________________________________________________________________________________
New Version
Menu nicklist, {
Nicklist Color Changer
..on: { .cnick on }
..off: { .cnick off }
.Regular User(+R)
..0(White): { .cnick -r 6 | .cnick -m2Ns6 * 0 }
..1(Black): { .cnick -r 6 | .cnick -m2Ns6 * 1 }
..2(Dark Blue): { .cnick -r 6 | .cnick -m2Ns6 * 2 }
..3(Dark Green): { .cnick -r 6 | .cnick -m2Ns6 * 3 }
..4(Red): { .cnick -r 6 | .cnick -m2Ns6 * 4 }
..5(Brown): { .cnick -r 6 | .cnick -m2Ns6 * 5 }
..6(Purple): { .cnick -r 6 | .cnick -m2Ns6 * 6 }
..7(Orange): { .cnick -r 6 | .cnick -m2Ns6 * 7 }
..8(Yellow): { .cnick -r 6 | .cnick -m2Ns6 * 8 }
..9(Light Green): { .cnick -r 6 | .cnick -m2Ns6 * 9 }
..10(Teal): { .cnick -r 6 | .cnick -m2Ns6 * 10 }
..11(Aqua): { .cnick -r 6 | .cnick -m2Ns6 * 11 }
..12(Light Blue): { .cnick -r 6 | .cnick -m2Ns6 * 12 }
..13(Pink): { .cnick -r 6 | .cnick -m2Ns6 * 13 }
..14(Dark Grey): { .cnick -r 6 | .cnick -m2Ns6 * 14 }
..15(Light Grey): { .cnick -r 6 | .cnick -m2Ns6 * 15 }
.voice(+V,+)
..0(White): { .cnick -r 5 | .cnick -m2s5 * 0 + }
..1(Black): { .cnick -r 5 | .cnick -m2s5 * 1 + }
..2(Dark Blue): { .cnick -r 5 | .cnick -m2s5 * 2 + }
..3(Dark Green): { .cnick -r 5 | .cnick -m2s5 * 3 + }
..4(Red): { .cnick -r 5 | .cnick -m2s5 * 4 + }
..5(Brown): { .cnick -r 5 | .cnick -m2s5 * 5 + }
..6(Purple): { .cnick -r 5 | .cnick -m2s5 * 6 + }
..7(Orange): { .cnick -r 5 | .cnick -m2s5 * 7 + }
..8(Yellow): { .cnick -r 5 | .cnick -m2s5 * 8 + }
..9(Light Green): { .cnick -r 5 | .cnick -m2s5 * 9 + }
..10(Teal): { .cnick -r 5 | .cnick -m2s5 * 10 + }
..11(Aqua): { .cnick -r 5 | .cnick -m2s5 * 11 + }
..12(Light Blue): { .cnick -r 5 | .cnick -m2s5 * 12 + }
..13(Pink): { .cnick -r 5 | .cnick -m2s5 * 13 + }
..14(Dark Grey): { .cnick -r 5 | .cnick -m2s5 * 14 + }
..15(Light Grey): { .cnick -r 5 | .cnick -m2s5 * 15 + }
.halfop(%,+h)
..0(White): { .cnick -r 4 | .cnick -m2s4 * 0 % }
..1(Black): { .cnick -r 4 | .cnick -m2s4 * 1 % }
..2(Dark Blue): { .cnick -r 4 | .cnick -m2s4 * 2 % }
..3(Dark Green): { .cnick -r 4 | .cnick -m2s4 * 3 % }
..4(Red): { .cnick -r 4 | .cnick -m2s4 * 4 % }
..5(Brown): { .cnick -r 4 | .cnick -m2s4 * 5 % }
..6(Purple): { .cnick -r 4 | .cnick -m2s4 * 6 % }
..7(Orange): { .cnick -r 4 | .cnick -m2s4 * 7 % }
..8(Yellow): { .cnick -r 4 | .cnick -m2s4 * 8 % }
..9(Light Green): { .cnick -r 4 | .cnick -m2s4 * 9 % }
..10(Teal): { .cnick -r 4 | .cnick -m2s4 * 10 % }
..11(Aqua): { .cnick -r 4 | .cnick -m2s4 * 11 % }
..12(Light Blue): { .cnick -r 4 | .cnick -m2s4 * 12 % }
..13(Pink): { .cnick -r 4 | .cnick -m2s4 * 13 % }
..14(Dark Grey): { .cnick -r 4 | .cnick -m2s4 * 14 % }
..15(Light Grey): { .cnick -r 4 | .cnick -m2s4 * 15 % }
.Op(+o,@)
..0(White): { .cnick -r 3 | .cnick -m2s3 * 0 @ }
..1(Black): { .cnick -r 3 | .cnick -m2s3 * 1 @ }
..2(Dark Blue): { .cnick -r 3 | .cnick -m2s3 * 2 @ }
..3(Dark Green): { .cnick -r 3 | .cnick -m2s3 * 3 @ }
..4(Red): { .cnick -r 3 | .cnick -m2s3 * 4 @ }
..5(Brown): { .cnick -r 3 | .cnick -m2s3 * 5 @ }
..6(Purple): { .cnick -r 3 | .cnick -m2s3 * 6 @ }
..7(Orange): { .cnick -r 3 | .cnick -m2s3 * 7 @ }
..8(Yellow): { .cnick -r 3 | .cnick -m2s3 * 8 @ }
..9(Light Green): { .cnick -r 3 | .cnick -m2s3 * 9 @ }
..10(Teal): { .cnick -r 3 | .cnick -m2s3 * 10 @ }
..11(Aqua): { .cnick -r 3 | .cnick -m2s3 * 11 @ }
..12(Light Blue): { .cnick -r 3 | .cnick -m2s3 * 12 @ }
..13(Pink): { .cnick -r 3 | .cnick -m2s3 * 13 @ }
..14(Dark Grey): { .cnick -r 3 | .cnick -m2s3 * 14 @ }
..15(Light Grey): { .cnick -r 3 | .cnick -m2s3 * 15 @ }
.Protected/channel admin(+a,&)
..0(White): { .cnick -r 2 | .cnick -m2s2 * 0 & }
..1(Black): { .cnick -r 2 | .cnick -m2s2 * 1 & }
..2(Dark Blue): { .cnick -r 2 | .cnick -m2s2 * 2 & }
..3(Dark Green): { .cnick -r 2 | .cnick -m2s2 * 3 & }
..4(Red): { .cnick -r 2 | .cnick -m2s2 * 4 & }
..5(Brown): { .cnick -r 2 | .cnick -m2s2 * 5 & }
..6(Purple): { .cnick -r 2 | .cnick -m2s2 * 6 & }
..7(Orange): { .cnick -r 2 | .cnick -m2s2 * 7 & }
..8(Yellow): { .cnick -r 2 | .cnick -m2s2 * 8 & }
..9(Light Green): { .cnick -r 2 | .cnick -m2s2 * 9 & }
..10(Teal): { .cnick -r 2 | .cnick -m2s2 * 10 & }
..11(Aqua): { .cnick -r 2 | .cnick -m2s2 * 11 & }
..12(Light Blue): { .cnick -r 2 | .cnick -m2s2 * 12 & }
..13(Pink): { .cnick -r 2 | .cnick -m2s2 * 13 & }
..14(Dark Grey): { .cnick -r 2 | .cnick -m2s2 * 14 & }
..15(Light Grey): { .cnick -r 2 | .cnick -m2s2 * 15 & }
.owner(+q,~)
..0(White): { .cnick -r 1 | .cnick -m2s1 * 0 ~ }
..1(Black): { .cnick -r 1 | .cnick -m2s1 * 1 ~ }
..2(Dark Blue): { .cnick -r 1 | .cnick -m2s1 * 2 ~ }
..3(Dark Green): { .cnick -r 1 | .cnick -m2s1 * 3 ~ }
..4(Red): { .cnick -r 1 | .cnick -m2s1 * 4 ~ }
..5(Brown): { .cnick -r 1 | .cnick -m2s1 * 5 ~ }
..6(Purple): { .cnick -r 1 | .cnick -m2s1 * 6 ~ }
..7(Orange): { .cnick -r 1 | .cnick -m2s1 * 7 ~ }
..8(Yellow): { .cnick -r 1 | .cnick -m2s1 * 8 ~ }
..9(Light Green): { .cnick -r 1 | .cnick -m2s1 * 9 ~ }
..10(Teal): { .cnick -r 1 | .cnick -m2s1 * 10 ~ }
..11(Aqua): { .cnick -r 1 | .cnick -m2s1 * 11 ~ }
..12(Light Blue): { .cnick -r 1 | .cnick -m2s1 * 12 ~ }
..13(Pink): { .cnick -r 1 | .cnick -m2s1 * 13 ~ }
..14(Dark Grey): { .cnick -r 1 | .cnick -m2s1 * 14 ~ }
..15(Light Grey): { .cnick -r 1 | .cnick -m2s1 * 15 ~ }
}
i was referring to the code in the comment, but similar could still be said about the original code
firstly, the /nc alias itself performs many more iterations than necessary: at least as many as the number of users in the channel - and potentially more. consider what happens if someone is both oped and voiced, or, as is common on various servers, both +q (~) and +a (&). one loop will switch their colour, and a later loop will change it back. again, potential flickering.
next, think about what will happen if there were a mode change such as '+o-o+h-h+v-v' (which is perfectly possible on most networks). 6 if statements satisfied, meaning 6 calls to /nc, and 6 times the flickering. try to keep 'elseif' in mind and always ask yourself if it should be used with a string of if statements.
however, even with elseifs, it doesn't handle mode changes such as '+mv nick'. a small change to the regular expression, but still doesn't do much to improve the overall approach. at the end of the day, it is important to realize that a method involving 'only perform necessary changes' should be preferred to 'clear all and reapply' wherever possible. imagine how computer games would perform if the programmer opted to wipe the canvas and re-draw everything from scratch at each frame!
so, everytime a mode change occurs, clear the entire nicklist of colours and re-apply them? that's terribly wasteful :P you should only switch a nick's colour if they are affected by a mode change, otherwise you're going to get ugly flickers appearing across the whole nicklist.
your aim should be to resolve the colour from a given nick and channel. for example:
alias nc return $int($mid(49873, $pos(~&@%+, $left($nick($1, $2).pnick, 1)), 1) 12)
$nc(#chan, nick) returns the colour associated with nick on #chan. $gettok() may be a better idea than $mid(), in case you ever want to use any double digit colour codes.
then, when a mode change occurs, loop through, and only through, the affected nicks and change their colour status:
on *:rawmode:#:{
var %i = 1
while ($mode(%i)) {
if ($v1 ison #) cline $nc(#, $v1) # $v1
inc %i
}
}
the ison check is necessary given that $mode() also returns banmasks.