mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 99
M
MDA Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2002
Posts: 99
Greetings mIRC Forum members,

I'm stuck on trying to read a text file from start to finish via a remote command to our script into the active channel, whispered back to someone. Here are the two examples we are trying to get working. None are working and I'm also concerned about flooding out my script without any timers set for the line by line whispered output.

#test1 on
on *:text:visitors:#:{ if ($nick isop $active) var %z = 1 while (%z <= $lines(nameslist.txt)) { /privmsg $nick $read(nameslist.txt) | inc %z }}
#test1 end

#test2 on
on *:text:bmbos*:#:{ var %y = 1 while (%y <= $lines($2.txt)) { /privmsg $nick $read($2.txt) | inc %y }}
#test2 end

We've tried substituing $read(nameslist.txt,%z) for
$read(nameslist.txt) and the same with
$read($2.txt,%y) for $read($2.txt) both of those failed also.


Thanks for your time and consideration,
MDA


Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
/help /play smile
Code:
#test1 on
on *:text:visitors:#:if ($nick isop #) { .play -m1 $nick nameslist.txt 1000 }
#test1 end
 
#test2 on
on *:text:bmbos*:#:{ .play -m1 $nick $2.txt 1000 }
#test2 end

Joined: Dec 2002
Posts: 144
D
Vogon poet
Offline
Vogon poet
D
Joined: Dec 2002
Posts: 144
As Nimue said, /play would probably be easier.

However, as to the problem with your script .. privmsg is a raw server command. And as such, it needs to be sent in the format of privmsg nick :message I believe. If you used just msg $nick then it should probably work.

Oh and I'm not quite sure about this, but instead of using $2.txt, you might want to try $2 $+ .txt or $+($2,.txt).


"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
A couple of little pieces of mIRC magic smile

mIRC will add the colon if you use "/privmsg nick text to send"
However, using '/play' also addresses the concern over flooding. smile

'$2.txt' works fine, you can tack things onto the back of $N's
//tokenize 32 bla versions blah bleh | run $2.txt
wink

Joined: Dec 2002
Posts: 99
M
MDA Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2002
Posts: 99
Greetings and much apprecation Nimue, Dana

The reworked code worked well Nimue. I've tried to adjust the code you posted to read the file from a directory in the $mircdir\text folder. But without success trying these

{ .play -m1 $nick $mircdir\text ($2.txt) 1000 }

and

{ .play -m1 $nick $mircdir\text $2.txt 1000 }


Thanks again for your time and consideration,

MDA

Joined: Dec 2002
Posts: 208
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
in regards to: { .play -m1 $nick $mircdir\text $2.txt 1000 }

the identifer $mircdir returns the current mirc directory with the apending \ already, so adding \text is redundant .. if u do //echo -a * $mircdir\text .. you will see path\\text with 2 \ 's

also note that $2.txt is seperated from your path by a space and therefore mirc trys to read it in as a seperate argument

we need to use $+() to atatch it to the string

as a result we end up with:

Code:
 
.play -m1 $nick $+($mircdir,text\,$2.txt) 1000 
 


will do: play -m1 nickname path\text\2ndarg.txt 1000

hope this was helpful

note $+(), its used to alow you to take bits of data that need to be self evaluated and collect them together into a single string ..

for example: a $+ b $+ c is the same as doing $+(a,b,c) both return the string abc

Cobra^

Joined: Dec 2002
Posts: 99
M
MDA Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2002
Posts: 99
Thanks Cobra for the help and the explaination on that function for me.,




Best Regards to each,

MDA


Link Copied to Clipboard