mIRC: stop /var from evaluating mathematical expressions

0 Comments

I can't see why this is a useful feature, since $eval() and $calc() already exist.

So I've finally gotten around to fixing a bug in my script that's been haunting me for the good part of 4 years.

It was in the script I've been using to highlight URLs which I paste in a blue underlined format.

01.on *:input:#: {
02.  if ($left($1,1) != /) {
03.    var %input $1-
04. 
05.    .echo -q $regsub(%input, /((?:telnet:\/\/|ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g, 12\1, %input)
06.    .echo -q $regsub(%input, /(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/g, 12\1, %input)
07.    .echo -q $regsub(%input, /(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/g, 12\1, %input)
08. 
09.    if (%input != $null) {
10.      msg $active %input
11.      haltdef
12.    }
13.  }
14.}

However, whenever I would enter in text like "1 / 2" or "1 + 1", the script would evaluate it into "0.5" and "2" respectively.

Baffled, I had no idea behind to why this was happening. Tonight, I had enough of it and looked for an answer. Thankfully, "Sigh" wrote up a little blurb about /var that solved my problems.

All I had to do was change /var to /set -n and it would stop it from evaluating. Simple as that!

1.set -n %input $1-

The reason is that both commands evaluate mathematical expressions, but /set actually has a switch to treat the value as plain text.

[ Source ]

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog