View difference between Paste ID: tAQuKEic and j6jk2Sev
SHOW: | | - or go back to the newest paste.
1-
;/channels (Remade on 1/11/2014 @ 3:38AM CST) by Cinos Modnar <cinos@mtbnc.us>
1+
2-
;
2+
3
;     n: "No colors" - Strip colors from output (good for channels with control codes blocked or channels where color usage is not welcome)
4
;     a: "Action" - Use CTCP ACTION (/me) instead of PRIVMSG (normal message to channel or user) to list information
5
;     c: "Color" - Use a custom color for highlighted parts of the message. Only use the a valid number from 0 to 15. Any invalid numbers will be ignored, and the
6
;                  default color (4, red) will be used. If -n is used, this does nothing. If no color is specified, a random one is chosen.
7
8
;The beginning of the ALIAS definition
9
alias channels {
10
  var %totalchans $chan(0)
11
  var %op = 0, %hop = 0, %voice = 0, %owner = 0, %sop = 0
12
  var %n 1 
13
  if (%totalchans == 0) {
14
    $iif(a isincs $1,me is not currently on any channels.,say I am not currently in any channels.) 
15
    halt
16
  }
17
  while ($chan(%n)) {
18
    var %chans %chans $chan(%n)
19
    inc %op $iif(@ isin $nick($chan(%n),$me).pnick,1,0)
20
    inc %hop $iif($chr(37) isin $nick($chan(%n),$me).pnick,1,0)
21
    inc %voice $iif(+ isin $nick($chan(%n),$me).pnick,1,0)
22
    inc %owner $iif(~ isin $nick($chan(%n),$me).pnick,1,0)
23
    inc %sop $iif(& isin $nick($chan(%n),$me).pnick,1,0)
24
    inc %n
25
  }
26
27
  ;set the color here
28
  if (c !isincs $1) { var %col 4 }
29
  else {
30
    if ($2) {
31
      if ($2 !isnum 0-15) { var %col 4 }
32
      else { var %col $2 }
33
    }
34
    else { var %col $r(0,15) }
35
  }
36
  var %chanline $+(,%col,%chans,) $+ , a total of $+(,%totalchans,) $+(channel,$iif(%totalchans == 1,$null,s),.)
37
38
  var %opline $+(,%col,Voice) (+v/+) in $+(,%voice,) $+(channel,$iif(%voice == 1,$null,s)) ( $+ $+($round($calc(100*(%voice / %totalchans)),0),$chr(37)) $+ ), $&
39
    $+(,%col,Halfop) (+h/%) in $+(,%hop,) $+(channel,$iif(%hop == 1,$null,s)) ( $+ $+($round($calc(100*(%hop / %totalchans)),0),$chr(37)) $+ ), $&
40
    $+(,%col,Op) (+o/@) in $+(,%op,) $+(channel,$iif(%op == 1,$null,s)) ( $+ $+($round($calc(100*(%op / %totalchans)),0),$chr(37)) $+ ), $&
41
    $+(,%col,Protect) (+a/&) in $+(,%sop,) $+(channel,$iif(%sop == 1,$null,s)) ( $+ $+($round($calc(100*(%sop / %totalchans)),0),$chr(37)) $+ ), $&
42
    and $+(,%col,Owner) (+q/~) in $+(,%owner,) $+(channel,$iif(%owner == 1,$null,s)) ( $+ $+($round($calc(100*(%owner / %totalchans)),0),$chr(37)) $+ ).
43
44
  if (s !isincs $1) { $iif(a isincs $1,me is on:,say I am on:) $iif(n isincs $1,$remove($strip(%chanline),),%chanline)  }
45
  $iif(a isincs $1,me has,say I have) $iif(n isincs $1,$remove($strip(%opline),),%opline)
46
47
}
48
;EOF