mIRC Home    About    Download    Register    News    Help

Print Thread
Bug in play when first line is a number #157921 30/08/06 08:33 AM
Joined: Sep 2003
Posts: 38
S
snabbi Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2003
Posts: 38
code to reproduce:
//write -c whatever.txt 1 | write whatever.txt 2 | write whatever.txt 3 | play # whatever.txt 2000 | remove whatever.txt

It is probably treating the first line as the number of lines in the file, but this value is then ignored and all lines are read. I am using 6.2

Re: Bug in play when first line is a number #157922 30/08/06 09:15 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You have correctly identified what's happening.
As to why it's happening, the /play command performs a $read of each line in the file (subject to the parameters provided in the /play command), then sends the read line to the nick/channel

Because it performs a read, this is relevant
Quote:
If the first line in the file is a number, it must represent the total number of lines in the file.
Quoted from /help $read

Re: Bug in play when first line is a number #157923 30/08/06 09:53 PM
Joined: Sep 2003
Posts: 38
S
snabbi Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2003
Posts: 38
I know that the option -t is in $read to treat the text as plain text and i think mIRC should use the -t switch because /play doesn't use the number of lines.

In my opinion it should either read the first line and treat the file as if it had so much lines, or it should treat the first line as a plain text value.

Re: Bug in play when first line is a number #157924 31/08/06 04:03 PM
Joined: Feb 2004
Posts: 201
J
Jae Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2004
Posts: 201
Quote:
I know that the option -t is in $read to treat the text as plain text and i think mIRC should use the -t switch because /play doesn't use the number of lines.


"The -t switch forces mIRC to look up the specified topic in the file and play all lines under that topic."

quoted from /help /play

Re: Bug in play when first line is a number #157925 01/09/06 08:01 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
as a side note, you can access the first line when its a number with $read(filename,0) as mIRC will consider the number as indicated to be the number of lines in the text.
while I have never used the feature, my guess is to make reading a specific line faster in the file when mIRC knows in advance how many lines there are to read through. Maybe someone can illuminate this function?

Re: Bug in play when first line is a number [Re: snabbi] #169469 23/01/07 04:35 PM
Joined: Sep 2003
Posts: 38
S
snabbi Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2003
Posts: 38
The bug is also in version 6.21

Maybe I should clarify what I mean. Although you can use the -t option in $read to specify that the line should be treated as text, this option is not available in the /play command.

The only workaround here is to "play" commands with the -c option and read the text.

Another thing I would like to add is that if /play is using $read internally, this should probably be replaced with a /fopen $fread /fclose loop.