mIRC: stop /var from evaluating mathematical expressions

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.

on *:input:#: {
if ($left($1,1) != /) {
var %input $1-

.echo -q $regsub(%input, /((?:telnet:\/\/|ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g, 12\1, %input)
.echo -q $regsub(%input, /(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/g, 12\1, %input)
.echo -q $regsub(%input, /(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/g, 12\1, %input)

if (%input != $null) {
msg $active %input
haltdef
}
}
}

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!

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