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.

timer

Old posts that have not been replied to for several years.
Locked
N
Nexus6
Op
Posts: 114
Joined: Mon Sep 02, 2002 4:41 am
Location: Tuchola, Poland

timer

Post by Nexus6 »

Lo i've changed one tcl, I changed timer because I wanted bot to cycle more often.

it used to cycle in every 3 mins,
Original code:

Code: Select all

set cycle_time 3 
if {![info exists spam_timer]} { set spam_timer [timer $cycle_time cycle_chans] } 
set recent_cycle 0
proc cycle_chans { } {
  global cycle_time spam_timer recent_cycle 
  set cycle_chan "#channel"
  foreach chan [channels] {
    if {![string match *cycle* $chan]} { set cycle_chan "$cycle_chan,$chan" }
  }
  putserv "part $cycle_chan"
  putserv "join $cycle_chan"
  set spam_timer [timer $cycle_time cycle_chans]
  set recent_cycle 1
  utimer [expr $cycle_time * 60 - 30]  reset_recent_cycle ....
and I wanted it to cycle every 53 secs, (yes a werird value;))

changed code, cycles every 53 secs but sometimes stays outta chan

Code: Select all

set cycle_time 53
if {![info exists spam_timer]} { set spam_timer [utimer $cycle_time cycle_chans] } 
set recent_cycle 0

proc cycle_chans { } {
  global cycle_time spam_timer recent_cycle 
  set cycle_chan "#channel"
  foreach chan [channels] {
    if {![string match *cycle* $chan]} { set cycle_chan "$cycle_chan" }
  }
  putserv "part $cycle_chan"
  putserv "join $cycle_chan"
  set spam_timer [utimer $cycle_time cycle_chans]
  set recent_cycle 1
  utimer [expr $cycle_time * 1 - 0.5] reset_recent_cycle ..
and it works but after sometime bot stays outta channel, it's not banned, and chan isn't +i or +k, even .dump join #channel didn't make bot rejoin.
[14:46] (acc0rd) [14:46] Server says I'm not on channel: #channel
[14:46] (N6) .tcl utimers
[14:46] (acc0rd) TCL: {46 cycle_chans timer1500} {40 reset_recent_cycle timer1501}
I find it every odd and I don't know what can cause that, thx for any help
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

I'm not sure (it doesn't look like the complete script) but I'm guessing the error is in

utimer [expr $cycle_time * 1 - 0.5] reset_recent_cycle ..

The old code was cutting off 30 seconds from cycle_time. You're cutting off .5 seconds, which is the same as 0 seconds. So there's something weird going on there, maybe sometimes the timer is being called too late.

Change that line back to the same way it was before and see if the error persists.
Locked