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 Help

Old posts that have not been replied to for several years.
Locked
E
Esoteric
Voice
Posts: 19
Joined: Mon Apr 11, 2005 1:08 pm

Timer Help

Post by Esoteric »

I seem to be having an issue with .rehash and my script that I have that uses timers. I read somewhere, not sure where, that by doing the first if statement that it would keep the initial timer from being started again upon a rehash. What happens is that every time I rehash I get a new instance so I get my message printing to a channel more then every thirty minutes if $var = 1. I will get it like 3 times every 30 minutes.

Please help.

Code: Select all


if {![info exists $running]} {
  timer 05 start
  set running 1
}

proc timer:start { } {
 #proc code here
 if {$var == 1} {
   timer 30 start
   putserv "PRIVMSG #channel : Message"
 } else {
   timer 05 start
 }
}
-Erik
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

foreach timer [timers] {
 if {![string equal -nocase "start" [lindex [split $timer] 1]]} {
  #there is no timer for proc start.
 }
}
E
Esoteric
Voice
Posts: 19
Joined: Mon Apr 11, 2005 1:08 pm

Post by Esoteric »

So put that code in instead of the first if statement and that does a search for a prexisting timer associated with start right? And if it doesn't find out then executes code where the comment is?

-Erik
-Erik
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Your proc doesn't seem to be correct, what's $var ?
E
Esoteric
Voice
Posts: 19
Joined: Mon Apr 11, 2005 1:08 pm

Post by Esoteric »

I left alot out because it is a lot of code and I don't have it all at work with me. The main part that I am concerned with is that the initial timer is being run each time I rehash my bot creating multiple instances which gets annoying because it messages the channel, so if I rehash the bot instead of getting a message every 30 minutes I might get one every 15 minutees depending on how long the previous timer has been running.

Does that make sense?

What is an easy way to see all timers that are active and running?
-Erik
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Type: .tcl timers in partyline.

Make sure your dcc:tcl unbind is commented with an '#' infront in the bots .conf file, so the '.tcl' trigger in dcc works.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked