Top

Calculator with answer save


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Sep 14, 2009
Last Updated  Sep 20, 2009
Tags  alias  calc  calculator 

Introduction

**POST IN REMOTES****COLOURS ARE BRIGHT, SO CHANGE IF U DON'T HAVE BLACK BACKGROUND**
Syntax
Private: /c <operations>
Public: /cp <operations>
Check Answer: /anscheck

For some reason i keep updating my calculators, i don't know why, but this one works nicely.
It adds commas, and changes / to ÷ in the answer.

The biggest perk to this calc is, it saves the answer, so if you go:
/c 4*4
[CALC] The answer to 4*4 is 16
/c *4
[CALC] The answer to 16*4 is 64

The comma adder is thanks to FiberOPtics' script

UPDATE: As requested, I should make it so you can but answer in anywhere.' m ' for memory
use ' m ' anywhere in the operation.

/c 4*4
[CALC] The answer to 4*4 is 16
/c 4*m
[CALC] The answer to 4*16 is 64

Grab the Code

alias c {
  if ($left($1-,1) == +) || ($left($1-,1) == -) || ($left($1-,1) == *) || ($left($1-,1) == /) || ($left($1-,1) == ^) {
    if ($mid($1-,2) == 0) {
      echo -a 11[13CALC11] The answer to13 %ans $+ $replace(%b,/,÷,m,%ans) $+ $mid($1-,2) 11is13 Undefined
      set %ans $calc(%ans %b $mid($replace($1-,m,%ans),2))
      halt
    }
    set %b $left($1-,1)
    echo -a 11[13CALC11] The answer to13 %ans $+ $replace(%b,/,÷) $+ $mid($replace($1-,m,%ans),2) 11is13 $comma($calc(%ans %b $mid($replace($1-,m,%ans),2)))
    set %ans $calc(%ans %b $mid($replace($1-,m,%ans),2))
  }
  if ($left($1-,1) isnum) {
    if ($mid($1-,3) == 0) {
      echo -a 11[13CALC11] The answer to13 $replace($1-,/,÷,m,%ans) 11is13 Undefined
      set %ans $calc($replace($1-,m,%ans))
      halt
    }
    echo -a 11[13CALC11] The answer to13 $replace($1-,/,÷,m,%ans) 11is13 $comma($calc($replace($1-,m,%ans)))
    set %ans $calc($replace($1-,m,%ans))
  }
}
alias cp {
  if ($left($1-,1) == +) || ($left($1-,1) == -) || ($left($1-,1) == *) || ($left($1-,1) == /) || ($left($1-,1) == ^) {
    if ($mid($1-,2) == 0) {
      msg $chan 11[13CALC11] The answer to13 %ans $+ $replace(%b,/,÷,m,%ans) $+ $mid($1-,2) 11is13 Undefined
      halt
    }
    set %b $left($1-,1)
    msg $chan 11[13CALC11] The answer to13 %ans $+ $replace(%b,/,÷) $+ $mid($replace($1-,m,%ans),2) 11is13 $comma($calc(%ans %b $mid($replace($1-,m,%ans),2)))
    set %ans $calc(%ans %b $mid($replace($1-,m,%ans),2))
  }
  if ($left($1-,1) isnum) {
    if ($mid($1-,3) == 0) {
      msg $chan 11[13CALC11] The answer to13 $replace($1-,/,÷,m,%ans) 11is13 Undefined
      set %ans $calc($replace($1-,m,%ans))
      halt
    }
    msg $chan 11[13CALC11] The answer to13 $replace($1-,/,÷,m,%ans) 11is13 $comma($calc($replace($1-,m,%ans)))
    set %ans $calc($replace($1-,m,%ans))
  }
}
alias comma {
  var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a)
  return %a
}
alias anscheck {
  echo -a 11[13Answer Check11]13 - 11[13 $+ $comma(%ans) $+ 11]
}

Comments

  (1)  RSS
Blogger
Comments: 5
 
mIRC Snippet:  Calculator with answer save
Posted on Sep 16, 2009 8:57 am
Funy scripting... but i liked

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom