Advertisement
severen1999

PossibleMircConverterToEdit

Jul 2nd, 2020
2,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.58 KB | None | 0 0
  1. alias tempcon { dialog $iif($dialog(temperature),-v,-m) temperature temperature }
  2.  
  3. menu * {
  4.   Temperature: tempcon
  5. }
  6.  
  7. dialog temperature {
  8.   title "Temperature Converter"
  9.   size -1 -1 150 75
  10.   option dbu
  11.   text "From:", 100, 35 3 26 10, nowrap
  12.   text "To:", 99, 105 3 26 10, nowrap
  13.   text "=", 98, 73 16 3 5, nowrap
  14.   edit "", 1, 17 11 50 10
  15.   edit "", 2, 83 11 50 10, style disable
  16.   list 3, 15 24 55 30, sort vsbar
  17.   list 4, 80 24 55 30, sort vsbar
  18.   button "Convert!", 5, 5 57 45 15
  19.   button "Clear!", 6, 100 57 45 15
  20.   button "Exit!", 7, 53 58 45 13
  21.   check "Round #'s", 8, 58 47 35 10, nowrap
  22. }
  23.  
  24. on *:dialog:temperature:*:*: {
  25.   if ($devent == init) && ($did == 0) { did -b $dname 5-6 | did $iif($did(8).state == 1,-c,-u) $dname 8 | didtok $dname 3-4 32 Fahrenheit Celsius Kelvin }
  26.   if ($devent == sclick) {
  27.     if ($did(1).edited) && ($did(3).sel) && ($did(4).sel) { did -e $dname 5 }
  28.     if ($did == 5) {
  29.       if ($did(1) isalpha) { noop $input(You can only convert numbers!,uwok1,Error!) }
  30.       else {
  31.         var %w $did(1), %x $did(3).seltext, %y $did(4).seltext
  32.         if (%x == Fahrenheit) && (%y == Fahrenheit) { did -ra $dname 2 $iif($did(8).state == 0,%w,$round(%w,0)) }
  33.         if (%x == Fahrenheit) && (%y == Celsius) { var %z $calc((%w -32) / 1.8)) | did -ra $dname 2 $iif($did(8).state == 0,%z,$round(%z,0)) }
  34.         if (%x == Fahrenheit) && (%y == Kelvin) { var %z $calc(((%w - 32) / 1.8) + 273.15) | did -ra $dname 2 $iif($did(8).state == 0,%z,$round(%z,0)) }
  35.         if (%x == Celsius) && (%y == Celsius) { did -ra $dname 2 $iif($did(8).state == 0,%w,$round(%w,0)) }
  36.         if (%x == Celsius) && (%y == Fahrenheit) { var %z $calc((%w * 1.8) + 32)) | did -ra $dname 2 $iif($did(8).state == 0,%z,$round(%z,0)) }
  37.         if (%x == Celsius) && (%y == Kelvin) { var %z $calc(%w + 273.15) | did -ra $dname 2 $iif($did(8).state == 0,%z,$round(%z,0)) }
  38.         if (%x == Kelvin) && (%y == Kelvin) { did -ra $dname 2 $iif($did(8).state == 0,%w,$round(%w,0)) }
  39.         if (%x == Kelvin) && (%y == Fahrenheit) { var %z $calc(((%w - 273.15) * 1.8 ) + 32) | did -ra $dname 2 $iif($did(8).state == 0,%z,$round(%z,0)) }
  40.         if (%x == Kelvin) && (%y == Celsius) { var %z $calc(%w - 273.15) | did -ra $dname 2 $iif($did(8).state == 0,%z,$round(%z,0)) }
  41.       }
  42.       did -e $dname 6
  43.     }
  44.     if ($did == 6) { did -ra $dname 1-2 | did -u $dname 3-4 | did -b $dname 5-6 }
  45.     if ($did == 7) { did -u $dname 8 | dialog -x $dname }
  46.   }
  47.   if ($devent == edit) && ($did == 1) && ($did(3-4).seltext) { did $iif($did(1),-e,-b) $dname 5 }
  48.   if ($devent == close) { did -u $dname 8 }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement