Temperature Conversions

By TomG on Oct 24, 2009

This is one of my first scripts. It takes the temperature you right, and it notices the person telling them the conversions amount. This is my first experiment with $calc.

So, if someone types !temp f 50, it will return the person: 50 degrees Celsius into Fahrenheit is: 122 degrees

If they type !temp it will give instructions. It goes the same for !temp c, except opposite.

on *:TEXT:!temp:#: {
  notice $nick !temp converts temperatures. !temp [c/f] <number of degrees>. 
  notice $nick c/f is the degree you want to convert, and the number is the original amount.
}
on *:TEXT:!temp c *:#: {
  notice $nick $3 degrees Fahrenheit into Celsius is: $calc(1.8 * $3 + 32) degrees
}
on *:TEXT:!temp f *:#: {
  notice $nick $3 degrees Celsius into Fahrenheit is: $calc(5/9 * $3 - 32) degrees
}
Sign in to comment.
TomCoyote   -  Feb 20, 2011

yeah, I saw it wasn't calculating correctly after I posted the correction the first time

Grimnir  -  22 days ago

;========= Temp Convert ================== on :TEXT:!temp:#: { notice $nick !temp converts temperatures. !temp [c/f] . notice $nick c/f is the degree you want to convert, and the number is the original amount. } on :TEXT:!temp f :#: { msg # $nick $3 degrees Fahrenheit equals Celsius: $calc((($3 - 32)5) /9) degrees } on :TEXT:!temp c :#: { msg # $nick $3 degrees Celsius equals Fahrenheit: $calc(((9 * $3)/5) + 32) degrees } ;=========================================

Sign in to comment

jaytea   -  Feb 20, 2011

TomCoyote, the second one still has an error, the calculation should be: $calc(5/9 * ($3 - 32))

 Respond  
TomCoyote   -  Feb 20, 2011

and no, the conversion is off

 Respond  
TomCoyote   -  Feb 20, 2011

You have the C and F backwards, the correction is below: on :TEXT:!temp c :#: { notice $nick $3 degrees Celsius into Fahrenheit is: $calc(1.8 $3 + 32) degrees } on :TEXT:!temp f :#: { notice $nick $3 degrees Fahrenheit into Celsius is: $calc(5/9 $3 - 32) degrees }

 Respond  
jasonh   -  Dec 27, 2009

doesnt calculate right

 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.