Remote Script Information

By Serpentsounds on Nov 28, 2009

A short but sweet snippet that gives some information about the remote script files you currently have loaded. Default echoes number of scripts loaded, as well as line total and size total in KB.

Usage: /remstats -switches

Switches:
m - Message the active window (default is echo). Useful for showing off your piles of code.
n - Include file names. The base filenames of all remote scripts you have loaded will be included in the output.
t - Verbose output. Adds a couple additional bits: the longest and largest file you have loaded.

Not a ton of functionality with this, I just made it because I was curious about how much code I actually had loaded, and I can make computers count it for me. ;)

Edit: 11/30/09
Added a couple slight optimizations. Before they were pointed out to me this time! :P

alias remstats {
  var %x = 1,%lines = 0,%names,%size = 0,%long = 0,%big,%cur
  while ($script(%x)) {
    %cur = $v1
    inc %lines $lines(%cur)
    if ($lines(%cur) > $lines(%long)) %long = %cur
    inc %size $file(%cur).size
    if (!$exists(%big)) || ($file(%cur).size > $file(%big).size) %big = %cur
    %names = %names $nopath(%cur)
    inc %x
  }
  $iif(m isin $1,msg $active,echo -a) I have $+($chr(2),$script(0),$chr(2)) remote script files loaded $+ $iif(n isin $1,$+($chr(32),$chr(40),$chr(2),%names,$chr(2),$chr(41))) $+ , for a total of $+($chr(2),%lines,$chr(2)) lines and $+($chr(2),$round($calc(%size / 1024),2),$chr(2)) $+ KB.
  $iif(t isin $1,$iif(m isin $1,msg $active,echo -a),return) Longest file: $+($chr(2),$nopath(%long),$chr(2)) at $+($chr(2),$lines(%long),$chr(2)) lines. Largest file: $+($chr(2),$nopath(%big),$chr(2)) at $+($chr(2),$round($calc($file(%big).size / 1024),2),$chr(2)) $+ KB.
}

Comments

Sign in to comment.
Ghost-writer   -  Nov 29, 2009

I have 7 remote script files loaded, for a total of 2859 lines and 135.44KB.
Longest file: remote.ini at 1524 lines. Largest file: remote.ini at 80.66KB.

Very nice.

 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.