!calc Calculator
Platform: mIRC
Published Dec 27, 2010
Updated May 20, 2011
My First script posted on Hawkee (code snippets, not forums. I use the forums more)
Anyhow, I made it so the command is !calc
It works with spaces; commas, m as in million, k as in thousand, b as in billion, and if it returns 0 it messages the channel why the result may be 0
Anyway, here it is!
-$comma made by FiberOPtics.
~~~~~~~~~~~~~~~~
Previous description is for the old script. Now, basically it regsubs it. Used the $comma regex in still, credit of the regular expression of that to FiberOPtics still.
on *:TEXT:!calc*:#: msg # $iif($regsubex($remove($2-,$chr(32),$chr(44)),/((^|[+-/^*%]+)(([0-9]|\56)+)(k|m|b)|(^|[+-/^*%]+)(([0-9]|\56)+)|(^|[+-/^*%]+)(\50(.+?)\51))/ig,),Syntax Error,$iif(!$2,Syntax Error,[!calc] $2- = $regsubex($ticks,$calc($regsubex($ticks,$remove($2-,$chr(44),$chr(32)),/(^|[+-/*%]+|[+-/*%]+\50)(([0-9]|\56)+)(k|m|b)/ig,\1 $+ ( $+ \2 $+ $iif(\4 == b,*1000000000,$iif(\4 == m,*1000000,*1000)) $+ ))),/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44))))