Get_A_Fix commented on a Page, Temperature Converter (C - F and F - C)  -  May 06, 2008

I was bored, so I beefed this up a little.

``````on *:TEXT:*:#: {
if (\$1 == +convert) {
if (!%no.flood. [ \$+ [ \$nick ] ] ) {
if (!\$2) { msg \$chan ERROR \$+ : Insufficient Parameters. SYNTAX \$+ : +convert c/f <temperature> | halt }
if (\$2 isnum) { msg \$chan ERROR \$+ : Insufficient Parameters. SYNTAX \$+ : +convert c/f <temperature> | halt }
if (\$2 isletter) { msg \$chan ERROR \$+ : Insufficient Parameters. SYNTAX \$+ : +convert c/f <temperature> | halt }
if (\$2 = f) {
if (\$3 = 0) { msg \$chan Converting 0 \$+ \$chr(176) Fahrenheit to Celsius: -17.77 \$+ \$chr(176) Celsius | set -u5 %no.flood. [ \$+ [ \$nick ] ] 1 | halt }
if (!\$3) { msg \$chan \$nick \$+ , I need a temperature to convert. }
if (\$3 isletter) { msg \$chan Converting \$3 \$+ : You\'re an Idiot? | set -u5 %no.flood. [ \$+ [ \$nick ] ] 1 | halt }
if (\$3 isnum) {
set %t1 \$calc(\$3 - 32)
set %temp \$calc(%t1 * 0.55555555555555555555555555555556)
msg \$chan Converting \$3 \$+ \$chr(176) Fahrenheit to Celsius: \$round(%temp,2) \$+ \$chr(176) Celsius
set -u5 %no.flood. [ \$+ [ \$nick ] ] 1
}
}
if (\$2 = c) {
if (\$3 = 0) { msg \$chan Converting 0 \$+ \$chr(176) Celsius to Fahrenheit: 32 \$+ \$chr(176) Fahrenheit | set -u5 %no.flood. [ \$+ [ \$nick ] ] 1 | halt }
if (!\$3) { msg \$chan \$nick \$+ , I need a temperature to convert. }
if (\$3 isletter) { msg \$chan Converting \$3 \$+ : You\'re an Idiot? | set -u5 %no.flood. [ \$+ [ \$nick ] ] 1 | halt }
if (\$3 isnum) {
set %t1 \$calc(\$3 * 1.8)
set %temp \$calc(%t1 + 32)
msg \$chan Converting \$3 \$+ \$chr(176) Celsius to Fahrenheit: \$round(%temp,2) \$+ \$chr(176) Fahrenheit
set -u5 %no.flood. [ \$+ [ \$nick ] ] 1
}
}
}
}
}
``````

atleast this way it returns syntax when users perform the command improperly, and checks for flooding.

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.