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))) }
}
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
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.