mIRC Homepage
Posted By: Turbo_boy $read(txt\renegade.txt, s, ....) - 03/09/04 06:16 PM
If there is an nickname on my txt of renegade and i will identify it with $read(txt\renegade.txt, s, test)

("test isin the txt file but is not on line 1")

and i echo to check if it works with this:

//echo test $read(txt\renegade.txt, s, test) | //echo blaat $readn

He wil return blaat 0 this is much time randomly (I'm not running any script)
Posted By: Nobodi Re: $read(txt\renegade.txt, s, ....) - 04/09/04 01:09 AM
If test is the only word in the line the s switch wont return anything as is returns the rest of the line.
Posted By: dr_Eamer Re: $read(txt\renegade.txt, s, ....) - 04/09/04 01:44 AM
The wierd thing is that $readn is 0 which means test is never found in the file!

Turbo_boy are you sure that's all there is to it?
My guess is there's something wrong with your file.
Most likely the path txt\renegade.txt is not correct.
Try using a full path like this:
$read($+(",$mirdirtxt\renegade.txt,"),s,test)

Another chance is that test is not in the beggining of any line and there's somthing wrong inside the text file.
Posted By: Nobodi Re: $read(txt\renegade.txt, s, ....) - 04/09/04 04:20 AM
Quote:

The wierd thing is that $readn is 0 which means test is never found in the file!


It will be 0 if $read returned $null even if test is in the file.

$read($+(",$mirdirtxt\renegade.txt,"),w,test) wiil return a line number with $readn if test is the only word on the line.
Posted By: Turbo_boy Re: $read(txt\renegade.txt, s, ....) - 04/09/04 09:56 AM
test is not the only word in the file there are meany others..

But if i set more in the txt and test is the last word in the file it will to return 0 If i use the full dir like c:\mirc\txt\renegade.txt it will return 0 to :S
Posted By: Nobodi Re: $read(txt\renegade.txt, s, ....) - 04/09/04 11:56 AM
If test is on a line by itself the s switch wont return anything.


//echo $read(info.txt, s, mirc)

Scans the file info.txt for a line beginning with the word mirc and returns the text following the match value.

If you had 2 lines in a file like below it would return on the 2nd line.

mirc
mirc this line returned

Using the s switch would return this line returned and $readn would return 2.
Posted By: dr_Eamer Re: $read(txt\renegade.txt, s, ....) - 04/09/04 01:49 PM
Quote:
It will be 0 if $read returned $null even if test is in the file.

This is very wrong! If test is found in the file $readn will return the line it was found. $readn will be 0 ONLY if it is NOT found.
Try:
/write -c test.txt aaa
/write test.txt bbb
/write test.txt ccc
//echo $read(test.txt,s,ccc) --- $readn
//echo $read(test.txt,s,blah) --- $readn

This will echo:
--- 3
--- 0
Posted By: dr_Eamer Re: $read(txt\renegade.txt, s, ....) - 04/09/04 01:54 PM
Could you please paste a portion of the file containg the word test?

I can't think of anything else that could be wrong...
© mIRC Discussion Forums