|
Joined: Mar 2003
Posts: 41
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 41 |
I want 2 voice everybody in the channel (whos not voiced/oped already) when "I" join that channel. Do U know how 2 do that? Since I havent figured out yet how 2 return nicks in ur nick list
|
|
|
|
Joined: Mar 2003
Posts: 272
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 272 |
The better option would be to trigger that script when you get Opped, and not when you join a channel. So here's the code: alias regvo {
if ($1) && ($me isop $1) {
var %i = 1, %tot = $nick($1,0)
while (%i <= %tot) {
if ($nick($1,%i) isreg $1) { .mode $1 +v $nick($1,%i) | inc %i 1 }
else { inc %i 1}
}
}
}
On 1:OP:[color:red]#Channel[/color]:{ regvo $chan }
- cF Dedicated helper for rent.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
Having one +v per /mode command is a good way to get flooded off. You should make use of $modespl and pack the maximum number of nicks in one /mode. Also, instead of looping through the entire nicklist and checking each nick with isreg (slow) , you should loop through $nick(#channel,N, r). [color:green]; syntax: /regvo [channel]
; if [channel] isn't specified it uses the currently active channel, if any[/color]
alias regvo {
var %chan = $iif($1 ischan,$1,#), %i = 1, %a
if $me !isop %chan { return }
while $nick(%chan,%i,r) {
%a = %a $ifmatch
if $numtok(%a,32) == $modespl {
mode %chan + $+ $str(v,$modespl) %a
%a =
}
inc %i
}
if $numtok(%a,32) { mode %chan + $+ $str(v,$ifmatch) %a }
}
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
BTW, a loop in decreasing order would save the last IF 
alias regvo2 {
var %chan = $iif($1,$1,#), %i = $nick(%chan,0,r), %a
if $me !isop %chan { return }
while %i {
%a = %a $nick(%chan,%i,r)
if $numtok(%a,32) == $modespl || %i == 1 {
mode %chan + $+ $str(v,$ifmatch) %a
%a =
}
dec %i
}
}
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
It doesn't avoid it. Yours checks "if %i == 1" each time "$numtok(%a,32) != $modespl"
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
It's when one decides whether he wants the faster or the shorter... when the speed isn't noticeable I'd go for the shorter.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
The speed difference could be (barely, I guess) noticeable if one with a slow pc were to voice a channel of ~1000 regulars but nobody should attempt that anyway  I usually go for the version with the least (logical) redundancies and the best speed performance, unless the other method is really shorter/prettier (in most cases, these two go together anyway).
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Dec 2002
Posts: 191
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 191 |
That wont work correctly for less users than $modespl,
Example $modespl = 13 you go to voice 5 user the $numtok wont == 13 so then defaults to %i which will be 1 if $numtok(%a,32) == $modespl || %i == 1 { mode %chan + $+ $str(v,$ifmatch) %a the $ifmatch will return 1 not the number of tokens which will result in mirc sending to the server mode #channel +v nick1 nick2 nick3 nick4 nick5 not mode #channel +vvvvv nick1 nick2 nick3 nick4 nick5
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
Right, it can't be $ifmatch
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
It can be $modespl though (even if it's slightly abusive to have +vvvvvvvvvvvvv nick1 nick2).
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
|