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.

bind time

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

bind time

Post by iamdeath »

Hi, can anyone please explain to me in detail about bind time ****** ... I don't get it, if you can give me a tutorial link or something liek that I will really appreciate that. Thanks.
|AmDeAtH @ Undernet
Death is only the *Beginning*...
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

doc/tcl-commands.doc wrote: (37) TIME (stackable)
bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>

Description: allows you to schedule procedure calls at certain
times. mask matches 5 space separated integers of the form:
"minute hour day month year". minute, hour, day, month have a
zero padding so they are exactly two characters long; year is
four characters. Flags are ignored.
Module: core
Simply put, upon every HOOK_MINUTELY (every minute), a string is created such as this "<minute> <hour> <day> <month> <year>" (the same string could be generated using [clock format -format "%M %H %d %m %Y" [clock seconds]]). This is then matched against all time-bindings you've created (in a similar fashion to "string match", thus allowing wildcards such as *), and if it matches, the associated code is executed.

The mask "*" would match any time (and thus trigger every minute).
The mask "00 *" would match whenever the minute-part is 00 (triggers every hour on the hour).
The mask "* 01 *" would match whenever the hour, day, or month is 01 (or any combination of those) - probably not useful, and most scripters were probably intending a completely different result.
NML_375
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

This should also be useful (from Tcl-commands.doc):
*** MATCH CHARACTERS ***

Many of the bindings allow match characters in the arguments. Here
are the four special characters:

? matches any single character
* matches 0 or more characters of any type
% matches 0 or more non-space characters (can be used to match a single
word)
~ matches 1 or more space characters (can be used for whitespace between
words)
These match-characters can be used in the <mask> of binds (which accept wild cards).
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks alot that was really useful, i'll use it in a script and let you know if there is any problem I am facing.
Thanks :)
|AmDeAtH @ Undernet
Death is only the *Beginning*...
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Worth noting: the first month is 00, while the first day is 01 (and there's no mention of that in the docs)
Have you ever read "The Manual"?
Post Reply