Jump to content

Archived

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

chain

!Time

Recommended Posts

  • Administrators

!Time

 

!Time script. Gets the time from Wunderground.com.

Syntax is !time city state | !time city country | !time airportcode | !time zipcode.

Or: @time city state | @time city country | @time airportcode | @time zipcode.

 

The !trigger will notice the user and the @trigger will message the channel if the user has halfops or higher.

 

It also has an alias /time that uses the same syntax but only echo's to the active screen.

There is also a menu on the channel screen to disable the trigger.

 

To start using just right click channel or status screen, go to !Time and click On.

 

Example Output:

14:05:35 !time cvg

14:05:36 -Gliiim- Searching for Time ..................

14:05:39 -Gliiim- Time for Cincinnati-Northern KY International Kentucky is 3:05 PM EST

14:06:01 !time london england

14:06:02 -Gliiim- Searching for Time ..................

14:06:04 -Gliiim- Time for London United Kingdom is 8:06 PM GMT

 

>;!Time by Ford_Lawnmower irc.GeekShed.net #Script-Helpmenu Channel,Status {  .$iif($group(#Time) == On,$style(1)) !Time Trigger  ..$iif($group(#Time) == On,$style(2)) On: .enable #Time  ..$iif($group(#Time) == Off,$style(2)) Off: .disable #Time}#Time onOn $*:Text:/^(!|@)Time.*/Si:#: {  if (!$timer($+(Time,$network,$nick))) {    .timer $+ $+(Time,$network,$nick) 1 6 noop    var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))    TimeCheck %method $2-  }}#Time endalias Time { TimeCheck echo -a $1- }alias -l TimeCheck {  $1-2 04Searching for Time ..................  var %sockname $+(Time,$network,$2,$ticks)  sockopen %sockname www.wunderground.com 80  sockmark %sockname $1-2 $+(/cgi-bin/findweather/getForecast?query=,$fixurl($3-),&wuSelect=WEATHER) $replace($rfixurl($($fixurl($3-),1)),$chr(32),+)}On *:sockopen:Time*: {  if (!$sockerr) {    sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0    sockwrite -n $sockname Host: www.wunderground.com    sockwrite -n $sockname $crlf  }  else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }}On *:sockread:Time*: {  if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }  else {    var %Time | sockread %Time    if (There has been an error isin %Time) { $gettok($sock($sockname).mark,1-2,32) Time Not Found | sockclose $sockname }    elseif ($regex(%Time,/(.*)/)) { sockmark $sockname $addtok($sock($sockname).mark,$regml(1),7) }    elseif ($regex(%Time,(.*)Conditions)) { sockmark $sockname $addtok($sock($sockname).mark,$+($regml(1),$chr(7)),32) }    elseif ($regex(%time,/(.*)Forecast\s:\sWeather Underground/)) { sockmark $sockname $addtok($sock($sockname).mark,$+($regml(1),$chr(7)),32) }        elseif ($regex(%Time,(.*:.*))) {      $gettok($sock($sockname).mark,1-2,32) 04Time for $gettok($sock($sockname).mark,5-,32) 04is $regml(1)      sockclose $sockname      return    }  }}On *:sockclose:Time*: {   tokenize 7 $gettok($sock($sockname).mark,4-,32)  $gettok($sock($sockname).mark,1-2,32) 04Time Not Found. Suggestions for $+($replace($1,+,$chr(32)), :) $replace($2-,$chr(32),$chr(44))}alias -l fixurl { return $regsubex($1-,/([^a-z0-9])/iSg,% $+ $base($asc(\t),10,16,2)) }alias rfixurl { return $regsubex($1-,/\%([a-f0-9]{1,2})/ig,$chr($base(\t,16,10))) }

Link to comment
Share on other sites



×
×
  • Create New...