Temperature converter

By knoeki on Sep 22, 2009

Just a simple identifier, once again, but someone other than me should find it useful.

Usage:

$temconv(N, [c])

Takes a temperature and converts it. Assumes input is farenheit and converts to celcius, unless the c parameter is specified, in which case it does the opposite. (hope that that makes sense ;_))

Can be useful for weather scripts.

alias tempconv {
    if ($2 == c) {
        return $round($calc((($1 - 32) / 9) * 5), 0)
    }
    else {

        return $round($calc((($1 * 9) / 5) + 32), 0)
    }
}

Comments

Sign in to comment.
hxck   -  Mar 12, 2014

Bot version:
!tc temp convtemp (i.e !tc 50 F will say 50 C is 122 F)

on $*:TEXT:/^[!]tc\s+(\d+)\s+(c|f)$/Si:#:{
  if ($regml(2) == C) { msg # $regml(1) F is $round($calc((($regml(1) - 32) / 9) * 5), 2) C }
  else { msg # $regml(1) C is $round($calc((($regml(1) * 9) / 5) + 32), 0) F }
}
 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.