Simple Calculator v1.7

By ZabuzaMomochi on May 26, 2007

A simple mIRC calculator that only uses addition subtraction and multiplication. I will be adding square roots and many other things soon.
Edit: Major update! I'm currently working on the +/- key. (Positive and negative)

I will soon be adding Scientific View, so get ready people! (It might take like 5 days though)
Edit: Changed +/- key to (-) due to mIRC not being able to recognize - in an editbox for some reason..

menu * {
  -
  $iif(!$dialog(Calculator),Calculator,$style(2) Calculator): dialog -m Calculator Calculator
  -
}
Dialog Calculator {
  Title "Calculator"
  Size -1 -1 172 160
  Button "1", 1, 1 95 28 20, 
  Button "2", 2, 29 95 28 20, 
  Button "3", 3, 58 95 28 20, 
  Button "4", 4, 1 116 28 20, 
  Button "5", 5, 30 116 28 20, 
  Button "6", 6, 58 116 28 20, 
  Button "7", 7, 0 137 28 20, 
  Button "8", 8, 29 137 28 20, 
  Button "9", 9, 58 137 28 20, 
  Button "*", 10, 138 115 28 20, 
  Button "-", 11, 138 136 28 20, 
  Button "+", 12, 138 94 28 20, 
  edit "",  13, 0 1 140 25, read
  Button "Clear", 14, 87 136 50 20, 
  Button "Exit", 15, 87 115 50 20, Cancel, 
  Button "Ok", 16, 87 94 50 20, ok
  Button "Calculate", 17, 1 26 170 20
  Button "Sqrt", 18, 87 75 25 20
  Button ".", 19, 29 75 28 20
  Button "/", 20, 138 75 28 20
  Button "0", 21, 1 75 28 20
  Button "^", 22, 113 75 25 20
  Button "( - )", 23, 58 75 28 20
  Button "Pi", 24, 1 55 28 20
  Button "1/x", 25, 29 55 28 20
  Button "( )", 26, 58 55 28 20
  Button "MS", 27, 87 55 25 20
  Edit "", 28, 141 1 30 25, read
  Button "MR", 29, 113 55 25 20
  Button "MC", 30, 138 55 28 20
}
on *:DIALOG:Calculator:*:*: {
  if ($devent == sclick) {
    if ($did <= 9) {
      did -a Calculator 13 $did
    }
    if ($did == 10) {
      did -a Calculator 13 *
    }
    if ($did == 11) {
      did -a Calculator 13 -
    }
    if ($did == 12) {
      did -a Calculator 13 +
    }
    if ($did == 14) {
      did -r Calculator 13
    }
    if ($did == 17) {
      did -ra Calculator 13 $calc($did(13).text)
    } 
    if ($did == 18) {
      did -ra Calculator 13 $sqrt($did(13).text)
    }  
    if ($did == 19) {
      did -a Calculator 13 .
    } 
    if ($did == 20) {
      did -a Calculator 13 /   
    } 
    if ($did == 21) {
      did -a Calculator 13 0
    }  
    if ($did == 22) {
      did -a Calculator 13 ^
    }  
    if ($did == 23) {
      did -ra Calculator 13 $replace($did(13).text,$did(13).text,- $+ $did(13).text)
    }
    if ($did == 24) {
      did -a Calculator 13 3.14
    }  
    if ($did == 25) {
      did -ra Calculator 13 $calc(1 / $did(13).text)
    }
    if ($did == 26) {
      did -ra Calculator 13 ( $+ $did(13).text $+ )
    }  
    if ($did == 27) {
      did -ra Calculator 28 M
      set %calcmem $did(13).text
    }  
    if ($did == 29) {
      did -ra Calculator 13 %calcmem 
    }
    if ($did == 30) {
      did -r Calculator 28
      unset %calcmem
    }
  }
}

Comments

Sign in to comment.
|MELIORITE|   -  May 27, 2007

When you iron out all the little bits could be handy tool :)

 Respond  
ZabuzaMomochi   -  May 27, 2007

Gah, still having problems with the +/- feature, adding more soon!

 Respond  
ZabuzaMomochi   -  May 27, 2007

Added about 8 more things, and now it has memory!

 Respond  
ZabuzaMomochi   -  May 27, 2007

Any scores? o:

 Respond  
Lindrian   -  May 26, 2007

heh, np :)

 Respond  
ZabuzaMomochi   -  May 26, 2007

sorry lmao, i just copied and pasted it. Edited.

 Respond  
Lindrian   -  May 26, 2007

heh, in ur menu, change DNAME to your dialog name ;)

 Respond  
ZabuzaMomochi   -  May 26, 2007

ah, thank you lindrian, i actually just updated it so theres more functions. (Including the / one)

 Respond  
Lindrian   -  May 26, 2007

Missing the \"/\" function. Aswell, as there\'s a lil too much space, thats not needed.
Also, make the editbox \'read only\' as you use the buttons anyways. To avoid issues.

the menu:

menu * {
$iif(!$dialog(DNAME),Calculater,$style(2) Calculater): dialog -m DNAME DNAME 
}

or

menu * {
Calcluater: dialog $iif($dialog(DNAME),-v,-m) DNAME DNAME
}
 Respond  
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.