|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
test.txt: nick1 nick2 nick3
Need to send message to theese all nicks..
var %i 1 var %all $+(dzd/,$nick,_viesi.txt) while (%i <= %all) { /msg %i Message for you! inc %i
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Mar 2005
Posts: 212
Fjord artisan
|
Fjord artisan
Joined: Mar 2005
Posts: 212 |
im not sure i follow what your doing anyways try $read and $lines
hopefully this helps perhaps it would be easier if you showed the entire script
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
hmm well /msg nick1,nick2nick3 as you have the text file, try this
alias msglist {
var %lines = $lines(nicks.txt)
var %i = 1
while (%i <= %lines) {
var %list = %list $+ $chr(44) $+ $read(nicks.txt,%i)
inc %i
}
msg %list $$1-
}
much easier to have all on the one line
nicks.txt :
nick1,nick2,nick3
then:
alias msglist $read(nicks.txt,1) $$1-
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
I'd recommend using var %list = $addtok(%list,$read(nicks.txt,%i),44) in place of var %list = %list $+ $chr(44) $+ $read(nicks.txt,%i)
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
I'd recommend using var %list = $addtok(%list,$read(nicks.txt,%i),44) in place of var %list = %list $+ $chr(44) $+ $read(nicks.txt,%i) yes the addtok is nice and slick and in this example there is no difference in functionality and makes following the logic a little easier IMO to use the $+ Thank You Russel for bringing it up.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
One other advantage to using $addtok, in this case, is if you happen to have the same name more than once in the file, with your original code, that person would be messaged multiple times (once for each time their nick was in the variable), with mine, they only get messaged once, since $addtok won't add a token that already exists.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
That will also prevent a leading , that mike's code made
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
msg nick1,nick1,nick1 blah well actually only message nick1 once. heres a non looping solution to the original request alias example {
bread TEST.TXT 0 400 &binvar
breplace &binvar 13 44 10 44
msg $gettok($bvar(&binvar,1,400).text,1-,44) Message for you!
} * 400 i choose since messages i beleive cant exceed 512 byes including the raw message info.
|
|
|
|
|