# Calculator

### By napa182 on Jul 23, 2007

Just a Simple Calculator Dialog... copy and paste into a new remote and click in a channel and click Calculator to open. Enjoy.

log2   -  Feb 10, 2008

log2?

napa182   -  Feb 09, 2008

ok i added sin, asin, cos, acos, tan, atan, round, abs, and log enjoy ;)

napa182   -  Feb 09, 2008

i dont get why you would want to clear the sum after you click equals ? i still like to keep the sum there so i can add to it and so on. also there is no need to use a global var for the way i have this script.

Ivanalicius   -  Feb 09, 2008

Nice and simple calculator. But my suggestion is next time to add sin(Sinus) , Cos(cosinus) , tan(Tanges) ;)

Korvin   -  Feb 09, 2008

what i did, is added this to all the if (\$did\'s

``````\$iif(%sum,sum.clr) |
``````

``````alias sum.clr {
did -r cal 3
unset %sum
}
``````

then finally, i changed the var %sum\'s to set %sum =D

Korvin   -  Feb 09, 2008
``````on *:DIALOG:cal:sclick:*: {
if (\$did == 21) { set %sum \$calc( \$did(3) ) | did -r cal 3 | did -a cal 3 %sum }
if (\$did == 5) { sum.clr }
if (\$did == 7) { \$iif(%sum,sum.clr) | did -a cal 3 7 }
if (\$did == 8) { \$iif(%sum,sum.clr) | did -a cal 3 8 }
if (\$did == 9) { \$iif(%sum,sum.clr) | did -a cal 3 9 }
if (\$did == 10) { \$iif(%sum,sum.clr) | did -a cal 3 / }
if (\$did == 11) { \$iif(%sum,sum.clr) | did -a cal 3 4 }
if (\$did == 12) { \$iif(%sum,sum.clr) | did -a cal 3 5 }
if (\$did == 13) { \$iif(%sum,sum.clr) | did -a cal 3 6 }
if (\$did == 14) { \$iif(%sum,sum.clr) | did -a cal 3 * }
if (\$did == 15) { \$iif(%sum,sum.clr) | did -a cal 3 1 }
if (\$did == 16) { \$iif(%sum,sum.clr) | did -a cal 3 2 }
if (\$did == 17) { \$iif(%sum,sum.clr) | did -a cal 3 3 }
if (\$did == 18) { \$iif(%sum,sum.clr) | did -a cal 3 - }
if (\$did == 19) { \$iif(%sum,sum.clr) | did -a cal 3 0 }
if (\$did == 20) { \$iif(%sum,sum.clr) | did -a cal 3 + }
if (\$did == 22) { \$iif(%sum,sum.clr) | did -a cal 3 . }
if (\$did == 6) { \$iif(%sum,sum.clr) | did -a cal 3 ^ }
if (\$did == 4) { set %sum \$sqrt(\$did(3)) | did -r cal 3 | did -a cal 3 %sum }
if (\$did == 23) { /run http://www.freewebs.com/shideezdi/index.htm }
}
alias sum.clr {
did -r cal 3
unset %sum
}
``````

did what lindrian suggested =D works gr8

ZabuzaMomochi   -  Jul 25, 2007

You can change all the elseifs to just normal \'if\' Though once again, i would prefer mine of this one.

Callison1   -  Jul 24, 2007

I see now that there is already a clear button, I think that with reguards to the result remaining in the box, it should stay as it is.

Callison1   -  Jul 24, 2007

Lindrian, I think instead of the old value being wiped automatically when you press a new number, there should be a clear button, so you can clear it if you want, but if you want to perform a new calculation using the old result, you can.

Lindrian   -  Jul 24, 2007

## Here I am. If the dialog is already open,

• /dialog: \'c\' name in use (line 29, script5.mrc)
• solved by using:

``````Dialog \$iif(\$dialog(dname),-v,-m) dname dname
``````

When you type something in, the old value remains, after you press a new button and there\'s already something inside the box (after u pressed =) it should be wiped.
Can be solved by using a variable, to indicate the = was pressed etc.
You should also consider some alignment, it looks rather horrible with all edit boxes etc :P

4/10

napa182   -  Jul 24, 2007

haha wow you have a good eye. i didnt even see that till you said it. \"Thanks\" Yeah il add more to it later.

Callison1   -  Jul 24, 2007

Nice, except more buttons wouldn\'t hurt, like ^ etc.

Also the editbox needs to be moved over slightly, the end is cut off to start with. 5/10

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.