Originally Posted By: LostShadow
Greetings, it seems there are several issues regarding the /write command.


No, there aren't. Not in the way that you mean. Yes, it's slow, but that's the nature of it and can't really be changed. That's what /fread, /fwrite, etc. are for, or even hash tables. The slow file access time on a huge file isn't a bug, nor is it a reason for a feature request. A $writen (equivalent to $readn) that you suggested in the first post in this thread is a feature request, but having difficulty handling large files is not... it's a script help request.

That said, if you have that large of a file for a seen script, then convert the seen script to use hash tables. Alternatively, use /fwrite as it's much faster than /write.

Of course, I don't really see why you're inserting a line if it's a seen script. You can always read the last line(s) of a file by using $lines and $read together. If you need more than just the last line, a loop that decrements a counter variable would do it. Of course, I still strongly recommend a hash table method.

If you want to delete a line, just check $lines, and if $lines > 5, use /write -dl6. If you start out with that in the code, you'll never have more than 5 lines.

EDIT:
Originally Posted By: LostShadow
So if I have:

Nick:Ctime:Channel:text in seen.txt.

And I want to replace the new text to old text on a on text event, I would want to..

/write -ds $+ $nick seen.txt $nick etc.

But the file will never find $nick, it will find $nick:$ctime:$chan, etc., so that I have too...

/write -ds $+ $gettok(<the /write line>,1,58) seen.txt $nick etc..


No, you wouldn't.

Just do this:
Code:
if ($read(seen.txt,s,$nick $+ :)) { write -ds $+ $readn seen.txt }
else write seen.txt Whatever you're writing when there isn't something to delete.

Last edited by Riamus2; 10/07/07 05:10 AM.

Invision Support
#Invision on irc.irchighway.net