Can you add $calc or $read in the middle of a message like
msg $chan Roll: $calc($+($read(Numbers.txt) - $Read(Numbers.txt)))
You dont need that $+( ) and infact that may
even cause problems, not this time but in other occasions.
You may also be encountering a far more subtle problem also that your unliekly to be aware of, I well deal with this first.
Im assuming the Numbers.txt file contains a list of numbers one per line, if this is the case you can not correctly choose a random line from this file using $read(Numbers.txt)
the reason for this is if the first line of a file using $read has a number in it, it is considered to be the total number of lines in the file. example
--- Numbers.txt --
--- Numbers.txt --
As far as $read(Numbers.txt) is concerned that file has 3 lines, being the lines A B & C
HOW TO FIX IT ---> $read(Numbers.txt , t )
the t switch tells mirc to ignore any first line with a number on it, its just "t"ext
YOU SHOULD ALSO DO ---> $read(Numbers.txt , nt )
the n switch tells mirc to not evaluate the line (this is unlikely to be a concernt to you here but putting it in is good practice)
Ok so now you have a more useable $read I can explain what it does (broardly) in a line such as...msg $chan Roll: $calc($read(Numbers.txt,nt) - $Read(Numbers.txt,nt))
The first $read(Numbers.txt,nt) this reads that file pulls a line out at random and replaces the $read(Numbers.txt,nt) with the contents of the line, i assume the lines are numbers in your case, but they can be anything on the line of the file
The second $read(Numbers.txt,nt) does the same, and may choose the same line or any other line in the file, its random.
Lets assume it chose two lines the contents of each being a number and those two numbers were 17 and 9, so your line then looks like thismsg $chan Roll: $calc(17 - 9)
The $calc(17 - 9) well this is a calculation so it goes 17 - 9 = 8, and replaces the $calc(17 - 9) with the 8, leaving you withmsg $chan Roll: 8
and the $chan is replaced with the channel, lets assume here its #rollingnumbers so you end up withmsg #rollingnumbers Roll: 8
And thats what mIRC sends to the irc server.
And Can you replace a number with another number like Replace 1 with 200 without using a variable.
I dont under stand in what context you are meaning this.
I well say, if you can set a variable to a value and then display that variable in a line of text, you can almost certianly just place the same code as what you did to set the variable into the line of text. (with one exception, variables can be calculated with out using $calc() while showing it in a line you must use this)
var %name = " $+ $me $+ "
echo -a my name is %name
echo -a my name is " $+ $me $+ "my name is "DaveC"
my name is "DaveC"
ex2: (the exception)
var %IQ = 101 - 50
echo -a my IQ is %IQ
echo -a my IQ is 101 - 50
echo -a my IQ is $calc(101 - 50)my IQ is 51
my IQ is 101 - 50
my IQ is 51
The reason for the exception to the rule is becuase mIRC can in no way tell what you might want as part of the calculation and not.
the line might have looked like echo -a Test results # 1 - $calc(%score1 / 100 ) percentage
written with out $calc( ) that would read echo -a Test results # 1 - %score1 / 100 percentage
was mIRC to think you wanted to do $calc(1 - %score1 / 100) or not, it doesnt know so it doesnt do any calculation.
of course using the line var %IQ = $calc(101 - 50)
is perfectly fine, I infact do that all the time just so should i want to cut the calcualtion out and display it on a line i can with out having to add thr $calc( )