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

Old posts that have not been replied to for several years.
Locked
s
sarahJ
Voice
Posts: 3
Joined: Mon Jul 18, 2005 5:51 am

Time Script

Post by sarahJ »

Hello Everyone

Is there a script out there that can do the following if so can you please point me in the right direction as i have not come across anything by searching egghelp.org archives

What i need is for the bot to respond to when someone does !time in channel it must display the bots time and then the person who did the commands time and also limiting the person who does !time to 1 in 5 minutes

Example:
<sarah> !time
<botnick> time: Mon Jul 18 10:32:57 2005 sarah's time: Mon Jul 18 10:32:57 2005

Any help will be great

Thanks sarah
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Code: Select all

# the chan you want this to work in
set tm(chan) #chan

bind pub - !time pub:ttime
proc pub:ttime {nick uhost hand chan text} {
 global tm
 if {![string eq -noc $tm(chan) $chan]||[info exists tm($uhost)]} {return}
 set n [lindex [split $text] 0]
 if [onchan $n $chan] {
  putserv "PRIVMSG $n :\001TIME\001"
  set tm($uhost) 1
  timer 5 [list unset tm($uhost)]
 } {
  putserv "PRIVMSG $chan :Usage: !time <nick>"
 }
}

bind ctcr - TIME reply:ttime
proc reply:ttime {nick uhost hand dest keyword text} {
 putserv "PRIVMSG $::tm(chan) :time: [ctime [clock seconds]], $nick's time: $text"
}
s
sarahJ
Voice
Posts: 3
Joined: Mon Jul 18, 2005 5:51 am

Post by sarahJ »

Thanks alot greenbear works perfectly :D

Just one more question if you dont mind, is it possible to make it that you dont have to state the nick after the !time command so instead of:

!time sarah
<botnick> Time: Mon Jul 18 17:12:56 2005, sarah's Time: Mon Jul 18 17:12:56 2005

make it just:

!time
so that it still ctcp times the person who does !time
<botnick> Time: Mon Jul 18 17:12:56 2005, sarah's time: Mon Jul 18 17:12:56 2005

and can it be done so that the bot display its time one hour ahead of its real time?

Thanks again for your help most appreciated :)

sarah
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

try this

Code: Select all

# the chan you want this to work in
set tm(chan) #chan

bind pub - !time pub:ttime
proc pub:ttime {nick uhost hand chan text} {
 global tm
 if {![string eq -noc $tm(chan) $chan]||[info exists tm($uhost)]} {return}
 if {$text!=""} {set n [lindex [split $text] 0]} {set n $nick}
 if [onchan $n $chan] {
  putserv "PRIVMSG $n :\001TIME\001"
  set tm($uhost) 1
  timer 5 [list unset tm($uhost)]
 } {
  putserv "PRIVMSG $chan :Usage: !time <nick>"
 }
}

bind ctcr - TIME reply:ttime
proc reply:ttime {nick uhost hand dest keyword text} {
 putserv "PRIVMSG $::tm(chan) :time: [ctime [expr [clock seconds]+3600]], $nick's time: $text"
}
s
sarahJ
Voice
Posts: 3
Joined: Mon Jul 18, 2005 5:51 am

Post by sarahJ »

greenbear your good :wink:

Thanks alot its working just the way i want it.

:D
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

np
Locked