Hey guys, I wanted to share a really easy !time script for an mIRC bot. This is basically when the bot is just saying your time.
on 1:TEXT:!time:#channelname:/msg $chan $time
yeah, easy.
However, it if want to the bot to display the time for another user's chat, then here is a code that I found and edited to work. It is using #datalore and the timezone for Dublin
--------------------------
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, I tried to get this to work for multiple channels, but it kept attempting to PM a user named CURRENT (who doesn't exist) instead of the channel name, so I had to set it to only trigger and reply in datalore's chat. Now, there is nothing against running separate versions of the script in the same bot for separate channels.
if you want to experiment with this and see if you can get it to work in multiple chats, then please have at it.
Edit: There seems to be a few weird gaps in the lower parts of the code when I preview. If there is, I apologize for that.