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.

timers causing timeouts? / bad code

Old posts that have not been replied to for several years.
Locked
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

timers causing timeouts? / bad code

Post by kain »

i found the original tcl in the archive, i loaded it to see if it was any good, and it seemed to work fine. i made a few changes (no timer changes) and after a few days i noticed that a lot of the bots started to timeout, even though it wasnt loaded on those bots, all i can think is that the timers are causing problems. i would appreciate someone who knows the script or this problem to take a look, thanks :)

Code: Select all

bind topc - * topic:topic_change
bind pub o|o whotopic pub:topicby

proc topic:topic_change {nick uhost hand chan topic} {
   global topcnick topctime
   set chan [string tolower $chan]
   if {![info exists topcnick($chan)]} {
      set topcnick($chan) ""
   }
   if {$nick != "*"} {
      set topcnick($chan) $nick
      set topctime($chan) [unixtime]
   }
}

proc pub:topicby {nick uhost hand chan arg} {
   global topcnick topctime
   set chan [string tolower $chan]
   putcmdlog "<<$nick/$chan>> $hand requested whotopic for $chan"
   if {$topcnick($chan) != ""} {
      set time [expr [unixtime] - $topctime($chan)]
      set years 0
      set days 0
      set hours 0
      set mins 0
      if {$time < 60} {
         return "< 1 min"
      }
      if {$time >= 31536000} {
         set years [expr int([expr $time/31536000])]
         set time [expr $time - [expr 31536000*$years]]
      }
      if {$time >= 86400} {
         set days [expr int([expr $time/86400])]
         set time [expr $time - [expr 86400*$days]]
      }
      if {$time >= 3600} {
         set hours [expr int([expr $time/3600])]
         set time [expr $time - [expr 3600*$hours]]
      }
      if {$time >= 60} {
         set mins [expr int([expr $time/60])]
      }
      if {$years == 0} {
         set output ""
      } elseif {$years == 1} {
         set output "1 year,"
      } else {
         set output "$years years,"
      }
      if {$days == 1} { 
         lappend output "1 day,"
      } elseif {$days > 1} {
         lappend output "$days days,"
      }
      if {$hours == 1} {
         lappend output "1 hour,"
      } elseif {$hours > 1} {
         lappend output "$hours hours,"
      }
      if {$mins == 1} {
         lappend output "1 minute"
      } elseif {$mins > 1} {
         lappend output "$mins minutes" 
      }
      set timeago [string trimright [join $output] ", "]
      if {$topcnick($chan) == "*"} {
         puthelp "privmsg $chan :The topic was already set when i joined this channel $timeago ago." 
      } else {
      puthelp "privmsg $chan :The topic was set by: $topcnick($chan) $timeago ago."
      }
   } else {
   puthelp "privmsg $chan :I didn't see the topic being changed."
   }
}
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The timeouts will be caused by somthing else.

Timeouts are nothing to do with timers (unless a script is badly coded). They are a sign, that the bot is not replying to a server ping in time.

This can be cuased by bad and lagged network connections, and many other machine related issues.

If you have not changed any of the setup on the bots in question, it's liely to be the machine they are running on (or it's net connection).

The script has nothing wrong with it, and, seeing as the bots in question do not have it loaded, it is certainly not th ecause of the timeouts.
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

i just thought it was weird the way they started to timeout after i loaded this script.
anyway ive taken it off all the bots where it was loaded and killed them and resatrted, they now dont timeout, and ive changed nothing but load this script. oh well i'l look elsewhere :)
Locked