mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2015
Posts: 9
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jul 2015
Posts: 9
Code:
write -w<$nick> requests.txt $2- $+ ( $+ $nick $+ )


This part finds the line where the user's nickname is written.
Then it inserts the new $2- with his nick.

How do I make this so it deletes the old line and replaces it with the new one instead of inserting?

Last edited by Fattyshow; 04/10/15 01:33 AM.

Digital Rocker on Twitch TV - Bassist
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
$readn returns the line number which your wildcard search was matched, writing with -il $+ $readn will overwrite said line.
/help /write


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Jul 2006
Posts: 4,187
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,187
The line you used is correct to overwrite a line, here is an example:
Code:
alias test_write {
write -c test LINE1 $+ $crlf $+ LINE2 $+ $crlf $+ LINE3
write -w"LINE2" test NEWLINE2
echo -a $read(test,tn,1) -- $read(test,tn,2) -- $read(test,tn,3)
.remove test
}


Nillens: $readn is only filled after a $read() call, using /write -w is much much better, $read will open the file, check all the line, try to match them, then on a match, fills $readn, close the file. You would then use /write -l $readn, which would open the file, go to the $readn line, and replace it. In short, the whole $read part can be avoided, speeding up the processing greatly.

Last edited by Wims; 08/10/15 12:48 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard