Multi-Server User/Channel Totals

By napalm` on Sep 21, 2008

This alias will return the amount of channels you are on and the amount of users in those channels across multiple servers.

$cinfo(N,C/U).prop

N -

If N = 0 it returns value across all servers. If it's a number then it returns value for Nth server.

C/U -

C = Total channels on Nth server.
U = Total users on Nth server.

Prop -

Used in conjunction with 'U' to return total users of a certain usermode on Nth server.

Example: $cinfo(2,U).v returns total voiced users on the 2nd server you are connected to.

Example -

alias example {
  var %x 1
  while ($scon(%x).server) {
    echo $color(info) -at * $ifmatch - Users: $cinfo(%x,u) - Channels: $cinfo(%x,c)
    echo $color(info) -at * - Owners: $cinfo(%x,u).q - Ops: $cinfo(%x,u).o - Halfops: $cinfo(%x,u).h - Voice: $cinfo(%x,u).v - Reg: $cinfo(%x,u).r
    inc %x
  }
  echo $color(info) -at -
  echo $color(info) -at * Totals: Servers: $scon(0) - Users: $cinfo(0,u) - Channels: $cinfo(0,c)
  echo $color(info) -at - Owners: $cinfo(0,u).q - Ops: $cinfo(0,u).o - Halfops: $cinfo(0,u).h - Voice: $cinfo(0,u).v - Reg: $cinfo(0,u).r
}
;Multi-Server Totals
;napalm

alias -l nks {
  set %nks 1 | set %nks2 $2
  var %x 0
  while ($scon($1).nks2 isnum) {
    inc %x $ifmatch
    inc %nks
  }
  unset %nks*
  return %x
}

alias -l nks2 {
  if (%nks2) return $nick($chan(%nks),0,%nks2)
  else return $nick($chan(%nks),0)
}

alias -l chs return $chan(0)

alias cinfo {
  if ($1 == 0) || (!$isid) {
    var %x 1 , %c 0 , %u 0
    while ($scon(%x).chs) {
      inc %c $ifmatch
      inc %u $iif($prop,$nks(%x,$prop),$nks(%x))
      inc %x
    }
  } 
  if ($isid) { 
    if ($regex($2,/^[cu]$/i)) {
      if ($2 == C) return $iif($1,$scon($1).chs,%c)
      elseif ($2 == U) {
        if (!$prop) return $iif($1 > 0,$nks($1),%u)
        else return $iif($1 > 0,$nks($1,$prop),%u)
      }
      else return
    }
    else return
  }
  echo -at * Chatting with %u User $+ $iif(%u != 1,s) in %c Channel $+ $iif(%c != 1,s) on $scon(0) Server $+ $iif($scon(0) != 1,s.,.)
}

Comments

Sign in to comment.
irchainscriptz   -  May 24, 2011

poor him lol

 Respond  
napalm`   -  May 24, 2011

We know each other in real life. We actually went to grade school together. ;/

 Respond  
Jethro   -  May 20, 2011

Gee, where have you been all KronicDreamer's life? :p

 Respond  
napalm`   -  May 20, 2011

Hallo?

 Respond  
napalm`   -  Dec 06, 2008

Apparently not?

 Respond  
napalm`   -  Sep 23, 2008

Any Feedback? I won't bite. :D

 Respond  
KronicDreamer   -  Sep 22, 2008

not too shabby

 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.