Single network Bragspam script

By GrimReaper on Jul 15, 2010

I got bored with all the "Multi Networked" brag script's.. So I decided to /try/ make one for a single network.

Syntax used is: /bragz

alias bragz {
  say I am currently in $chan(0) $iif($chan(0) == 1,channel,channels) on $+($network,$chr(44)) of which I have $iif($netowner == $null,none,$netowner) of owner status, $iif($netadmin == $null,0,$netadmin) $iif($netadmin == 1,admin,admins) $+ , $iif($netops == $null,0,$netops) $iif($netops == 1,op,ops) $+ , $iif($nethops == $null,0,$nethops) $iif($nethops == 1,halfop,halfops) $+ , $iif($netvoice == $null,0,$netvoice) $iif($netvoice == 1,voice,voices) and $iif($netreg == $null,0,$netreg) $iif($netreg == 1,channel,channels) with no status and channel power over $netpower $iif($netpower == 1,person,people) $+ . $iif(o isincs $usermode,I also have an oline on this network.) 
}

alias netowner {
  var %chan = 1
  while (%chan <= $chan(0)) {
    if ($left($nick($chan(%chan),$me).pnick,1) != ~) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == ~) { 
      var %ownah = $calc(%ownah +1)
      inc %chan 
    }
  }
  return %ownah
}

alias netadmin {
  var %chan = 1
  while (%chan <= $chan(0)) {
    if ($left($nick($chan(%chan),$me).pnick,1) != &) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == &) { 
      var %adminz = $calc(%adminz +1)
      inc %chan 
    }
  }
  return %adminz
}

alias netops {
  var %chan = 1
  while (%chan <= $chan(0)) {
    if ($left($nick($chan(%chan),$me).pnick,1) != @) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == @) { 
      var %netopz = $calc(%netopz +1)
      inc %chan 
    }
  }
  return %netopz
}

alias nethops {
  var %chan = 1
  while (%chan <= $chan(0)) {
    if ($left($nick($chan(%chan),$me).pnick,1) != %) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == %) { 
      var %halfop = $calc(%halfop +1)
      inc %chan 
    }
  }
  return %halfop
}

alias netvoice {
  var %chan = 1
  while (%chan <= $chan(0)) {
    if ($left($nick($chan(%chan),$me).pnick,1) != +) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == +) { 
      var %voices = $calc(%voices +1)
      inc %chan 
    }
  }
  return %voices
}

alias netreg {
  var %chan = 1
  while (%chan <= $chan(0)) {
    if ($left($nick($chan(%chan),$me).pnick,1) == +) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == %) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == @) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == &) { inc %chan }
    elseif ($left($nick($chan(%chan),$me).pnick,1) == ~) { inc %chan }
    else { 
      var %regularz = $calc(%regularz +1)
      inc %chan 
    }
  }
  return %regularz
}

alias netpower {
  set %net.power 0
  set %net.scounter 1
  while (%net.scounter <= $chan(0)) {
    if ($left($nick($chan(%net.scounter),$me).pnick,1) == ~) {
      inc %net.power $netpowerchan($chan(%net.scounter), ~&@%+, ~&@%+)
    }
    elseif ($left($nick($chan(%net.scounter),$me).pnick,1) == &) {
      inc %net.power $netpowerchan($chan(%net.scounter), @%+, ~&@%+)
    }
    elseif ($left($nick($chan(%net.scounter),$me).pnick,1) == @) {
      inc %net.power $netpowerchan($chan(%net.scounter), @%+, ~&@%+)
    }
    elseif ($left($nick($chan(%net.scounter),$me).pnick,1) == %) {
      inc %net.power $netpowerchan($chan(%net.scounter), +, ~&@%+)
    }
    inc %net.scounter
  }
  return %net.power
}

alias netpowerchan {
  set %net.powerchan 0
  set %net.rpccounter 1
  while (%net.rpccounter <= $nick($1, 0)) {
    if ($nick($1, %net.rpccounter) != $me) {
      if ($left($nick($1,%net.rpccounter).pnick,1) isin $2 || $left($nick($1,%net.rpccounter).pnick,1) !isin $3) {
        inc %net.powerchan
      }
    }
    inc %net.rpccounter
  }
  return %net.powerchan
}

Comments

Sign in to comment.
Jethro   -  Jul 15, 2010

No, I didn't imply anything about the use of regex, did I? Regex is good, but it's not to be used in an abusive way; and not every code should be adapted with it. WorldDMT has just demonstrated my point of using one alias instead of multiple, repetitive ones.

 Respond  
Aucun50   -  Jul 15, 2010

Jethro_ we where waiting for you to post about this, Grim said "I bet he's going to say you can put them all into one alias or some kind of $regex something". :)

 Respond  
WorldDMT   -  Jul 15, 2010

hi
no need to $calc(%var +1) u can do var %ownah %ownah + 1 or just do /inc %ownah

i think u can do all that alias by one

P.S: code not tested

alias Wbragz {
  var %x 1,%~,%&,%@,%%,%+,%r,%n
  while $chan(%x) {
    var %p $left($nick($v1,$me).pnick,1)
    if ($istok(~.&.@.%.+,%p,46)) inc % $+ %p
    else inc %r
    inc %n $nick($chan(%x),0)
    inc %x
  }
  say I am currently in $chan(0) $iif($chan(0) == 1,channel,channels) on $+($network,$chr(44)) of which I have $iif(%~,none,$v1) of owner status, $iif(%&,0,$v1) $iif(%& == 1,admin,admins) $+ , $iif(%@,0,$v1) $iif(%@ == 1,op,ops) $+ , $iif(%%,0,$v1) $iif(%% == 1,halfop,halfops) $+ , $iif(%+,0,$v1) $iif(%+ == 1,voice,voices) and $iif(%r,0,$v1) $iif(%r == 1,channel,channels) with no status and channel power over %n $iif(%n == 1,person,people) $+ . $iif(o isincs $usermode,I also have an oline on this network.)
}

result:

  • your code is 3207 bytes
  • my code is 689 bytes

and u can do better

 Respond  
Jethro   -  Jul 15, 2010

You could've used one alias for netowner, netadmin, netops, netvoice and netreg. There are some other things to be shortened and adjusted without unneeded repetitions.

 Respond  
Henco   -  Jul 15, 2010

awesome!

 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.