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
s
slashem
Voice
Posts: 18
Joined: Tue Aug 13, 2002 6:35 pm

timer help..

Post by slashem »

I made a procedure that I wanna execute every 3 hours..
proc timecheck { } {
...
some code
..
}

it checks a database for something and msg's something to a nickname if it's found..

I wanna do this procedure every 3 hours so do I just add:
timer 180 [timecheck] in the eggdrop.conf ?

I tried .tcl timer 2 [timecheck] in the partyline to see if it does something but nothing appeared to work.. it did start a timer however and now I don't know how to stop it or how to view the timers that are running..

would really appreciate some help on this.. thx
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

It apears that you are using the timer command incorrect.

Tcl has a special meaning for commands within [] brackets.

A lot of commands, return data, and as suhc, this data needs some method or another, of being stored, or used in another command. THe goal of the [] brackets, it to allow this data return to take place.

Anything between [ and ] is called as a command, and is then replaced with the return value, on the fly (meaning, if the return value is different each time, so will the value being replaced).

Thus, if using

Code: Select all

proc mycommand {} {
  return this
}
timer 180 [mycommand]
This is saying, run the code between the [], and replace it with the returned value. Thus, the command becomes

Code: Select all

timer 180 this
Thus, the [mycommand] is replaced instantly, and the command "this" is executed after 180 mins.

In your case, this is obviously wrong.

You should infact be using a plain old

Code: Select all

timer 180 mycommand
This would run the command "mycommand" after 180 mins.

Applying this to your script, in reality, you simply change the command so that the []'s are removed.

However, this does not solve your problems 100%.

You state that ".tcl timer 180 [blah]" didn't work. In that case, there is a problem witht he rest of your script anyway. Seeing as the []'s mean your script is run right away, it should have done a database update.

If it hasn't, then this neads looking intop itself.

Beyond that, once a timer has run it's course, it dies. IE, it's one off thing. And you will need to a create a newone, after it has completed it's cycle of 180 mins.
Locked