mIRC Home    About    Download    Register    News    Help

Print Thread
#193971 27/01/08 07:42 PM
Joined: Dec 2007
Posts: 8
T
Trel Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Dec 2007
Posts: 8
my code is

Code:
alias quote {
  var %Line = $read("c:\mIRC Quote Files\random_quotes.txt")
  msg $active %Line
}


my text file is
1
2
3
4
5
6
7
8
9
10

However, when I do /quote
it is ALWAYS 2

Joined: Dec 2002
Posts: 2,028
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,028

Use the t switch with the $read identifier.

Originally Posted By: mirc.chm

If the first line in the file is a number, it must represent the total number of lines in the file. If you specify N = 0, mIRC returns the value of the first line if it's a number.

If the t switch is specified then mIRC will treat the first line in the file as plain text, even if it is a number.



Code:

alias quote {
  var %Line = $read("c:\mIRC Quote Files\random_quotes.txt",t)
  msg $active %Line
}



Joined: Aug 2006
Posts: 19
R
Pikka bird
Offline
Pikka bird
R
Joined: Aug 2006
Posts: 19
it should be this

Code:
 alias quote { msg $chan $read(filename or path) } 
or 
alias quote { echo -a $read(filename or path) }


var only set the variable once so that is why you always get 2 because it is set as 2.


ReaperIRC
Killgore Computers
Joined: Dec 2007
Posts: 8
T
Trel Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Dec 2007
Posts: 8
Originally Posted By: Reaper
it should be this

Code:
 alias quote { msg $chan $read(filename or path) } 
or 
alias quote { echo -a $read(filename or path) }


var only set the variable once so that is why you always get 2 because it is set as 2.


If the var is the problem, is there any way to still use variables? I did plan to do more than just echo it. I just didn't make that part yet.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
//var %x = That's | echo -a %x | var %x = not | echo -a %x | var %x = true. | echo -a %x

Joined: Dec 2002
Posts: 2,028
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,028

The variable wasn't the problem. Did you read my reply? I left your code as it was except for the addition of the t switch in the $read identifier.

Joined: Dec 2007
Posts: 8
T
Trel Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Dec 2007
Posts: 8
Originally Posted By: RoCk

The variable wasn't the problem. Did you read my reply? I left your code as it was except for the addition of the t switch in the $read identifier.


Yeah, I didn't get a chance to try yet. I was asking on that one incase he was right :p
(Or if you both were right)

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As RoCk said, the var wasn't the issue. Just the -t switch.


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2007
Posts: 8
T
Trel Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Dec 2007
Posts: 8
I have it working.

(it was the -t smile )

Thanks smile


Link Copied to Clipboard