mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2005
Posts: 1
V
Mostly harmless
OP Offline
Mostly harmless
V
Joined: Sep 2005
Posts: 1
I think this is a fairly easy one but I have little exp with scripting, started yesterday smile

I just was wondering how to make a short little script that reads the entire contents of a text file and displays it to channel. I can do it onw line at a time inputing the line number but I want all at once.

This is the code for one at a time

on 1:TEXT:!display*:*:{

/set %Scan.no $2
/set %Scan.wh $read(Scans.txt, %Scan.no $+ )
/msg $chan {6Scan} %Scan.no $+ : %Scan.wh

}

Thanks !

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On *:Text:!display*:#: {
  var %x = 1
  while (%x <= $lines(Scans.txt)) {
    echo -a ${6Scan} %x $+ : $read(Scans.txt,%x)
    inc %x
  }
}


-Andy

Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
You may want to look into using the /play command also.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Only reason I didn't suggest play is because of the way they wanted it to message the channel with the line number and line itself but I guess that depends on how the file is set out. If it was added like <N:> <Line> then play would be the best bet.

-Andy

Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
This is easily done.

Code:
On *:Text:!display*:#: {
  play -a scanplay $target Scans.txt
}
alias scanplay {
  msg $1 {6Scan} $play(1).pos $+ : $2-
}


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby

Link Copied to Clipboard