Powertrip

By knoeki on Jul 13, 2009

Just a simple little thinggy to show...:

amount of networks you are on,
amount of channels you are on,
total usermodes (~&!@%+) if any,
amount of users you have control over.

<~Knoeki> I'm on 48 channels, spread across 6 networks. Powers: 4 ~, 4 &, 1 @, 2 %, 13 +. I'm more important than 432/2110 (20.47%) lamers.

can probably be done a lot better, but that's for another time.

I've updated it a little bit, it shows a percentage too now, and fixed a bug so that it'll actually show a '0' when you do not have a certain mode anywhere.

alias powertrip {
  var %pt.net.count 1
  var %pt.net.total $scon(0)
  var %pt.chan.count 1
  while (%pt.net.count <= %pt.net.total) {
    scid $scon(%pt.net.count)
    var %tmp.chan.count 1
    var %tmp.chan.total $comchan($me, 0)
    while (%tmp.chan.count <= %tmp.chan.total) {
      inc %pt.mode.count. [ $+ [ $modenum2($comchan($me, %tmp.chan.count), $me) ] ]
      var %tmp.nick.total $nick($comchan($me, %tmp.chan.count), 0)
      var %tmp.nick.chan $comchan($me, %tmp.chan.count)
      var %tmp.nick.count 1
      while (%tmp.nick.count <= %tmp.nick.total) {
        if ($modenum2(%tmp.nick.chan, $me) > $modenum2(%tmp.nick.chan, %tmp.nick.count)) {
          inc %pt.pwn.count
        }
        inc %pt.total.nicks
        inc %tmp.nick.count
      }
      inc %tmp.chan.count
    }
    var %pt.chan.total $calc(%pt.chan.total + %tmp.chan.count)
    inc %pt.net.count
  }
  var %x 1
  while (%x <= 6) {
    if (%pt.mode.count. [ $+ [ %x ] ] == $null) {
      var %pt.mode.count. [ $+ [ %x ] ] 0
    }
    inc %x
  }
  scid -r
  say I'm on $+(,%pt.chan.total,) channels, spread across $+(,$calc(%pt.net.count - 1),) networks. Powers: $+(,%pt.mode.count.6,) ~, $+(,%pt.mode.count.5,) &, $+(,%pt.mode.count.4,) @, $+(,%pt.mode.count.3,) $+($(%),$chr(44)) $+(,%pt.mode.count.2,) +. I'm more important than $+(,%pt.pwn.count,/,%pt.total.nicks,) $+($chr(40),,$round($calc((%pt.pwn.count / %pt.total.nicks) * 100), 2),,$(%),$chr(41)) lamers.
  unset %pt.*
  unset %tmp.*
}

alias -l modenum2 {
  return $iif($left($nick($1, $2).pnick, 1) isin $prefix, $replacex($left($nick($1, $2).pnick, 1), ~, 6, !, 5, &, 5, @, 4, %, 3, +, 2), 1)
}

Comments

Sign in to comment.
DrtyDawg   -  Nov 10, 2009

Nice work again mate, handy and fun :D

 Respond  
knoeki   -  Nov 10, 2009

Updated it a bit, read description.

 Respond  
knoeki   -  Aug 14, 2009

I've deleted all the rage comments.

 Respond  
HeatedHeart   -  Aug 13, 2009

btw knoeki gave you a 7/10 nice work.

 Respond  
MaSOuD   -  Aug 13, 2009

Good work But, yes it can be better by some changes/fixes. 7/10

 Respond  
gooshie   -  Aug 12, 2009

Knoeki,
%pt.total.nicks and %pt.mode.count.1-6 did not get
declared as local variables with the var command.
A call to a variable that is not set or declared
is set as a global variable by mIRC. The first time
that an undeclared variable is incrimented mIRC will
set it to 1 (one) thus the following three lines
give the same results.
inc %tmp.nick.count
set %tmp.nick.count 1
%tmp.nick.count = 1

"...how is it even relevant to this script at all?" output => spread across $+(,$calc(%pt.net.count - 1),) networks this counts servers => var %pt.net.total $scon(0) many chat visitors wont know the difference between servers and networks so i guess its ok to use either term in this type script. The only people that need to understand the difference between $server and $network is those who script the client and are concerned with multiserver issues. Even when taking into account that this snippet counts disconnected servers and unjoined channels there is still a few count errors.
 Respond  
PATX   -  Aug 12, 2009
knoeki   -  Aug 12, 2009

Gooshie:

I have not put much effort in this, obviously ;_) I might make a better version at some point, but thanks for the feedback, which I'll address now:

The reason I've used /unset at the end, is not because I've used /set anywhere (just look!), but more because for some reason, some stray variables got left behind.

I don't get your whole point about about $network and $server, when have I ever claimed that these are the same? Also, how is it even relevant to this script at all?

Yours seems nice, but doesn't keep track of modes other than +o and +v, which is a shame imho, but might be chosen because you do not find it neccisary.

thanks for the feedback, much appreciated :_)

 Respond  
gooshie   -  Aug 10, 2009

Knoeki,
The main reason the channel count is gonna be off
is the use of the $comchan indentifier.

Total user count is gonna be off sometimes because
it will count users more than once if they are in
more than one of your channels and at the very least
could be counted easier with the $ial identifier.

All of this can be accomplished without the need for
/set and /unset %varibles to eliminate harddrive writes.

btw: $network and $server are not the same thing.
$network may have more than one $server and some
$network may allow more than one connection.
also (unfortunately) $network and $server DO NOT
have to be unique names on the planet.
The DOMAIN name MUST be unique and so must $serverip
BUT unfortunately $network and $server are sent out
by the server in the raw 001-005 lines during connect and
can be anything they set it to. This is sorta off topic
but this means if you ever write like an auto-ident to
NickServ/ChanServ maybe better to use $serverip for security.

review my snippet at: http://www.hawkee.com/snippet/6559/

 Respond  
Jamiie   -  Jul 14, 2009

Nice, works like said in description.

 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.