|
Joined: Mar 2004
Posts: 45
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2004
Posts: 45 |
I'm trying to make an alias for /join. I want to type /j #channel1 #channel2 channel3 etc and it will join all the channels I specify.
j {
var %channels = $0
while (%channels >= 0) {
join %channels
dec %channels
}
}
Any ideas on how to make it work?
|
|
|
|
Joined: Dec 2002
Posts: 788
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 788 |
Either of the following will work and which one you use depends on your personal choice.
This will make it join the first channel, first, and the last, last.
alias j { var %i = 1 while ($numtok($1-,32) >= %i) { join $gettok($1-,%i,32) inc %i } }
This will make it join the last channel, first, and the first channel, last.
alias j { var %i = $numtok($1-,32) while (%i) { join $gettok($1-,%i,32) dec %i } }
Hope this helps.
Eamonn.
|
|
|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
/join #channel1,#channel2,#channel3
no need for a while loop...
but since you want an alias j { var %i = 1 | while ($gettok($1-,%i,32)) { join $v1 | inc %i } }
|
|
|
|
Joined: May 2004
Posts: 24
Ameglian cow
|
Ameglian cow
Joined: May 2004
Posts: 24 |
|
|
|
|
Joined: Mar 2004
Posts: 45
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2004
Posts: 45 |
One more thing...I want it to automaticlly put # in front of the channel names...
|
|
|
|
Joined: Dec 2002
Posts: 788
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 788 |
join $gettok($1-,%i,32)
becomes,
join $+(#,$gettok($1-,%i,32))
Eamonn.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Try this (put it in the Remotes section):
on *:start:unset %maxtargets.*
raw 005:* MAXTARGETS=*:set %maxtargets. $+ $cid $int($gettok($matchtok($1-,MAXTARGETS=*,1,32),2,61))
alias j {
var %i = 1, %maxt = $iif($eval($+(%,maxtargets.,$cid),2),$v1,1), %j, %chans
while %i <= $0 {
%j = 1
%chans = $null
while (%j <= %maxt) && (%i <= $0) {
%chans = $addtok(%chans, $eval($+(#$$,%i),2), 44)
inc %i
inc %j
}
join %chans
}
} It's untested but I think it should work.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Aug 2003
Posts: 314
Fjord artisan
|
Fjord artisan
Joined: Aug 2003
Posts: 314 |
$matchtok doesn't support wildcards so just leave off the * or use $wildtok, same thing
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Ahh yes, in that case it should use $wildtok, just in case there's a token like MADMAXTARGETS=MelGibson that could throw off $matchtok.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
|