tglogo.png

Downloading File

Filename: !Time
;***
;***
;Simple Time Script by Ford_Lawnmower
;This is a simple script that gets the time from a weather site of all places
;Syntax !time city state - !time city country - !time zipcode - !time airport code
;There is also a alias /time city state . Works the same way.
;Questions comments, You can find me on Swift-IRC #Technical, WyldRyde #Script-Help, Abjects #Technical,#AtomReactor
;Mindforge #Technical, #USA, #Hollywood, #Emule-USA
;***
;***
alias time.timeout {
  if (%time.chan == echo) { echo -a Connection was timed out... We could not find your time... :( }
  else { .msg %time.chan Connection was timed out...:( }
  time.clear
}
alias time.notfound {
  if (%time.chan == echo) { echo -a time not found. Try being more descriptive ie !time london england }
  else { .msg $chan Time not found. Try being more descriptive. ie !time london england }
  time.clear
}
alias time.clear {
  set %time.inuse 0
  unset %time*
  sockclose time
  .timer-time off
  halt
}
alias time {
  if (%time.inuse == 1) { echo -a time in use. To reset the script type /time.clear | return error1 | halt }
  if (!$1) { echo -at you must enter a city and state!! Syntax /time city state }
  set %time.inuse 1
  set %time.nick $me
  set %time.chan ECHO
  sockclose time
  set %timeurl /cgi-bin/findweather/getForecast?query= $+ $replace($1-,$chr(32),$chr(37) $+ 20) $+ &wuSelect=WEATHER&MR=1
  set %timesite www.wunderground.com
  ;echo -at opening http:// $+ %timesite $+ %timeurl
  sockopen time %timesite 80
  .timer-time 1 15 time.timeout
}
#WundergroundTime On
on *:TEXT:!time*:# {
  if (%time.inuse == 1) { .notice $nick Sorry, But Somebody else is already looking up a time. | halt }
  if (!$2) { .notice $nick Syntax !time city state/!time zipcode/!time airport code }
  set %time.inuse 1
  set %time.nick $nick
  set %time.chan $chan
  sockclose time
  set %timeurl /cgi-bin/findweather/getForecast?query= $+ $replace($2-,$chr(32),$chr(37) $+ 20) $+ &wuSelect=WEATHER&MR=1
  set %timesite www.wunderground.com
  sockopen time %timesite 80
  .msg $chan 4 $chan time finder... 7Searching for4 time 3Please Wait.....
  .timer-time 1 15 time.timeout
}
#WundergroundTime End
on *:sockopen:time: {
  sockwrite -n $sockname GET %timeurl HTTP/1.1
  sockwrite -n $sockname Host: %timesite $+ $CRLF $+ $CRLF
}
on *:sockread:time: {
  if ($sockerr > 0) { .notice %time.nick There has been an error... I could not retrive your Time Sorry |  time.clear }
  else {
    var %timevar |  sockread %timevar | set %time.line $calc(%time.line + 1)
    if (%time.line > 400) { time.notfound }
    if (There has been an error isin %timevar) { time.notfound }
    if (%time.place.found == on) { unset %time.place.found | set %time.place $httpstrip(%timevar) }
    if (<td class="nobr full"> isin %timevar) { set %time.place.found on }
    if (%time.time.found == on) {
      if (%time.chan == ECHO) {
        echo -a 07The current time for04 %time.place 06is09 $httpstrip(%timevar)
      }
      else {
        .msg %time.chan 07The current time for04 %time.place 06is09 $httpstrip(%timevar)
      }
      time.clear 
    }
    if (Local Time: isin %timevar) { set %time.time.found on }
  }
}
Menu Channel {
  .WundergroundTime
  ..Trigger On: .enable #WundergroundTime
  ..Trigger Off: .disable #WundergroundTime
}
alias -l httpstrip {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9))
  return %x
}
 

Related Files

by krizoek
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