Calculator Dialog

By [M]ike on Jan 31, 2007

Load the script.
Commands -> Calculator
It's a simple calculator with a basic/advanced features. Based on the Windows Calculator.

on *:LOAD: {
  set %calcversion 1.0
  set %symbolused 1
  echo -a mIRC-Calc V1.0 Loaded - By [M]ike
}
on *:UNLOAD: {
  unset %symbolused
  echo -a mIRC-Calc V1.0 Unloaded - By [M]ike
}
alias calculator {
  dialog -md calc_table calc_table
}
alias calculator_about {
  dialog -md calc_about calc_about
}
menu channel,menubar,status,nicklist {
  mIRC-Calc
  .Calculator: calculator
  .About: calculator_about
}
dialog expired {
  title "Expired Version!"
  size -1 -1 178 88
  option dbu
  text "WARNING: Your current version of mIRC-Calc is out of date.", 1, 8 8 162 9, center
  edit "Please update your version of mIRC-Calc, later updates can be found at SwiftIRC (http://forum.swiftirc.net) or Hawkee (www.hawkee.com)", 2, 9 46 162 33, read multi center
  text "Your Version: 1.0", 3, 40 16 93 9, center
  text "Latest Version: 1.01", 4, 40 26 93 9, center
}
dialog calc_about {
  title "mIRC-Calc - About"
  size -1 -1 178 101
  option dbu
  text "About mIRC-Calc", 1, 24 0 122 8, center
  text "Author: [M]ike", 2, 64 13 44 8, center
  text "Version: 1.0", 3, 64 21 44 8, center
  text "", 4, 8 32 0 37, center
  edit "mIRC-Calc is a project by [M]ike, the calculator was oringinally made simply because I needed one, I later devolped it from basing it on features of the default Windows calculator. From there on I have added various suggested features and am always willing to improve it! If you wish to suggest anything please feel free to contact me through PM on either SwiftIRC (http://forum.swiftirc.net)  or Hawkee (www.hawkee.com) forums. To keep your calculator up to date it is suggested that you check either of the websites above for recent versions, a notice will be displayed to you if your version is out of date.", 5, 6 30 167 51, read multi vsbar
}

dialog calc_table {
  title "mIRC-Calc V0.1"
  size -1 -1 156 125
  option dbu
  edit "", 1, 4 8 123 19, read multi limit 30
  text "Calculate:", 2, 8 0 25 8
  button "1", 3, 9 31 18 18
  button "2", 4, 33 31 18 18
  button "3", 5, 57 31 18 18
  button "+", 6, 97 31 18 18
  button "4", 7, 9 55 18 18
  button "5", 8, 33 55 18 18
  button "6", 9, 57 55 18 18
  button "-", 10, 97 55 18 18
  button "8", 12, 33 79 18 18
  button "9", 13, 57 79 18 18
  button "*", 14, 97 79 18 18
  button "7", 11, 9 79 18 18
  button "0", 16, 32 104 18 18
  button "=", 17, 56 104 18 18
  button "C", 15, 8 104 18 18
  button "/", 18, 96 104 18 18
  button "MC", 21, 129 31 18 18
  button "M+", 27, 129 55 18 18
  button ".", 28, 128 104 18 18
  edit "", 20, 131 8 18 18, read multi limit 1 center
  button "M", 29, 129 79 18 18
  text "By [M]ike", 19, 129 -1 25 8
  button ")", 30, 32 128 18 18
  button "(", 31, 8 128 18 18
  button "^", 32, 56 128 18 18
  button "Ans", 33, 96 128 18 18
  button "Back", 34, 128 128 18 18
  menu "File", 22
  item "Exit", 23, 22
  menu "Mode", 24
  item "Basic", 25, 24
  item "Advanced", 26, 24
  menu "Other", 40
  item "Always On Top", 41, 40
  menu "Help", 42
  item "About", 43, 42
}
on *:DIALOG:calc_table:menu:43:{
  /calculator_about
}
on *:DIALOG:calc_table:menu:23:{
  dialog -x calc_table
}
on *:DIALOG:calc_table:menu:41:{
  if (%ontop == $null) {
    dialog -n calc_table
  }
  else {
    dialog -o calc_table
  }
}
on *:DIALOG:calc_table:menu:26:{
  set %advanced 1
  /dialog -s calc_table -1 -1 305 330
}
on *:DIALOG:calc_table:menu:25:{
  unset %advanced 
  /dialog -s calc_table -1 -1 305 270
}
on *:DIALOG:calc_table:sclick:30:{
  if (%symbolused == $null) {
    set %symbolused 1
    did -a calc_table 1 )
  }
}
on *:DIALOG:calc_table:sclick:31:{
  set %symbolused 1
  did -a calc_table 1 (
}
on *:DIALOG:calc_table:sclick:32:{
  if (%symbolused == $null) {
    set %symbolused 1
    did -a calc_table 1 ^
  }
}
on *:DIALOG:calc_table:sclick:33:{
  if (%ans != $null) {
    did -a calc_table 1 %ans
  }
}
on *:DIALOG:calc_table:sclick:34:{
  did -ra calc_table 1 $left($did(calc_table,1),$calc($len($did(calc_table,1)) -1))
}
on *:DIALOG:calc_table:sclick:28:{
  if (%symbolused == $null) {
    set %symbolused 1
    did -a calc_table 1 .
  }
}
on *:DIALOG:calc_table:sclick:21:{
  if (%mem != $null) {
    unset %mem
    did -r calc_table 20
  }
}
on *:DIALOG:calc_table:sclick:29:{
  if (%mem != $null) {
    did -a calc_table 1 %mem
  }
}
on *:DIALOG:calc_table:sclick:27:{
  if ($didtok(calc_table,1,32) != $null) {
    set %mem $didtok(calc_table,1,32)
    did -a calc_table 20 M
  }
}
on *:DIALOG:calc_table:init:0: { 
  if (%advanced != $null) {
    /dialog -s calc_table -1 -1 305 330
    set %symbolused 1
  }
  else {
    set %symbolused 1
  }
}
on *:DIALOG:calc_table:close:0: { 
  unset %ans
}
on *:DIALOG:calc_table:sclick:3:{
  unset %symbolused 1
  did -a calc_table 1 1
}
on *:DIALOG:calc_table:sclick:4:{
  unset %symbolused 1
  did -a calc_table 1 2
}
on *:DIALOG:calc_table:sclick:5:{
  unset %symbolused 1
  did -a calc_table 1 3
}
on *:DIALOG:calc_table:sclick:6:{
  if (%symbolused == $null) {
    set %symbolused 1
    did -a calc_table 1 +
  }
}
on *:DIALOG:calc_table:sclick:7:{
  unset %symbolused 1
  did -a calc_table 1 4
}
on *:DIALOG:calc_table:sclick:8:{
  unset %symbolused 1
  did -a calc_table 1 5
}
on *:DIALOG:calc_table:sclick:9:{
  unset %symbolused 1
  did -a calc_table 1 6
}
on *:DIALOG:calc_table:sclick:10:{
  if (%symbolused == $null) {
    set %symbolused 1
    did -a calc_table 1 -
  }
}
on *:DIALOG:calc_table:sclick:11:{
  unset %symbolused 1
  did -a calc_table 1 7
}
on *:DIALOG:calc_table:sclick:12:{
  unset %symbolused 1
  did -a calc_table 1 8
}
on *:DIALOG:calc_table:sclick:13:{
  unset %symbolused 1
  did -a calc_table 1 9
}
on *:DIALOG:calc_table:sclick:14:{
  if (%symbolused == $null) {
    set %symbolused 1
    did -a calc_table 1 *
  }
}
on *:DIALOG:calc_table:sclick:15:{
  set %symbolused 1
  did -r calc_table 1 
}
on *:DIALOG:calc_table:sclick:16:{
  unset %symbolused 1
  did -a calc_table 1 0
}
on *:DIALOG:calc_table:sclick:17:{
  unset %symbolused 1
  set %result $calc($didtok(calc_table,1,32))
  set %ans %result
  did -r calc_table 1
  did -a calc_table 1 %result
  unset %result
}
on *:DIALOG:calc_table:sclick:18:{
  if (%symbolused == $null) {
    set %symbolused 1
    did -a calc_table 1 /
  }
}

Comments

Sign in to comment.
Hydroxide   -  Feb 01, 2008

Awesome.

 Respond  
DarthReven   -  Feb 01, 2007

Could we combine all the events in to one by using $did and $devent

 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.