I want to use an on text command to write text to a file.
The file must have the users nick in the filename for my read scripts benefit.
<bob124> I like footy.
on *:TEXT:*footy*:#: /write c:\temp\footy\$nick.txt $nick $1-
I just get a file called "$nick.txt" rather than bob124.txt
Anyone point me in the right direction please ?
write $+(c:\temp\footy\,$nick,.txt) $nick $1-
Or,
write c:\temp\footy\ $+ $nick $+ .txt $nick $1-
They are both the exact same, just differnet method of using $+, the $+ COMBINES things together, in this case an identifier and text.
Eamonn.
thx for the quick reply Eamonn works a treat
Can you tell me if theres a quick way to test script commands rather than writing the script unloading and loading ?
e.g. /scripttry $read(c:\temp\footy\bob.txt,w,*fred*) | if (readn == 0) echo bob.txt doesnt exist!
Editing your scripts via the mIRC scripting editor (alt+r) updates them instantly although some might not trigger until you restart mirc for obvious reasons like, 'On Start'.
scripttry $read(c:\temp\footy\bob.txt,w,*fred*) | if (readn == 0) echo bob.txt doesnt exist!
If your trying to check if the file exists.
alias scripttry {
if (!$isfile("C:\temp\footy\bob.txt")) { echo bob.txt doesnt exist! }
}
Syntax; /scripttry
And to make it "dynamic".
alias scripttry {
if (!$1) { echo -a - Syntax: /scripttry [nickname] | return }
if (!$isfile($+(",C:\temp\footy\,$1-,.txt"))) {
echo -a - $1- $+ .txt doesnt exist!
}
else { echo -a - $1- $+ .txt exists! }
}
Syntax; /scripttry
nicknameEamonn.
Hi,
you are going to run into troubles at some point, when your script tries to make a file that contains illegal characters. Some characters which can be contained in a nickname, like | for example, cant be used in a filename.
You're probably better of using a hash table.
Things to check out: /hadd, $hget, /hsave, /hload etc. /help hash tables
Greets
I guess that's what $mkfn is for. It replaces invalid characters with underscores.
I know there are work arounds for it, but there was no mention/sign of it in his script, so it seemed like a good thing to point out, cuz he probably didn't think of it.
Greets