mIRC Homepage

Automatic calculation/evaluation in tokens.

Posted By: NrWarren

Automatic calculation/evaluation in tokens. - 20/02/20 01:00 AM

Not sure if you know about this, or whether you consider it a bug.

When using /var to assign a value, the evaluation of 1-1 does not take place, but when spaced out, 1 - 1 it seems to automatically perform the calculation.

I was creating a calculator for mIRC, so that all of my calculations would be recorded and could be referenced later, and i encountered this little bug. I worked around it.
Posted By: Khaled

Re: Automatic calculation/evaluation in tokens. - 20/02/20 12:24 PM

Thanks for your bug report. That is indeed how variable assignment has always worked.
Posted By: Protopia

Re: Automatic calculation/evaluation in tokens. - 20/02/20 12:33 PM

Check out the $calc identifier.
Posted By: Sat

Re: Automatic calculation/evaluation in tokens. - 20/02/20 04:58 PM

For what it is worth: you can prevent this from happening by using either the -n or the (as yet undocumented) -p switch to /var. For example, the following code excerpt:

Code
var -n %test = 1 - 1
echo -ag %test

..will echo "1 - 1". The exact same applies in cases where the input is not literal (e.g. when assigning one variable to another, with such a "formula" as contents).
© 2021 mIRC Discussion Forums