Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Feels Like (Weather)

Recommended Posts

  • Administrators

Feels Like (Weather)

 

Save to feelslike.mrc and load with /load -rs feelslike.mrc

Do /flmake

Use !fladd (Code being your weather code from intellicast.com)

i.e !fladd MXTS0107

 

Usage:

!fl (if you're added to the bot)

!fl (if you're not added)

 

Looks like:

(07:10:00 am) (~Victoria) Feels Like: 66° F, 18° C

 

With help from Jethro_ and napa182 (iirc) I've been working on sockets and hash tables, and this a rewrite from a previous version. Got a little practice with math as well. Still could be refined a bit, and I'll work on that, but I figured I'd share what I have so far.

 

Whats New:

 

- Added Hash Tables to allow for multiple users

- Added C temperatues

- Utilized sockmark and $sock().mark commands

 

 

>alias flmake {  hmake -s feelslike 100  hsave -o feelslike feelslike.hsh} On *:load: {  hload feelslike feelslike.hsh} On *:TEXT:!fladd *:#: {  hadd feelslike $nick $2  msg # Added, use !fl} On *:TEXT:!fl*:#:{   if ($sock(feelslike)) sockclose feelslike  sockopen feelslike www.intellicast.com 80  sockmark feelslike msg # Feels Like:   if ($2) {    set %userloc $2  }  if (!$2) {    set %userloc $hget(feelslike,$nick)  }} On *:SOCKOPEN:feelslike: {  sockwrite -nt $sockname GET /Local/Weather.aspx?location= $+ %userloc HTTP/1.1  sockwrite -nt $sockname Host: www.intellicast.com  sockwrite -nt $sockname $crlf} On *:SOCKREAD:feelslike: {  if ($sockerr) {    tokenize 32 $sock(feelslike).mark    $1 $2 $sock(feelslike).wserr | halt  }  else {     var %sockreader     sockread %sockreader     if (*Feels Like:* iswm %sockreader) {       tokenize 32 %sockreader      var %flt $remove($7,°)      $sock(feelslike).mark %flt $+ ° F $+ , $floor($round($calc((%flt - 32) * (5/9)),1)) $+ ° C      sockclose feelslike | unset %userloc    }   } } On *:EXIT: {  hsave -o feelslike feelslike.hsh} 

Link to comment
Share on other sites



×
×
  • Create New...