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 

bind time all 4 h

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


Joined: 22 Jun 2005
Posts: 49
Location: switzerland

PostPosted: Wed Dec 07, 2005 3:08 pm    Post subject: bind time all 4 h Reply with quote

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 Question

thx
Back to top
View user's profile Send private message
]Kami[
Owner


Joined: 24 Jul 2003
Posts: 590
Location: Slovenia

PostPosted: Wed Dec 07, 2005 3:51 pm    Post subject: Reply with quote

timer ? Smile
_________________
Slovene Eggdrop Page
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Dec 07, 2005 4:24 pm    Post subject: Reply with quote

You probably mean something like that?! Use your brain, all your hours have a remainder of 0 if you divide them by 4 Very Happy.
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
View user's profile Send private message MSN Messenger
ranny
Halfop


Joined: 22 Jun 2005
Posts: 49
Location: switzerland

PostPosted: Wed Dec 07, 2005 5:49 pm    Post subject: Reply with quote

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 Very Happy.
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 Very Happy

The good code is

Code:
if {[expr {[string trimleft $h 0] % 4}] == 0} {
      ...
   }


thx Laughing
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Dec 07, 2005 6:47 pm    Post subject: Reply with quote

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
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