Project

General

Profile

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

Mr. BS, 04/03/2014 06:38 PM

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

    
5
; Script
6

    
7
on 1:LOAD: {
8
  UserConf
9
  setPrefixColors
10
}
11

    
12
on 1:UNLOAD: {
13
  unset %RColor.*
14
}
15

    
16
alias -l UserConf {
17
  set %RColor.nickConfig $strip($readini(config.ini, Messages, prefixuser),c)
18
  set %RColor.actionConfig $strip($readini(config.ini, Messages, prefixemote),c)
19
  set %RColor.Enabled 1
20
  set %RColor.Timestamp.Enabled 1
21
  set %RColor.Action.Enabled 1
22
  set %RColor.prefixColored 1
23
}
24

    
25
alias -l setPrefixColors {
26
  set %RColor.prefixColorAdmin 4
27
  set %RColor.prefixColorOwner 4    
28
  set %RColor.prefixColorProtect 9
29
  set %RColor.prefixColorOp 7
30
  set %RColor.prefixColorHalfOp 11
31
  set %RColor.prefixColorVoice 13
32
}
33

    
34
;channel
35
on ^*:TEXT:*:#: {
36
  if (%RColor.Enabled == 1) {
37
    ; znc playback
38
    if ($nick == ***) && (Buffer Playback... isin $1-) {
39
      set -e %RColor.znc.playback. [ $+ [ $cid ] $+ . $+ [ $chan ] ] 1
40
      echo $EchoMode # $nickFormated $1-
41
    }
42
    if ($znc.playback) && ($nick != ***) {
43
      echo $TheColor -rlmbf # $iif(%RColor.Timestamp.Enabled == 1,$1) $nickFormated $2-
44
    }
45
    if ($nick == ***) && (Playback Complete. isin $1-) {
46
      unset %RColor.znc.playback. [ $+ [ $cid ] $+ . $+ [ $chan ] ]
47
      echo $EchoMode # $nickFormated $1-
48
      halt
49
    }
50
    ; normal messages
51
    if (!$znc.playback) {
52
      echo $TheColor $EchoMode # $nickFormated $1-
53
    }
54
    halt
55
    }
56
}
57

    
58
;action
59
on ^*:ACTION:*:#: {
60
  if ($znc.playback) {
61
    echo $iif(%RColor.Action.Enabled == 1, $TheColor) $EchoMode # $actionFormated $2-
62
  halt
63
  }
64
  if (%RColor.Action.Enabled == 1) {
65
    echo $TheColor $EchoMode # $actionFormated $1-
66
    halt
67
  }
68
}
69

    
70
alias -l TheColor {
71
  if ($nick(#,$nick).color > 0) {
72
    return $nick(#,$nick).color
73
  }
74
}
75

    
76
alias -l EchoMode {
77
  if (%RColor.Timestamp.Enabled == 1) {
78
    return -trlmbf
79
  }
80
  return -rlmbf  
81
}
82

    
83
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) }
84
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) }
85
alias -l prefixReplace {
86
  var %prefix $left($nick(#,$nick,a,r).pnick,1)
87
  if ($regex(%prefix,/([!~&@%+])/)) && (%RColor.prefixColored == 1) {
88
    ; ! = $chr(33) ~ = $chr(126) & = $chr(38) @ $chr(64) % = $chr(37) + = $chr(43)
89
    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)))
90
  }
91
  return $1
92
}
93
alias -l znc.playback { return %RColor.znc.playback. [ $+ [ $cid ] $+ . $+ [ $chan ] ] }
94

    
95
alias RColorPreview {
96
  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)
97
}
98

    
99
menu menubar {
100
  -
101
  $iif(%RColor.Enabled == 1, $style(1),) 🎨 RColor Messages
102
  .$iif(%RColor.Enabled == 1, Disable, Enable) : $iif(%RColor.Enabled == 1, unset %RColor.Enabled, set %RColor.Enabled 1)
103
  .$iif(%RColor.Timestamp.Enabled == 1, $style(1),) Use timestamp : $iif(%RColor.Timestamp.Enabled == 1, unset %RColor.Timestamp.Enabled, set %RColor.Timestamp.Enabled 1)
104
  .$iif(%RColor.Action.Enabled == 1, $style(1),) Apply for action : $iif(%RColor.Action.Enabled == 1, unset %RColor.Action.Enabled, set %RColor.Action.Enabled 1)
105
  .$iif(%RColor.prefixColored == 1, $style(1),) Color prefix
106
  ..$iif(%RColor.prefixColored == 1, Disable, Enable):$iif(%RColor.prefixColored == 1, unset %RColor.prefixColored, set %RColor.prefixColored 1)
107
  ..-
108
  ..$style(2)Set Colors $+ $chr(65306)
109
  ..$chr(33) $+ Admin            %RColor.prefixColorAdmin:$setColorInput($chr(33), Admin)
110
  ..$chr(126) $+ Owner          %RColor.prefixColorOwner:$setColorInput($chr(126), Owner)
111
  ..$chr(38) $+ $chr(38) $+ Protect        %RColor.prefixColorProtect:$setColorInput($chr(38), Protect)
112
  ..$chr(64) $+ Op                      %RColor.prefixColorOp:$setColorInput($chr(64), Op)
113
  ..$chr(37) $+ HalfOp       %RColor.prefixColorHalfOp:$setColorInput($chr(37), HalfOp)
114
  ..$chr(43) $+ Voice               %RColor.prefixColorVoice:$setColorInput($chr(43), Voice)
115
  ..-
116
  ..Preview:RColorPreview
117
  ..Reset:if ($$?!="Reset prefix colors to default?") { setPrefixColors }
118
  .-
119
  .About:run http://dev.adiirc.com/boards/5/topics/163
120
  -
121
}
122

    
123
alias -l setColorInput {
124
  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. }
125
}
(5-5/6)