Mass Modes

By TokenMaster on Sep 08, 2005



/mass +v (Mass Voice)



/mass +o (Mass Op)



/mass -v (Mass Devoice)



/mass -o (Mass Deop)



Like it? I fixed the code because of some suggestions, thanks

alias mass {
  if ($me !isop #) {
    echo -a Error : You are not op on $chan
  }
  else {
    if ($regex($1,/\Q+v\E/i) == 1) {
      echo -a +V
      var %x 1
      while %x <= $nick(#,0,r) {
        set %x.nick %x.nick $nick(#,%x,r)
        if $numtok(%x.nick,32) == $modespl { mode # + $+ $str(v,$modespl) %x.nick | unset %x.nick }
        inc %x
      }
      if %x.nick { mode # + $+ $str(v,$modespl) %x.nick | unset %x.nick }
    }
    if ($regex($1,/\Q-v\E/i) == 1) {
      var %x 1
      while %x <= $nick(#,0,v) {
        set %x.nick %x.nick $nick(#,%x,v)
        if $numtok(%x.nick,32) == $modespl { mode # - $+ $str(v,$modespl) %x.nick | unset %x.nick }
        inc %x
      }
      if %x.nick { mode # - $+ $str(v,$modespl) %x.nick | unset %x.nick }
    }
    if ($regex($1,/\Q+o\E/i) == 1) {
      var %x 1
      while %x <= $nick(#,%x,a) {
        set %x.nick %x.nick $nick(#,%x,a)
        if $numtok(%x.nick,32) == $modespl { mode # + $+ $str(o,$modespl) %x.nick | unset %x.nick }
        inc %x
      }
      if %x.nick { mode # + $+ $str(o,$modespl) %x.nick | unset %x.nick }
    }
    if ($regex($1,/\Q-o\E/i) == 1) {
      var %x 1
      while %x <= $nick(#,%x,o) {
        set %x.nick %x.nick $remove($nick(#,%x,o),$me)
        if $numtok(%x.nick,32) == $modespl { mode # - $+ $str(o,$modespl) %x.nick | unset %x.nick }
        inc %x
      }
      if %x.nick { mode # - $+ $str(o,$modespl) %x.nick | unset %x.nick }
    }
  }
}

Comments

Sign in to comment.
EliteT0kr   -  Sep 10, 2005

too much code for something so simple.

regex isn\'t necessary for this.

 Respond  
TokenMaster   -  Sep 10, 2005

Yes Yoinx, it could be done shorter .. the $iif .. hmm i like the idea :)
I do it as soon as i finish my Gui Engine :)

 Respond  
anthalus   -  Sep 09, 2005

I have to echo Quickstep on this one, no need to use $regex if a simple command will work....

 Respond  
Yoinx   -  Sep 09, 2005

though I dont recall either checking if you are an op.... resulting in errors.

 Respond  
Yoinx   -  Sep 09, 2005

Here\'s one that I made for the nicklist,
http://www.hawkee.com/snippet.php?snippet_id=670
and one xdaemon made for the command line
http://www.hawkee.com/snippet.php?snippet_id=696

Just for examples of how this code could be made a bit shorter.

 Respond  
QuickStep   -  Sep 09, 2005

few things that seem unclear to me:
-why applying a regex on a documented parameter, if ($1 = +o) seems well enough for me...?
-why make 4 blocks of code for every parameter whilst the only difference is either the \'+\' or the \'-\' OR the \'v\' or the \'o\'. All can be combined to 1 block of code with 2 simple $iif

 Respond  
Lord Kiam   -  Sep 09, 2005

nice thats really good i rated it 9

 Respond  
TokenMaster   -  Sep 09, 2005

anthalus, do you like it the new way ?

 Respond  
TokenMaster   -  Sep 09, 2005

Hell yeah .. why not .. 10x for the idea..
I can include something with regex like $regex($2,/\Q+o\E/i)
Hmm it will come /mass +o
Cool i like it but didn`t come to my mind sorry :)

 Respond  
xDaeMoN   -  Sep 08, 2005

Right. What I meant was, so you don\'t have to use the /unset command. ;)

 Respond  
TokenMaster   -  Sep 08, 2005

by the way, i messaged you privately on mIRC .. my nick is {{CrAdLe}} .. talk to me :)

 Respond  
TokenMaster   -  Sep 08, 2005

yeah, with else it will do ..
Well, the variables are global yeah, but they unset themselves
no need of var %nick etc ..

 Respond  
xDaeMoN   -  Sep 08, 2005

A few comments:

\" elseif ($me isop #) {\" <- you can replace this with \"else {\" since you already said in the If statement that if you are not an op.

Also make the variables local instead of global so you don\'t have to unset it.

 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.