mIRC Home    About    Download    Register    News    Help

Print Thread
$read(filename) doesn't want to work. #232992 06/07/11 12:56 AM
Joined: Jun 2011
Posts: 5
A
Aunvyrae Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Jun 2011
Posts: 5
So, this works fine in an alias or a script, in terms of a channel.

The thing is, when I try to use it in the Quit Message area of options. It does nothing.

I wrote it exactly like this: $read(quits.txt) in the Options area. Then I used /quit in the channel and all I get is my nickname.

It worked this morning. Then I started up this afternoon and it was back to the same thing.

Is there anyone that can help me get this working properly?
And why it seems to be hit and miss.

Re: $read(filename) doesn't want to work. [Re: Aunvyrae] #232993 06/07/11 01:57 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Computers are not humans. They don't have feelings or emotions. They don't "want".

Most of the time when something "doesn't work", the first entity you should look to blame is yourself. Why is it hit and miss? Possibly because you're not doing something properly.

Here are my guesses, based on the extremely minimal details you've provided (besides the obvious "it doesn't work"-- you wouldn't be here if it did):

1. The file "quits.txt" is not in your $mircdir. That's where $read() searches in if you don't give it a path. Typing //echo -a $exists(quits.txt) will tell you if it does. Type //run $mircdir and look inside that directory for the quits.txt file. If it's not there, that's why.

2. The server you're on doesn't list quit messages. If you're using a round-robin server on a network, you might be getting a server that supports them one day, and a server that does not another. Freenode, for instance, does not list quit messages. EFNet also has some servers that don't, but again, it depends on the server. Some do, some don't. In this case, you've done nothing wrong, this is just how IRC works.

3. The top of your quits.txt is a number. Don't put numbers at the top of text files, mIRC thinks they are line counts. If you DO have a number at the top of a file, use the t switch in $read() like so: $read(quits.txt,t)

4. The line you're trying to read has a "$" in it, possibly prefixing an invalid identifier name. "$5.00", for instance will cause mIRC to error if you have identifier warnings on. You should be using the "n" switch with $read() unless you specifically want to evaluate the text inside your quits.txt file. $read(quits.txt,tn) is the way to go (the t is from point 3).

My guess is it's 1 or 2, though. 1 if it always happens, 2 if it only happens sometimes.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: $read(filename) doesn't want to work. [Re: Aunvyrae] #232994 06/07/11 02:41 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Please show your code.

Re: $read(filename) doesn't want to work. [Re: argv0] #232995 06/07/11 03:12 AM
Joined: Jun 2011
Posts: 5
A
Aunvyrae Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Jun 2011
Posts: 5
Quote:
1. The file "quits.txt" is not in your $mircdir. That's where $read() searches in if you don't give it a path. Typing //echo -a $exists(quits.txt) will tell you if it does. Type //run $mircdir and look inside that directory for the quits.txt file. If it's not there, that's why.


The file is in the same folder as the mirc.exe file.

Quote:
2. The server you're on doesn't list quit messages. If you're using a round-robin server on a network, you might be getting a server that supports them one day, and a server that does not another. Freenode, for instance, does not list quit messages. EFNet also has some servers that don't, but again, it depends on the server. Some do, some don't. In this case, you've done nothing wrong, this is just how IRC works.


Other members of the forum have quit messages pop up every time they quit. I doubt the server is singling me out.

Quote:
3. The top of your quits.txt is a number. Don't put numbers at the top of text files, mIRC thinks they are line counts. If you DO have a number at the top of a file, use the t switch in $read() like so: $read(quits.txt,t)


Nope. Just text.

Quote:
4. The line you're trying to read has a "$" in it, possibly prefixing an invalid identifier name. "$5.00", for instance will cause mIRC to error if you have identifier warnings on. You should be using the "n" switch with $read() unless you specifically want to evaluate the text inside your quits.txt file. $read(quits.txt,tn) is the way to go (the t is from point 3).


The "n" seems to work. Not sure why it would require it on some and not others.

The only symbols in the file are apostrophe, comma, period and ...

Re: $read(filename) doesn't want to work. [Re: Aunvyrae] #232996 06/07/11 03:13 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
2b Depending on the IRCd of your network and its settings, there may be a minimum connection time before a custom quit message will be displayed (to make it less attractive for spam). This duration may differ from server to server though most likely it will be the same on the whole network.

I puzzled about this as well once smile

Re: $read(filename) doesn't want to work. [Re: Aunvyrae] #232997 06/07/11 06:15 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Originally Posted By: Aunvyrae
The file is in the same folder as the mirc.exe file.


That is not necessarily your $mircdir. Follow the instructions you were given to confirm the file exists in the right location.

Originally Posted By: Aunvyrae
Other members of the forum have quit messages pop up every time they quit. I doubt the server is singling me out.


Server? Or network? Are you sure the other users are on the same *server* as you? Even if they are, it's still not far fetched for the server to behave differently for different users, so actually, you should not doubt this.

I'm still going with #2. It's more likely than "$read() doesn't work"

A good way to verify that your quit message works on your end is to type /debug @debug followed by /quit. If your @debug window shows your quit message being sent but it doesn't show up on the server, it's the server's fault and the issue is #2. If the quit message does NOT show up, the problem is #1


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"