Imperial - Metric Convertor
This script can help clear confusion when chatting with someone on the other side of the world about the weather, etc. e.g When they say its 30*C, do you know what is that in F? or what's 50*F is in C?
Converts from/to Celcius<>Farenheit, Miles/Hr<>Kilometres/Hr, pounds<>kilograms, and miles<>kilometres.
Typing "calc" will send instructions to your message log.
Imperial - Metric Calculator Instructions__________
Simply type in this format...
<number><unit>
e.g. 20*MPH (20 = number, *MPH = unit)
The units are... *C *F *MPH *KPH (*KMH) *lb *kg *mile(s) *km
So when you type "60*MPH" it appears that you said "60 MPH = 96.0 KPH."
*N.B. I take no responsibility for the accuracy of the conversions.
I got a B in maths!
__________________________________________________ _____
;LJ©'s Metric/Imperial Conversion Ver6.99B
; Place this in the OUTCHAT section of your cyborg.ipt
{
"Imperial - Metric Calculator Instructions__________" LOGMSG
"Simply type in this format..." LOGMSG
"<number><unit>" LOGMSG
"e.g. 20*MPH (20 = number, *MPH = unit)" LOGMSG
"The units are... *C *F *MPH *KPH (*KMH) *lb *kg *mile(s) *km" LOGMSG
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^calc$" GREPSTR IF
;Celcius to Farenheit
{
"$1" GREPSUB tempvarc =
tempvarc ATOI 9 * tempcel =
tempcel 5 / cel1 =
tempcel 5 % celdec1 =
cel1 32 + tempfar =
"$1 *C = " GREPSUB tempfar ITOA & "." & celdec1 ITOA & " *F" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]c$" GREPSTR IF
;Farenheit to Celcius
{
"$1" GREPSUB tempvarf =
tempvarf ATOI 32 - tempfar =
tempfar 5 * far1 =
far1 9 / tempcel =
far1 9 % tmpxcel =
"$1 *F = " GREPSUB tempcel ITOA & "." & tmpxcel ITOA & " *C" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]f$" GREPSTR IF
;Kilometres to Miles
{
"$1" GREPSUB tempkm1 =
tempkm1 ATOI 1000 * tempkm2 =
tempkm2 1609 / tempmile =
tempkm2 1609 % tmpmile2 =
"$1 Kilometres = " GREPSUB tempmile ITOA & "." & tmpmile2 ITOA & " Miles" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]km$" GREPSTR IF
;Miles to Kilometres
{
"$1" GREPSUB tempmil1 =
tempmil1 ATOI 1609 * tempmil2 =
tempmil2 1000 / tempkm3 =
tempmil2 1000 % tmpkm3 =
"$1 Miles = " GREPSUB tempkm3 ITOA & "." & tmpkm3 ITOA & " Kilometres" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]mile" GREPSTR IF
;Kilograms to Pounds
{
"$1" GREPSUB tempkg1 =
tempkg1 ATOI 10000 * tempkg2 =
tempkg2 4536 / templb =
tempkg2 4536 % tmplb2 =
"$1 Kilograms = " GREPSUB templb ITOA & "." & tmplb2 ITOA & " Pounds" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]kg$" GREPSTR IF
;Pounds to Kilograms
{
"$1" GREPSUB templb1 =
templb1 ATOI 4536 * templb2 =
templb2 10000 / tempkg3 =
templb2 10000 % tmpkg3 =
"$1 Pounds = " GREPSUB tempkg3 ITOA & "." & tmpkg3 ITOA & " Kilograms" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]lb$" GREPSTR IF
;MPH to KPH
{
"$1" GREPSUB tempmph =
tempmph ATOI 8 * mph1 =
mph1 5 / kph =
mph1 5 % kphdec =
"$1 MPH = " GREPSUB kph ITOA & "." & kphdec ITOA & " KPH" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]mph$" GREPSTR IF
;KPH to MPH
{
"$1" GREPSUB tempkph =
tempkph ATOI 5 * kph1 =
kph1 8 / mph =
kph1 8 % mphdec =
"$1 KPH = " GREPSUB mph ITOA & "." & mphdec ITOA & " MPH" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]kph$" GREPSTR IF
;KPH to MPH
{
"$1" GREPSUB tempkph =
tempkph ATOI 5 * kph1 =
kph1 8 / mph =
kph1 8 % mphdec =
"$1 KPH = " GREPSUB mph ITOA & "." & mphdec ITOA & " MPH" & SAY
"" GREPSUB CHATSTR =
}
CHATSTR LOWERCASE "^(.*)[*]kmh$" GREPSTR IF
;end LJ©'s Metric/Imperial Conversion
|