mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 10
B
BigP Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Aug 2004
Posts: 10
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 ?

Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788

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.

Joined: Aug 2004
Posts: 10
B
BigP Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Aug 2004
Posts: 10
thx for the quick reply Eamonn works a treat laugh

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!

Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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'.

Quote:

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 nickname

Eamonn.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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


Gone.
Joined: Dec 2002
Posts: 230
G
Fjord artisan
Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
I guess that's what $mkfn is for. It replaces invalid characters with underscores.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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


Gone.

Link Copied to Clipboard