Project

General

Profile

[script] Random Nick Color message » Random Nick Color message v0.4.ini

Mr. BS, 04/11/2014 04:51 PM

 
; http://dev.adiirc.com/boards/5/topics/163
; outputs same nick random color for the message
; v0.4 by pereba

; Script

on 1:LOAD: {
UserConf
setPrefixColors
UserIni
}

; to update vars when reload the script
on 1:START: {
UserIni
}

on 1:UNLOAD: {
unset %RColor.*
}
;$readini(config.ini, Tips, UseTips) tips: $readini(config.ini, Tips, Tips)
alias -l UserIni {
set %RColor.nickConfig $strip($readini(config.ini, Messages, prefixuser),c)
set %RColor.actionConfig $strip($readini(config.ini, Messages, prefixemote),c)
set %RColor.TipTimes $readini(config.ini, Tips, TipTimes)
set %RColor.isntFocusedTips $readini(config.ini, Tips, FocusedTips)
set %RColor.msgTips $left($readini(config.ini, Tips, Tips),1)
}

alias -l UserConf {
set %RColor.Enabled 1
set %RColor.Timestamp.Enabled 1
set %RColor.Action.Enabled 1
set %RColor.prefixColored 1
}

alias -l setPrefixColors {
set %RColor.prefixColorAdmin 4
set %RColor.prefixColorOwner 4
set %RColor.prefixColorProtect 9
set %RColor.prefixColorOp 7
set %RColor.prefixColorHalfOp 11
set %RColor.prefixColorVoice 13
}

;channel
on ^*:TEXT:*:#: {
if (%RColor.Enabled == 1) {
; znc playback
if ($nick == ***) && (Buffer Playback... isin $1-) {
set -e %RColor.znc.playback. [ $+ [ $cid ] $+ . $+ [ $chan ] ] 1
echo $EchoMode # $nickFormated $1-
}
if ($znc.playback) && ($nick != ***) {
echo $TheColor -rlmbf # $iif(%RColor.Timestamp.Enabled == 1,$1) $nickFormated $2-
}
if ($nick == ***) && (Playback Complete. isin $1-) {
unset %RColor.znc.playback. [ $+ [ $cid ] $+ . $+ [ $chan ] ]
echo $EchoMode # $nickFormated $1-
halt
}
; normal messages
if (!$znc.playback) {
echo $TheColor $EchoMode # $nickFormated $1-
if ($tips) && (%RColor.msgTips == 1) {
if ($appactive) && (%RColor.isntFocusedTips == true) { halt }
noop $tip(messages,Channel Message $network,$nick on # says $+ : $strip($1-),%RColor.TipTimes)
}
}
halt
}
}

;action
on ^*:ACTION:*:#: {
if ($znc.playback) {
echo $iif(%RColor.Action.Enabled == 1, $TheColor) $EchoMode # $actionFormated $2-
halt
}
if (%RColor.Action.Enabled == 1) {
echo $TheColor $EchoMode # $actionFormated $1-
if ($tips) && (%RColor.msgTips == 1) {
if ($appactive) && (%RColor.isntFocusedTips == true) { halt }
noop $tip(messages,Channel Action $network,$nick on # $+ : $strip($1-),%RColor.TipTimes)
}
halt
}
}

alias -l TheColor {
if ($nick(#,$nick).color > 0) {
return $nick(#,$nick).color
}
}

alias -l EchoMode {
if (%RColor.Timestamp.Enabled == 1) {
return -trlmbf
}
return -rlmbf
}

alias -l actionFormated { var %nc $replace(%RColor.actionConfig, $!pnick, $iif($nick == ***, ***, $nick($chan,$nick).pnick), $!status, $left($nick(#,$nick,a,r).pnick,1), $!nick, $nick) | return $prefixReplace(%nc) }
alias -l nickFormated { var %nc $replace(%RColor.nickConfig, $!pnick, $iif($nick == ***, ***, $left($nick(#,$nick,a,r).pnick,1) $+ $nick), $!status, $left($nick(#,$nick,a,r).pnick,1), $!nick, $nick) | return $prefixReplace(%nc) }
alias -l prefixReplace {
var %prefix $left($nick(#,$nick,a,r).pnick,1)
if ($regex(%prefix,/([!~&@%+])/)) && (%RColor.prefixColored == 1) {
; ! = $chr(33) ~ = $chr(126) & = $chr(38) @ $chr(64) % = $chr(37) + = $chr(43)
return $replace($1, $chr(33), $+($chr(3),%RColor.prefixColorAdmin,$chr(126),$chr(3)), $chr(126), $+($chr(3),%RColor.prefixColorOwner,$chr(126),$chr(3)), $chr(38), $+($chr(3),%RColor.prefixColorProtect,$chr(38),$chr(3)), $chr(64), $+($chr(3),%RColor.prefixColorOp,$chr(64),$chr(3)), $chr(37), $+($chr(3),%RColor.prefixColorHalfOp,$chr(37),$chr(3)), $chr(43), $+($chr(3),%RColor.prefixColorVoice,$chr(43),$chr(3)))
}
return $1
}
alias -l znc.playback { return %RColor.znc.playback. [ $+ [ $cid ] $+ . $+ [ $chan ] ] }

alias RColorPreview {
echo -ag $+( $chr(3), %RColor.prefixColorAdmin, $chr(2), $chr(33), $chr(2), $chr(3), Admin, $chr(160) $chr(3), %RColor.prefixColorOwner, $chr(2), $chr(126), $chr(2), $chr(3), Owner, $chr(160) $chr(3), %RColor.prefixColorProtect, $chr(2), $chr(38), $chr(2), $chr(3), Protect, $chr(160) $chr(3), %RColor.prefixColorOp, $chr(2), $chr(64), $chr(2), $chr(3), Op, $chr(160) $chr(3), %RColor.prefixColorHalfOp, $chr(2), $chr(37), $chr(2), $chr(3), HalfOp, $chr(160) $chr(3), %RColor.prefixColorVoice, $chr(2), $chr(43), $chr(2), $chr(3), Voice)
}

menu menubar {
-
$iif(%RColor.Enabled == 1, $style(1),) 🎨 RColor Messages
.$iif(%RColor.Enabled == 1, Disable, Enable) : $iif(%RColor.Enabled == 1, unset %RColor.Enabled, set %RColor.Enabled 1)
.$iif(%RColor.Timestamp.Enabled == 1, $style(1),) Use timestamp : $iif(%RColor.Timestamp.Enabled == 1, unset %RColor.Timestamp.Enabled, set %RColor.Timestamp.Enabled 1)
.$iif(%RColor.Action.Enabled == 1, $style(1),) Apply for action : $iif(%RColor.Action.Enabled == 1, unset %RColor.Action.Enabled, set %RColor.Action.Enabled 1)
.$iif(%RColor.prefixColored == 1, $style(1),) Color prefix
..$iif(%RColor.prefixColored == 1, Disable, Enable):$iif(%RColor.prefixColored == 1, unset %RColor.prefixColored, set %RColor.prefixColored 1)
..-
..$style(2)Set Colors $+ $chr(65306)
..$chr(33) $+ Admin %RColor.prefixColorAdmin:$setColorInput($chr(33), Admin)
..$chr(126) $+ Owner %RColor.prefixColorOwner:$setColorInput($chr(126), Owner)
..$chr(38) $+ $chr(38) $+ Protect %RColor.prefixColorProtect:$setColorInput($chr(38), Protect)
..$chr(64) $+ Op %RColor.prefixColorOp:$setColorInput($chr(64), Op)
..$chr(37) $+ HalfOp %RColor.prefixColorHalfOp:$setColorInput($chr(37), HalfOp)
..$chr(43) $+ Voice %RColor.prefixColorVoice:$setColorInput($chr(43), Voice)
..-
..Preview:RColorPreview
..Reset:if ($$?!="Reset prefix colors to default?") { setPrefixColors }
.-
.About:run http://dev.adiirc.com/boards/5/topics/163
-
}

alias -l setColorInput {
var %c $replace($$?"Prefix $1 $+ $2 Color. Hint: press ctrl+k to open the color picker.", $chr(3),) | if (%c isnum 0-15) { set %RColor.prefixColor $+ $2 %c | echo -ag $+($chr(3),%c,$chr(2),$1,$chr(2),$chr(3),$2) prefix color changed. }
}
(6-6/6)