A simple but elegant Calculator script for mIRC.
Contains a nice example of creating a custom window that's positioned on the desktop.
(The reason it's used is because mIRC would place the window on my secondary monitor for no apparent reason)
You can easily expand to this script. I have. I am only sharing this simple essential snippet for everyone to enjoy since it's so insanely useful. Not because it exemplifies coding genius or anything. It sits on my desktop daily! -- Raccoon
; A simple but elegant Calculator by Raccoon.
; Type /calc or /calc 1+1
ALIAS calc { ; By Raccoon
var %x = $calc($window(-1).w * .75 + $window(-1).x)
var %y = $calc($window(-1).h * .25 + $window(-1).y)
window -adDoe2izj100000 @calc $iif(!$window(@calc),%x %y 300 600)
if ($0) { editbox -n @calc $1- }
}
On *:INPUT:@calc: {
if ($ctrlenter) || (/* iswm $1) { return }
;var %a = $1- (bug with /var)
set -nl %a $1-
var %b = $calc(%a)
aline -pi @calc %a
aline -pi 2 @calc = %b
editbox @calc %b
}
When i coded mirc scripting i always avoided to use modals, windows or dialogs for unnecessary stuff. This is one of them cases where a simple well formatted echo would suffice.
alias calc { if ($1-) echo -ta <Calculator> $1- = $calc($1-) }
Would achieve the exact same effect in less time and less hassle. But hey, To each its own :)
@FordLawnmower built our mIRC code parser which was rolled into the official CodeMirror package. Maybe he can provide a bug fix.
I would agree, except that when I'm coding something I often need to refer back to the same values I've previously calculated. Most of the time I'm using this 'calculator' while mIRC is minimized to the tray, so it acts as its own 'app'. I wrote this for convenience and not a shortest-code-possible contest.