Temperature Conversion Dialog

By Pepsi_Man0077 on May 09, 2008

Dialog i made for Temperature conversion

ALT + R and paste in there

:D

UPDATE; May 9th 2008 - Dialog made smaller

dialog Temperature {
  title "Temperature Conversion - By PePSiMaN"
  size -1 -1 232 59
  option dbu
  box "Fahrenheit to Celsius", 1, 2 2 114 56
  box "Celsius to Fahrenheit", 2, 117 2 114 56
  button "Convert", 3, 4 42 109 14
  button "Convert", 4, 119 42 109 14
  edit "", 5, 5 12 50 10
  text "Enter a Temperature", 6, 56 13 57 8, center
  edit "", 7, 120 12 50 10
  text "Enter a Temperature", 8, 171 13 57 8, center
  text "", 9, 5 32 108 8, center
  text "", 10, 120 32 108 8, center
  text "", 11, 5 23 108 8, center
  text "", 12, 120 23 108 8, center
}

menu Channel,Status {
  Temperature Conversion: Temperature
}

alias Temperature { dialog -m Temperature Temperature }

on *:DIALOG:Temperature:sclick:*: {
  if ($did == 3) {
    if ($did(5) = 0) { 
      did -a Temperature 11 Converstion for $did(5) $+ °F to Celsius:
      did -a Temperature 9 -17.77°C
    }
    elseif (!$did(5)) { did -a Temperature 9 Enter a temperature first!!! | halt }
    elseif ($did(5) !isnum) { did -a Temperature 9 Invalid temperature! | halt }
    elseif ($did(5) isnum) {
      set %t1 $calc($did(5) - 32)
      set %temp1 $calc(%t1 * 0.55555555555555555555555555555556)
      did -a Temperature 11 Converstion for $did(5) $+ °F to Celsius:
      did -a Temperature 9 $round(%temp1,2) $+ °C
    }
  }
  if ($did == 4) {
    if ($did(7) = 0) { 
      did -a Temperature 12 Converstion for $did(7) $+ °C to Fahrenheit:
      did -a Temperature 10 32°F
    }
    elseif (!$did(7)) { did -a Temperature 12 Enter a temperature first!!! | halt }
    elseif ($did(7) !isnum) { did -a Temperature 12 Invalid temperature! | halt }
    elseif ($did(7) isnum) {
      set %t2 $calc($did(7) * 1.8)
      set %temp2 $calc(%t2 + 32)
      did -a Temperature 12 Converstion for $did(7) $+ °C to Fahrenheit:
      did -a Temperature 10 $round(%temp2,2) $+ °F
    }
  }
}

Comments

Sign in to comment.
jacksonbravo   -  Nov 17, 2011

The code provided for Temperature Conversion is useful.Thanks for sharing.

 Respond  
Pepsi_Man0077   -  May 09, 2008

Updated, made it smaller

 Respond  
criminal   -  May 09, 2008

You do now, Eugenio ^^
For celsius add a C on the end :) °C instead of °
Not rating for the dialog, cause I don\'t know much about dialogs and everytime I tried to make one myself, it was worthless.
7/10

 Respond  
Eugenio   -  May 09, 2008

I swear I commented on this =/

 Respond  
EL   -  May 09, 2008

Neat man an yea as napa suggested smaller dialog hell maybe even a button to send to the channel or even a on text event so others can convert be cool.Well done tho i always wanted to know the convertions to these lol used to chat with a lot of aussies an NZ ppl so this is cool.

 Respond  
napa182   -  May 09, 2008

and maybe make the dialog abit smaller

 Respond  
Pepsi_Man0077   -  May 09, 2008

thanks bro i wouldn\'t have caught that :D

 Respond  
napa182   -  May 09, 2008

ah nvm i see you caught it and changed oh you still have

$did(5) to Fahrenheit

change it to

$did(7) to Fahrenheit
 Respond  
napa182   -  May 09, 2008

um for the Celsius to Fahrenheit you have it as

var %t2 $calc($did(7) - 32)
      var %temp $calc(%t2 * 0.55555555555555555555555555555556)
      did -a Temperature 12 Converstion for $did(5) to Fahrenheit:
      did -a Temperature 10 $round(%temp,2) $+ °

it should be

 var %t2 $calc($did(7) * 1.8)
      var %temp $calc(%t2 + 32)
      did -a Temperature 12 Converstion for $did(7) to Fahrenheit:
      did -a Temperature 10 $round(%temp,2) $+ °
 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.