tglogo.png

Downloading File

Filename: !Time
  1. ;***
  2. ;***
  3. ;Simple Time Script by Ford_Lawnmower
  4. ;This is a simple script that gets the time from a weather site of all places
  5. ;Syntax !time city state - !time city country - !time zipcode - !time airport code
  6. ;There is also a alias /time city state . Works the same way.
  7. ;Questions comments, You can find me on Swift-IRC #Technical, WyldRyde #Script-Help, Abjects #Technical,#AtomReactor
  8. ;Mindforge #Technical, #USA, #Hollywood, #Emule-USA
  9. ;***
  10. ;***
  11. alias time.timeout {
  12.   if (%time.chan == echo) { echo -a Connection was timed out... We could not find your time... :( }
  13.   else { .msg %time.chan Connection was timed out...:( }
  14.   time.clear
  15. }
  16. alias time.notfound {
  17.   if (%time.chan == echo) { echo -a time not found. Try being more descriptive ie !time london england }
  18.   else { .msg $chan Time not found. Try being more descriptive. ie !time london england }
  19.   time.clear
  20. }
  21. alias time.clear {
  22.   set %time.inuse 0
  23.   unset %time*
  24.   sockclose time
  25.   .timer-time off
  26.   halt
  27. }
  28. alias time {
  29.   if (%time.inuse == 1) { echo -a time in use. To reset the script type /time.clear | return error1 | halt }
  30.   if (!$1) { echo -at you must enter a city and state!! Syntax /time city state }
  31.   set %time.inuse 1
  32.   set %time.nick $me
  33.   set %time.chan ECHO
  34.   sockclose time
  35.   set %timeurl /cgi-bin/findweather/getForecast?query= $+ $replace($1-,$chr(32),$chr(37) $+ 20) $+ &wuSelect=WEATHER&MR=1
  36.   set %timesite www.wunderground.com
  37.   ;echo -at opening http:// $+ %timesite $+ %timeurl
  38.   sockopen time %timesite 80
  39.   .timer-time 1 15 time.timeout
  40. }
  41. #WundergroundTime On
  42. on *:TEXT:!time*:# {
  43.   if (%time.inuse == 1) { .notice $nick Sorry, But Somebody else is already looking up a time. | halt }
  44.   if (!$2) { .notice $nick Syntax !time city state/!time zipcode/!time airport code }
  45.   set %time.inuse 1
  46.   set %time.nick $nick
  47.   set %time.chan $chan
  48.   sockclose time
  49.   set %timeurl /cgi-bin/findweather/getForecast?query= $+ $replace($2-,$chr(32),$chr(37) $+ 20) $+ &wuSelect=WEATHER&MR=1
  50.   set %timesite www.wunderground.com
  51.   sockopen time %timesite 80
  52.   .msg $chan 4 $chan time finder... 7Searching for4 time 3Please Wait.....
  53.   .timer-time 1 15 time.timeout
  54. }
  55. #WundergroundTime End
  56. on *:sockopen:time: {
  57.   sockwrite -n $sockname GET %timeurl HTTP/1.1
  58.   sockwrite -n $sockname Host: %timesite $+ $CRLF $+ $CRLF
  59. }
  60. on *:sockread:time: {
  61.   if ($sockerr > 0) { .notice %time.nick There has been an error... I could not retrive your Time Sorry |  time.clear }
  62.   else {
  63.     var %timevar |  sockread %timevar | set %time.line $calc(%time.line + 1)
  64.     if (%time.line > 400) { time.notfound }
  65.     if (There has been an error isin %timevar) { time.notfound }
  66.     if (%time.place.found == on) { unset %time.place.found | set %time.place $httpstrip(%timevar) }
  67.     if (<td class="nobr full"> isin %timevar) { set %time.place.found on }
  68.     if (%time.time.found == on) {
  69.       if (%time.chan == ECHO) {
  70.         echo -a 07The current time for04 %time.place 06is09 $httpstrip(%timevar)
  71.       }
  72.       else {
  73.         .msg %time.chan 07The current time for04 %time.place 06is09 $httpstrip(%timevar)
  74.       }
  75.       time.clear
  76.     }
  77.     if (Local Time: isin %timevar) { set %time.time.found on }
  78.   }
  79. }
  80. Menu Channel {
  81.   .WundergroundTime
  82.   ..Trigger On: .enable #WundergroundTime
  83.   ..Trigger Off: .disable #WundergroundTime
  84. }
  85. alias -l httpstrip {
  86.   var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9))
  87.   return %x
  88. }
  89.  

Related Files

by Cassiel
by FordLawnmower

Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand