|
|
#1578 - 04/09/08 03:54 PM
World time script
|
newbie
Registered: 12/24/07
Posts: 42
Loc: Whitesburg, TN
|
I found this code on the net, but I could never get it to workj for my bot. I found a way to get it to work corrently with some creative edits. Also, I am only able to get it to work in one channel at a time. I have this set for datalore's chat, and I decided to add a different script for each channel it was in. This script is really best for when you are running a bot in someone else's chat that is in a different timezone than you are in. on 1:TEXT:!time*:#datalore:{
wtime dublin
}
alias wtime {
sockopen timed www.timeanddate.com 80
set %srch $1
}
on 1:SOCKOPEN:timed:{
sockwrite -n $sockname GET $+(/search/results.html?query=,%srch) HTTP/1.1
sockwrite -n $sockname Host: www.timeanddate.com
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on 1:SOCKREAD:timed:{
sockread %temp
if (<a href="/worldclock/city.html?n= isin %temp) { sockmark timed $remove($gettok(%temp,1,62),<a href=",") | wdtime }
if (<div class="minititle">No matches were found for*word</div> iswm %temp) { msg #testaway Sorry, No Match Found for $+(",,%srch,") | unset %srch }
}
alias wdtime {
sockopen wtimed www.timeanddate.com 80
}
on 1:sockopen:wtimed:{
sockwrite -n $sockname GET $+(/,$sock(timed).mark) HTTP/1.0
sockwrite -n $sockname Host: www.timeanddate.com
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on 1:sockread:wtimed:{
sockread %temp
if (<tr><th class="head" colspan="2"><span class="biggest">* iswm %temp) { /msg $chan ** $remove($gettok(%temp,4,62),</span) ** }
if (<tr class="d0"><th>Current time</th> isin %temp) { /msg #datalore Datalore's Current Time: $remove($gettok(%temp,5,60) $+(,$iif($remove($gettok(%temp,7,62),</a) == </td,,$remove($gettok(%temp,7,62),</a))) }
if (<tr><td>Standard time zone:</td> isin %temp) { /msg #datalore Datalore's current time: $remove($gettok(%temp,10,62), </td>) }
unset %srch
}
Now for this, since if I just had $chan and the like, it would try to PM either someone named "sorry" or "current" depending on which instance it was. For people to use this, all you need to edit is #datalore to the chat name you want and dublin in the 2nd line to a city near you. However, if you are in the same timezone as the bot is all you need is this. on 1:TEXT:!time:#channelname:/msg $chan Current time is $time
_________________________
I am Gary "TuxedoJericho" Greenlee, and I support this message.
|
|
Top
|
|
|
|
Sponsored Links
Member
    
Registered: 27/08/04
Posts: 10136
Loc: Mountain View, CA
|
|
|
Top
|
|
|
|
#1582 - 04/09/08 09:12 PM
Re: World time script
[Re: TuxedoJericho]
|
n00b
Registered: 04/07/08
Posts: 17
Loc: canada
|
where it it says on 1:TEXT:!time*:#DATALORE:{ wtime dublin do we change it to our chanl.
_________________________
O is for on the dark side, beacouse we have some fresh cookies. (COOKIES) WOO!
|
|
Top
|
|
|
|
#1599 - 04/09/08 10:40 PM
Re: World time script
[Re: dave]
|
newbie
Registered: 12/24/07
Posts: 42
Loc: Whitesburg, TN
|
that is one of the places, but down at the end it says on 1:sockread:wtimed:{
sockread %temp
if (<tr><th class="head" colspan="2"><span class="biggest">* iswm %temp) { /msg $chan ** $remove($gettok(%temp,4,62),</span) ** }
if (<tr class="d0"><th>Current time</th> isin %temp) { /msg #datalore Datalore's Current Time: $remove($gettok(%temp,5,60) $+(,$iif($remove($gettok(%temp,7,62),</a) == </td,,$remove($gettok(%temp,7,62),</a))) }
if (<tr><td>Standard time zone:</td> isin %temp) { /msg #datalore Datalore's current time: $remove($gettok(%temp,10,62), </td>) }
unset %srch
}You need to change the chat room there too.
Edited by TuxedoJericho (04/09/08 10:41 PM)
_________________________
I am Gary "TuxedoJericho" Greenlee, and I support this message.
|
|
Top
|
|
|
|
Moderator: AdmiralJustin, Atri, Catt, crrj, dolsen, Freekie, Helio, Jeff, jpmk12, Justin, Kat, mandy, Mist, nobody, Phil, Pierce, Ryan, SuburbanWolf, therock247uk, ThunderIT-Allan, usrbingeek
|
|
1 registered (1 invisible),
6
Guests and
6
Spiders online. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|