mIRC Home    About    Download    Register    News    Help

Print Thread
#137418 12/12/05 06:31 PM
Joined: Feb 2005
Posts: 74
S
SkyD Offline OP
Babel fish
OP Offline
Babel fish
S
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

#137419 12/12/05 07:16 PM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
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

#137420 12/12/05 07:58 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
hmm
well /msg nick1,nick2nick3
as you have the text file, try this
Code:
alias msglist {
var %lines = $lines(nicks.txt)
var %i = 1
while (%i &lt;= %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-

#137421 13/12/05 12:53 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'd recommend using
Code:
var %list = $addtok(%list,$read(nicks.txt,%i),44)  
in place of
Code:
 var %list = %list $+ $chr(44) $+ $read(nicks.txt,%i) 

#137422 13/12/05 03:53 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:
I'd recommend using
Code:
var %list = $addtok(%list,$read(nicks.txt,%i),44)  
in place of
Code:
 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.

#137423 13/12/05 04:08 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
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.

#137424 13/12/05 05:39 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That will also prevent a leading , that mike's code made smile

#137425 13/12/05 09:40 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
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

Code:
alias example {
  bread TEST.TXT 0 400 &amp;binvar
  breplace &amp;binvar 13 44 10 44
  msg $gettok($bvar(&amp;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.


Link Copied to Clipboard