mIRC Homepage
Posted By: Trel $read not being random - 27/01/08 07:42 PM
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
Posted By: RoCk Re: $read not being random - 27/01/08 08:01 PM

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
}


Posted By: Reaper Re: $read not being random - 27/01/08 08:08 PM
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.
Posted By: Trel Re: $read not being random - 27/01/08 08:26 PM
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.
Posted By: hixxy Re: $read not being random - 27/01/08 08:28 PM
Code:
//var %x = That's | echo -a %x | var %x = not | echo -a %x | var %x = true. | echo -a %x
Posted By: RoCk Re: $read not being random - 27/01/08 10:03 PM

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.
Posted By: Trel Re: $read not being random - 27/01/08 11:03 PM
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)
Posted By: Riamus2 Re: $read not being random - 28/01/08 01:16 AM
As RoCk said, the var wasn't the issue. Just the -t switch.
Posted By: Trel Re: $read not being random - 28/01/08 09:29 AM
I have it working.

(it was the -t smile )

Thanks smile
© mIRC Discussion Forums