mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2005
Posts: 22
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2005
Posts: 22
I got a .txt file that has seperate pieces of text on each line. I use a timer ( //timer 0 2400 -play text.txt ) it will play a different line in the .txt document every 20 minutes but when it gets to the end it just stops and doesnt repeat the process. Im wondering how i can get it to repeat the process wihtout doing it manually and how i can get it to amsg instead of just saying it in one channel. Any help appreciated. Kind regards, Spirit

Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
amsg $read(file.txt, $rand(1,$lines(file.txt))

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 /timer 0 2400 amsg $!read(text.txt) 

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I'd use the 'n' flag to make sure the contents aren't evaluated:

Code:
timer 0 2400 amsg $!read(text.txt,n) 

Joined: Dec 2005
Posts: 22
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2005
Posts: 22
this is the script i used to use when it would just play to one channel. Can someone help me modify it so it amsgs instead of just msging to one channel?

alias read_next_help {
var %f = helpfile.txt , %lines = $lines(%f) , %chan = $1
inc %help.lread
if (%help.lread > %lines) { set %help.lread 1 }
if ($read(%f,%help.lread) != $null && $me ison %chan) { msg %chan $read(%f,%help.lread) }
}

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
It would've been better if you'd given us this code in the first place, and asked if we would modify it, rather than asking for a new code.
Code:
 alias read_next_help {
var %f = helpfile.txt , %lines = $lines(%f) , %chan = $1
inc %help.lread
if (%help.lread > %lines) { set %help.lread 1 }
if ($read(%f,%help.lread) != $null) { amsg $read(%f,%help.lread) }
}  


Please note that your code is not the most efficient, and it sends the lines in sequential order, rather than random order, which was part of the original request.


Link Copied to Clipboard