Calculator

By UK-Sw1ft on Jan 17, 2006

paste into remote or paste into a txt file save as calc.mrc, then load -rs calc.mrc , right click in channel for use

menu * {
  Calculator
  .Calc:{
    if (!$dialog(calc)) {
      /dialog -m calc calc
    halt }
  }
}

dialog calc {
  title "Sw1ft's Calculator"
  size -1 -1 130 115
  option dbu

  menu "&File",1
  item "&About",2
  item "&Exit",3,default,ok
  menu "&Edit",4
  item "&Copy",5
  item "&Paste",6

  edit "",7,4 4 115 13,right
  edit "",8,4 20 20 20,read
  button "Backspace",9,28 22.2 30 15
  button "CE",10,62 22.2 30 15
  button "C",11,95 22.2 30 15
  button "MC",12,4 42.2 20 15
  button "MR",13,4 60.2 20 15
  button "MS",14,4 76.2 20 15
  button "M+",15,4 94.2 20 15
  button "7",16, 28 42.2 18 15
  button "8",17, 48 42.2 18 15
  button "9",18, 68 42.2 18 15
  button "/",19, 88 42.2 18 15
  button "sqrt",20, 108 42.2 18 15
  button "4",21, 28 60.2 18 15
  button "5",22, 48 60.2 18 15
  button "6",23, 68 60.2 18 15
  button "*",24, 88 60.2 18 15
  button "%",25, 108 60.2 18 15
  button "1",26, 28 76.2 18 15
  button "2",27, 48 76.2 18 15
  button "3",28, 68 76.2 18 15
  button "-",29,88 76.2 18 15
  button "1/x"30, 108 76.2 18 15 
  button "0",31, 28 94.2 18 15
  button "+/-",32, 48 94.2 18 15
  button ".",33, 68 94.2 18 15
  button "+",34, 88 94.2 18 15
  button "=",35, 108 94.2 18 15
}

dialog about {
  title "Sw1ft's Calulator"
  size -1 -1 100 75
  option dbu

  text "Sw1ft's Calculator, Deisnged and Made By Sw1ft, it is copyrighted @ #Royal-Cup, Thank you For Using It!",100, 20 15 50 50 30
}

on 1:dialog:calc:menu:*:{
  if ($did == 2) { /dialog -m about about | halt }
  if ($did == 5) { /cup -o %numbers %1numbers | unset %numbers | halt }
  if ($did == 6) { did -ra $dname 7 %1numbers | halt }
}

on 1:dialog:calc:close:*:{ unset %numbers }
on 1:dialog:calc:sclick:*:{
  if ($did == 10) { did -r $dname 7 | unset %numbers | halt }
  if ($did == 11) { did -r $dname 7 | unset %numbers | halt } 
  if ($did == 16) { did -a $dname 7 7 | set %numbers $addtok(%numbers,7,0) | halt }
  if ($did == 17) { did -a $dname 7 8 | set %numbers $addtok(%numbers,8,0) | halt }
  if ($did == 18) { did -a $dname 7 9 |  set %numbers $addtok(%numbers,9,0) | halt }
  if ($did == 19) { did -r $dname 7  | set %numbers $addtok(%numbers,/,0) | halt }
  if ($did == 21) { did -a $dname 7 4 | set %numbers $addtok(%numbers,4,0) | halt }
  if ($did == 22) { did -a $dname 7 5 | set %numbers $addtok(%numbers,5,0) | halt }
  if ($did == 23) { did -a $dname 7 6 | set %numbers $addtok(%numbers,6,0) | halt }
  if ($did == 24) { did -r $dname 7  | set %numbers $addtok(%numbers,*,0) | halt }
  if ($did == 25) { did -r $dname 7  | set %numbers $addtok(%numbers,%,0) | halt }
  if ($did == 26) { did -a $dname 7 1 | set %numbers $addtok(%numbers,1,0) | halt }
  if ($did == 27) { did -a $dname 7 2 | set %numbers $addtok(%numbers,2,0) | halt }
  if ($did == 28) { did -a $dname 7 3 | set %numbers $addtok(%numbers,3,0) | halt }
  if ($did == 31) { did -a $dname 7 0 | set %numbers $addtok(%numbers,0,0) | halt }
  if ($did == 33) { did -a $dname 7  | set %numbers $addtok(%numbers,.,0) | halt }
  if ($did == 34) { did -r $dname 7 | set %numbers $addtok(%numbers,+,0) | halt }
  if ($did == 29) { did -r $dname 7 | set %numbers $addtok(%numbers,-,0) | halt }
  if ($did == 35) { did -ar $dname 7 $calc(%numbers) | unset %numbers | halt }
  if ($did == 20) { did -ra $dname 7 $sqrt(5numbers) | unset %numbers | halt }
  if ($did == 9) { set %numbers $mid(%numbers,1,$calc($len(%numbers) -1)) | did -ra $dname 7 %numbers | halt }
  if ($did == 14) { 
  if (%numbers) { set %save %numbers | halt } }
  if ($did == 13) { unset %save | halt }
  if ($did == 30) { did -ra $dname 7 $calc(1 / %numbers)  | halt }
  if ($did == 32) { set %numbers $addtok(%numbers,-1,0) | did -ra $dname 7 $calc(%numbers) | halt }
  if ($did == 15) { set %save $calc(%save + %numbers) | did -ra $dname 7 %save | halt }
}

Comments

Sign in to comment.
Clarkcj   -  Oct 23, 2009

Yeah, its usefull.

 Respond  
celticsoldier   -  Mar 22, 2006

Very nice! You made a amazing dialog, Good work :)

 Respond  
UK-Sw1ft   -  Jan 17, 2006

thanks man :)

 Respond  
RoninWarrior   -  Jan 17, 2006

this is a pretty decent calc everything i used / tested worked pretty good and nice dialog aligment and not to overly big either good job UK-Sw1ft

 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.