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.

Check Pretime

Help for those learning Tcl or writing their own scripts.
Post Reply
i
intel
Halfop
Posts: 57
Joined: Tue Feb 26, 2008 11:51 pm

Check Pretime

Post by intel »

I am trying to get my script to announce BACKFiLL if the pretime is older then 12hrs.

Any help is appreciated.
Last edited by intel on Wed Dec 24, 2008 10:02 am, edited 1 time in total.
x
x-treem
Voice
Posts: 9
Joined: Mon Jul 21, 2008 11:13 am

Post by x-treem »

you sure have something that will call a duration function, somewhere there you should have a difference betwen now and pretime that is the variable you look for (or create one if that is not set to a variable). If that is >12h (3600 * 12) or whatever you like, then BACKFILL
i
intel
Halfop
Posts: 57
Joined: Tue Feb 26, 2008 11:51 pm

Post by intel »

I have
set time1 [unixtime]
incr time1 -$timestamp
set ago [duration $time1]
set after [clock clicks -milliseconds]

so I am confused as to what I should be doing and why 3600 *12?
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

Post by ShavdApe »

ideally you want time in seconds of your pretime

Now im not sure what your $timestamp looks like if its just unixtime but at the time of the pre then
set ago [expr $timestamp -[unixtime]] is all you need and youll be left with the amount of seconds between those two times.
if timestamp is more like a date format then use [clock scan $timestamp]

now youll need a limit set in seconds and then simply your if statement would look something like
set limit 3600
if {$ago > $limit} {
putqucik "PRIVMSG $chan :\[BACKFiLL] -- $rls was pred $ago ago
}
note 3600 = 1 hour in seconds hence the 12 * 3600 comment above i think

I think thats all correct anyway someone im sure will correct me if im wrong.

*edit*
ah looking at the above again it appears your $ago is more like 1 hour 30 secs ill assume your duration process does that if thats the case youll need to do that after the if cos the above code would work in seconds only. Hope this all helps not something I usually do this helping people business cos I suck at it lol
Post Reply