mIRC Homepage
Posted By: DefaultUser $read(file.txt) - 19/10/03 06:36 PM
trying to debug a simple script to use as an example the problem seems to be mirc wont read the file i put the txt file in the main mirc directory

on 1:TEXT:*!test*:#:/msg $chan test $read($mircdir/quote.txt)


it does output to the channel "test" but nothing from the txt file
this is using mirc6.1
thanks for any ideas
Posted By: CtrlAltDel Re: $read(file.txt) - 19/10/03 06:40 PM
you wanting to read one line? or the entire text file?
Posted By: DefaultUser Re: $read(file.txt) - 19/10/03 06:42 PM
just one line
Posted By: CtrlAltDel Re: $read(file.txt) - 19/10/03 06:45 PM
try this

on 1:TEXT:*!test*:#: msg $chan test $read(quote.txt)
Posted By: DefaultUser Re: $read(file.txt) - 19/10/03 06:51 PM
same problem just outputs test
Posted By: DefaultUser Re: $read(file.txt) - 19/10/03 06:55 PM
nevermind i found the problem lol i named my text file quote.txt which made the file name qoute.txt.txt now i can only hope all the hair i pulled out will grow back
Posted By: CtrlAltDel Re: $read(file.txt) - 19/10/03 06:55 PM
then the quote.txt either doesn't exist, or is not in the main mirc folder

works perfectly here
Posted By: Online Re: $read(file.txt) - 20/10/03 03:31 AM
In addition to the other posts, I'd like to mention it's safer to always use $read(file,n). The n switch prevents variables and identifiers in the line from being evaluated.

Evaluation means if you have $me in the file, using //echo $read(file) will show your current nickname. This can easily turn to be harmful if you allow other users to add quotes to the database with a command.

If, for example, they know your password is stored in %mypass they can add a "quote" with that variable, and requesting the quote will cause your password to be displayed on their screen.

Or even worse, if a bad guy puts a harmful identifier (like $findfile() with a /remove command that will be executed on any file found) inside a quote, the identifier will be evaluated next time your script $read's it, and you'll will end up with your hard drive being wiped crazy
© mIRC Discussion Forums