mIRC Home    About    Download    Register    News    Help

Print Thread
#20478 22/04/03 08:54 PM
Joined: Mar 2003
Posts: 41
B
BORR Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
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 frown

#20479 22/04/03 09:27 PM
Joined: Mar 2003
Posts: 272
C
Fjord artisan
Offline
Fjord artisan
C
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:

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.
#20480 23/04/03 09:57 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
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).
Code:
[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
#20481 23/04/03 09:38 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
BTW, a loop in decreasing order would save the last IF smile
Code:
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
  }
}

#20482 23/04/03 10:01 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
It doesn't avoid it. Yours checks "if %i == 1" each time "$numtok(%a,32) != $modespl" wink

#20483 23/04/03 11:21 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
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.

#20484 24/04/03 06:36 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
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 wink

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
#20485 24/04/03 09:51 AM
Joined: Dec 2002
Posts: 191
N
Vogon poet
Offline
Vogon poet
N
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

#20486 24/04/03 02:12 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Right, it can't be $ifmatch blush

#20487 24/04/03 02:43 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
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

Link Copied to Clipboard