| View previous topic :: View next topic |
| Author |
Message |
ranny Halfop
Joined: 22 Jun 2005 Posts: 49 Location: switzerland
|
Posted: Wed Dec 07, 2005 3:08 pm Post subject: bind time all 4 h |
|
|
Hello,
I want to send a message in a channel all 4 hours.
I have this code
| Code: | bind time - "00 00 *" myproc
bind time - "00 04 *" myproc
bind time - "00 08 *" myproc
bind time - "00 12 *" myproc
bind time - "00 16 *" myproc
bind time - "00 20 *" myproc |
There's a more simple solution, shorter
thx |
|
| Back to top |
|
 |
]Kami[ Owner

Joined: 24 Jul 2003 Posts: 590 Location: Slovenia
|
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Wed Dec 07, 2005 4:24 pm Post subject: |
|
|
You probably mean something like that?! Use your brain, all your hours have a remainder of 0 if you divide them by 4 .
| Code: | bind time - "00 *" myproc
proc myproc {min h d m y} {
if {[expr {$h % 4}] == 0} {
...
}
} |
_________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
ranny Halfop
Joined: 22 Jun 2005 Posts: 49 Location: switzerland
|
Posted: Wed Dec 07, 2005 5:49 pm Post subject: |
|
|
| De Kus wrote: | You probably mean something like that?! Use your brain, all your hours have a remainder of 0 if you divide them by 4 .
| Code: | bind time - "00 *" myproc
proc myproc {min h d m y} {
if {[expr {$h % 4}] == 0} {
...
}
} |
|
Yes,thx De Kus.
I use my brain and i see your error
The good code is
| Code: | if {[expr {[string trimleft $h 0] % 4}] == 0} {
...
} |
thx  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Dec 07, 2005 6:47 pm Post subject: |
|
|
No need to trim and no need to use expr inside the if statement.
| Quote: | .tcl if {04%4 == 0} { putlog yes }
[23:50] yes |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|