Mass modes

By Lindrian on Jun 06, 2007

I made this script to simply be able to massivly add modes to a channel/users, thought i might share it with u guys. Just made it. Paste it in remotes and type /mass +o /mass -o etc.
$1 must be specefied for it to work.

works with modes o h v e I.

Enjoy.

alias mass {
  if ( $nick($active,$me,oh) ) && ($active ischan) && ($1) {
    if $regex( $1,/^[+-]?[ohveI]$/ ) {
      var %a = 1,%b = $nick($chan,0), %c, %d = $left($1,1), %e = $right($1,1), %f = $iif($regex($right($1,1),/^[ovh]$/),yes,no)
      while ( %a <= %b ) {
        %c = %c $iif(%f == yes,$nick($chan,%a),$address($nick($chan,%a),2))
        if ( $numtok(%c,32) == $modespl ) {
          mode $active $+(%d,$str(%e,%a)) $remove(%c,$iif(%f == yes,$me,$address($me,2)))
          var %c = ""
        }
        inc %a
      }
    }
  }
  if ( %c ) { mode $active $+(%d,$str(%e,$numtok(%c,32))) $remove(%c,$iif(%f == yes,$me,$address($me,2))) }
}

Comments

Sign in to comment.
tv3636   -  Apr 10, 2009

I just wrote one on my own without looking at others first just for fun and I was considering posting it since I didn't see one very similar to it, and then I saw yours. Yours is probably better (I don't know regex/tokens) but from looking at it it works essentially the same way. If you're interested here's my code:

alias mass {
  var %out1 = $left($1,1) | var %out2 | var %mass = 1
  while (%mass <= $nick($chan,0)) { 
    %out1 = %out1 $+ $lower($right($1,1)) | %out2 = %out2 $nick($chan,%mass) 
    if ($calc(%mass % 6) == 0) { mode $chan %out1 %out2 | var %out2 | %out1 = $left($1,1) }
    inc %mass 
  }
  mode $chan %out1 %out2
}

Feel free to (and please do) critique it :)

And nice job :D

 Respond  
Solo   -  Jun 07, 2007

Alot better and i gave it a better score. You were right to say by giving a score of one was harsh. I enjoy looking at most of your scripts.

 Respond  
Lindrian   -  Jun 07, 2007

Updated the code a little for u solo. MIght not be the best, but but. And aswell not \'doing all modes\' u want, as problems will prolly occus from network to network.

I added +eI, as I use them on my network.

Enjoy.

 Respond  
Lindrian   -  Jun 07, 2007

I see. well, giving a score of 1 is kind of your style id say. However, i added the extra checks for the new users around here.

I made it kind of quick id say. I dont use the cheks myself. And if this was specefied for excepts or not, is not the point here.

 Respond  
Solo   -  Jun 07, 2007

You are declaring variables before any checks. It would make the script alot neater if you would do all the if (%c) && ($nick($active,$me,oh)) { mode $iif($active ischan,$v1,echo -a This feature can only be used in channels.) blah blah blah checks before the script even tries to execute, so the script is very messy. Also there are scripts that are all in one and not for one specific purpose like this one is. for example http://www.hawkee.com/snippet/2166/ is the best one made so far for this. In my opinion there is nothing like a short efficient script thats is fluent and parses nice and efficient without all the $iif bottleneck checks in the middle. but even those are in the wrong places as the script tries to execute before these checks are being made.

 Respond  
Lindrian   -  Jun 07, 2007

A score without a comment, lol :D

 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.