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 

is it correct?

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


Joined: 01 Jan 2006
Posts: 80

PostPosted: Fri May 12, 2006 9:41 am    Post subject: is it correct? Reply with quote

I'm trying to make a time check bind to hit routine:check proc after every 3 hours. i guess its not the correct way, btw. with current version of tcl we can directly do it instead of making bind for everyhour and checking inside the proc?

bind time - "*0 * * * *" routine:check
bind time - "* */3 * * *" routine:check
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 12, 2006 11:14 am    Post subject: Reply with quote

Code:
bind time - "00 *" routine:check

proc routine:check {m h args} {
 if {[scan $h %d]%3 != 0} {return 0}
 # do your stuff here
}

_________________
Follow me on GitHub

- Opposing

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


Joined: 01 Jan 2006
Posts: 80

PostPosted: Fri May 12, 2006 1:25 pm    Post subject: Reply with quote

Thanks, i was thinking to use.
Code:
if {[expr $hour % 3]} { return }
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri May 12, 2006 6:32 pm    Post subject: Reply with quote

which basicly does the same, since the expression will return doing nothing, if the reminder is not 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
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 12, 2006 7:02 pm    Post subject: Reply with quote

Yes, but the number needs to be converted to decimal because 08 and 09 are not valid octal numbers.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sat May 13, 2006 1:42 pm    Post subject: Reply with quote

oh, I didnt preconceive that. You are totally right. I wondered why you used scan to get the integer Very Happy. Alternately you could simply use [string trimleft $h 0] Smile. I'd guess it would be faster.
Quote:
StarZ|De_Kus ?calc 08 % 3
-[-RO^Bot-]- Fehler: expected integer but got "08" (looks like invalid octal number)

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