Simple Calculator

By raccoon on Jun 28, 2013

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


Sign in to comment.
cnrshn   -  Feb 20, 2014

Very nice :)

MoshMage   -  Jun 30, 2013

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 :)

raccoon  -  Aug 13, 2013

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.

MoshMage  -  Aug 13, 2013

Well, It's not like you couldn't add a -s on that echo and echo it back to the status window as well. Still, i see your point. In my case, when i coded ms, I tried to keep my workspace as clean as possible and hence why i fear windows and inputs :)

raccoon  -  Aug 13, 2013

And indeed, check out my other snippets. I rarely use windows and never use dialogs. I'm rather pleased with "/idle" I just posted, just wish it didn't look so damn bloated.

Sign in to comment

[Plornt]   -  Jun 30, 2013

I love how mirc is able to break Hawkees script highlighter >.<

Hawkee  -  Jun 30, 2013

@FordLawnmower built our mIRC code parser which was rolled into the official CodeMirror package. Maybe he can provide a bug fix.

Savage_CL  -  Aug 09, 2013

be a simple matter of ignoring any /* that isn't at the beginning of the line.

Sign in to comment

Hawkee   -  Jun 29, 2013

mIRC has it's own platform here. You don't need to save this under Windows.

raccoon  -  Jun 30, 2013

Ah, Thanks. :)

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.