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.*
}