February 29, 2004

Mass opping and voicing

This snippet uses a custom identifier, as well as $str, $modespl, tokens and a while loop to mass op, voice, deop or devoice several nicknames at the same time, while keeping the mode changes on as few lines as possible. Goes in remotes (alt-R).
Usage: /mass [op|deop|voice|devoice] nick1 nick2 nick3 nick4...

alias mass {
  var %o = $numtok($2-,32)
  var %mp = $gettok($mstring($1),1,32)
  var %m = $gettok($mstring($1),2,32)
  if (%o <= $modespl) {
    mode $chan $+(%mp,$str(%m,%o)) $2-
  }
  else {
    var %on = $2-
    while %o {
      tokenize 32 %on
      mode $chan $+(%mp,$str(%m,$modespl)) $($+($,1-,$modespl),2)
      var %on = $deltok(%on,$+(1,-,$modespl),32)
      var %o = $numtok(%on,32)
    }
  }
}


alias -l mstring { if ($1 = op) { return + o } if ($1 = deop) { return - o } if ($1 = voice) { return + v } if ($1 = devoice) { return - v } }
Posted by sailoreagle at February 29, 2004 04:03 PM | Scripts
Comments