This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Time script help

Old posts that have not been replied to for several years.
Locked
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Time script help

Post by guest »

Well Im making a Time script but It has some bugs and I cant fix it myself. plz help =)

Code: Select all

bind pub - .time pub:time1 
bind msg - .time msg:time2 
proc pub:time1 {nick host handle chan text} {pub:time $chan $text} 
proc msg:time2 {nick uhost hand text} {pub:time $nick $text} 

proc pub:time {chan text} { 
package require http  
set url "http://www.timeanddate.com/worldclock/full.html?sort=1&low=c"  
set data [http::data [set socket [http::geturl $url]]] ; http::cleanup $socket  
set time "" 
set place "" 
#                  <a href="city.html?n=120"> 
regexp  -nocase [subst -nocommands -noback {>(.*?${text}.*?)</a></td><td class=r>(.*?)</td>}] $data data2 place time 
#^I think this is errorus becouse  
#regexp  -nocase [subst -nocommands -noback {>.*?${text}.*?</a></td><td class=r>(.*?)</td>}] $data data2 time 
#works 

puthelp "PRIVMSG $chan :Time In $place is: $time" 
}
Well if somebody want to make it work faster or sumtin I would be happy too =P
User avatar
TALES
Halfop
Posts: 59
Joined: Sun Nov 09, 2003 8:45 am
Location: Netherlands
Contact:

Post by TALES »

the set url is wrong i think: should be

Code: Select all

set url "http://www.timeanddate.com/worldclock/city.html?n=120"
and the regexp:

Code: Select all

#this is the line you want i think ??
#<th>Current time</th><td><b>Friday, February  6, 
#2004, at 10:17:34 AM</b></td></tr>
regexp -nocase {Current time</th><td><b>(.*?)</b></td></tr>} $data data2 place time}
dont know if it work try some
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

nonono the url is correct the commented line was just the text that is infront of it... (exept the number is not the same...)
Locked