March 24, 2004

Power check

A self-serving alias more than an useful one, but I was bored and wanted to try and script something like this. :)
This alias, when you type /power, will display the amount of channels you have ops, halfops, voice, or are a regular user in across all channels and networks you are in, as well as calculate how many channels and users you have power on.
If you type it in a channel or message window, it will message the results to that channel or message window; if you type it anywhere else (status window, custom window) it will echo the results to the active window.
Sample output:

<sailoreagle> Power: I am opped in 7, voiced in 1, regular in 1 out of 9 channels over 2 networks. This means I have power over 77.8% channels, which is 28/46 (60.9%) users.

Goes in remotes.

alias power {
  var %conns = $scon(0)
  while (%conns) {
    scon %conns
    var %c = $chan(0)
    inc %power.total $chan(0)
    while (%c) {
      inc %power.totalusers $nick($chan(%c),0)
      if ($me isop $chan(%c)) {
        inc %power.oppedchans
        inc %power.users $nick($chan(%c),0)
      }
      elseif ($me ishop $chan(%c)) { inc %power.halfopchans }
      elseif ($me isvoice $chan(%c)) { inc %power.voicechans }
      else { inc %power.regchans }
      dec %c
    }
    dec %conns
  }
  if ($active != Status Window) && (@ !isin $active) {
    msg $active Power: I am $iif(%power.oppedchans,opped in $+(%power.oppedchans,$chr(44))) $iif(%power.halfopchans,halfopped in $+(%power.halfopchans,$chr(44))) $iif(%power.voicechans,voiced in $+(%power.voicechans,$chr(44))) $iif(%power.regchans,regular in %power.regchans) out of %power.total channels over $scon(0) networks. This means I have power over $round($calc((%power.oppedchans / %power.total) * 100),1) $+ % channels, which is $+(%power.users,/,%power.totalusers) ( $+ $round($calc((%power.users / %power.totalusers) * 100),1) $+ % $+ ) users.
  }
  else {
    echo $color(info) -ta * Power: I am $iif(%power.oppedchans,opped in $+(%power.oppedchans,$chr(44))) $iif(%power.halfopchans,halfopped in $+(%power.halfopchans,$chr(44))) $iif(%power.voicechans,voiced in $+(%power.voicechans,$chr(44))) $iif(%power.regchans,regular in %power.regchans) out of %power.total channels over $scon(0) networks. This means I have power over $round($calc((%power.oppedchans / %power.total) * 100),1) $+ % channels, which is $+(%power.users,/,%power.totalusers) ( $+ $round($calc((%power.users / %power.totalusers) * 100),1) $+ % $+ ) users.
  }
  unset %power.*
}
Posted by sailoreagle at March 24, 2004 07:16 PM | Scripts
Comments

You *would* make a script like this!

Posted by: Mystery Poster at March 28, 2004 05:51 AM

I return after wandering the world for years and yet you haven't updated. Don't tell me you've given up. Fight! Fight!

Couple things. One, that UBB code still ain't gonna work. Two, an -a switch to make it echo would be nice for those few times when you're tired of lording it over the proles.

Posted by: Mystery Poster at April 16, 2004 07:19 AM

*razzes* I've been busy, so bite me!

(I'll have a couple scripts to add soon, though.)

And it'll echo if you do it in the status window or in a custom window. It's also easy enough to change around so it ALWAYS echoes. *shrugs*

Posted by: sailoreagle at April 16, 2004 01:04 PM