egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Question regarding timers

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Wed Dec 19, 2007 10:18 am    Post subject: Question regarding timers Reply with quote

Code:
timer 58 topic:reset
proc topic:reset {} {
putserv "TOPIC #Islamabad :Resynching ..."
putserv "TOPIC #Islamabad :Welcome to #islamabad the capital city of PAKISTAN \00303,15 \00315,3 (* \003 , Live Cricket Commentary is in #Cricket"
timer 58 topic:reset
}


If i am using a timer in one of my tcl and i dont kill the timer by the end of the code what are the disadvantages of it? what problems can it generate? and can I use multiple timers? if yes then please explain how.

Thanks
iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Dec 19, 2007 12:49 pm    Post subject: Reply with quote

That piece of code looks just fine. There is no need to try and terminate the timer that triggered the proc, as it is/will be terminated anyway as part of the execution.

The only thing worth noting, is that if you load this script multiple times, you'll end up with multiple timers (might be a good idea to check wether there is a timer running before starting a new one from outside the proc).
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Thu Dec 20, 2007 3:13 am    Post subject: Reply with quote

Exactly, the timer mismatch at times.. could you tell me how do I find out whether it's running multiple times or not..
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 20, 2007 11:33 am    Post subject: Reply with quote

Try searching the forum, this has been discussed many times.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Dec 21, 2007 9:01 am    Post subject: Reply with quote

Thanks FZ for the reply but I could not find anything like that, anyway I am using TimerToolz from Archive and I kill timers from DCC.

1 more question is

Code:
bind time - "* 00 * * *" test:1
bind time - "* 02 * * *" test:1
bind time - "* 04 * * *" test:1
bind time - "* 06 * * *" test:1
bind time - "* 08 * * *" test:1
bind time - "* 10 * * *" test:1
bind time - "* 12 * * *" test:1
bind time - "* 14 * * *" test:1
bind time - "* 16 * * *" test:1
bind time - "* 18 * * *" test:1
bind time - "* 20 * * *" test:1
bind time - "* 22 * * *" test:1


proc test:1 {min hour day month year} {
putserv "PART #Islamabad :Checking Spam."
putserv "JOIN #Islamabad"
}


Ok does that mean the bot will part/join the channel every 2 hours?.. please tell me about that.

Thanks
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri Dec 21, 2007 9:09 am    Post subject: Reply with quote

iamdeath wrote:
Code:
bind time - "* 00 * * *" test:1

Ok does that mean the bot will part/join the channel every 2 hours?..

Your first * means your masks will match EVERY minute when the hours match, which is pretty far from what you want Razz Here's a way to execute stuff every 2 hours with a single bind:
Code:
bind time - "00 *" every_hour
proc every_hour {m h args} {
   if {([scan $h %d]%2)==0} {
      # every 2 hours
   }
}

_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Dec 21, 2007 9:21 am    Post subject: Reply with quote

Thanks alot that was way too easy and usefull thanks alot user Wink
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber