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.

calc changes with time.

Help for those learning Tcl or writing their own scripts.
Post Reply
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

calc changes with time.

Post by honeybee »

Code: Select all

proc modes {nick host hand chan mode target} {
global botnick
  if {($mode == "+M")} {
    lappend tmode [unixtime]
    if {$tmode => "1190655265"} {;# clock scan for 10 mins
      [lreplace $tmode 0 XX]
   }
}
so we can count how many modes in 10 mins; i dont know if my logic is correct or it can be done this way please suggest me.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set initialTime [unixtime]

proc modes {nick host hand chan mode target} {
 global initialTime
 set mins [expr {([unixtime]-$initialTime)/60}]
 if {$mins > 10} {
  # more than 10 mins passed, reset time
  set initialTime [unixtime]
 } {
  # else, 10 mins still did not pass.
 }
}
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

Post by honeybee »

thanks Fz.
Post Reply