mIRC Homepage
Posted By: snabbi Bug in play when first line is a number - 30/08/06 08:33 AM
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
Posted By: RusselB Re: Bug in play when first line is a number - 30/08/06 09:15 AM
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
Posted By: snabbi Re: Bug in play when first line is a number - 30/08/06 09:53 PM
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.
Posted By: Jae Re: Bug in play when first line is a number - 31/08/06 04:03 PM
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
Posted By: MikeChat Re: Bug in play when first line is a number - 01/09/06 08:01 PM
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?
Posted By: snabbi Re: Bug in play when first line is a number - 23/01/07 04:35 PM
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.
© mIRC Discussion Forums