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.

[SOLVED] Help with a timmer that doesnt want to work..

Help for those learning Tcl or writing their own scripts.
Post Reply
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

[SOLVED] Help with a timmer that doesnt want to work..

Post by doggo »

hi guys...

the script works fine with the public trigger its the time bind im having a problem with :/

i would like it to check every 60 minutes and set the limit if it needs to +10

so my question is does anyone know why the time bind wont work ?

Code: Select all

bind pub -|- -limit SaNcTuM_limit

bind time -|- "* 1 * * *" SaNcTuM_limit


proc SaNcTuM_limit{min hour day month year} {
    foreach chan [channels] {
	putlog "SaNcTuM_limit timer ok"
	set newlimit [expr [llength [chanlist $chan]] + 10]
	set currentlimit [currentlimit $chan]
	if {$currentlimit < [expr $newlimit - 1] || $currentlimit > [expr $newlimit + 1]} {
	    putserv "mode $chan +l $newlimit"
	}
        }    
 }


proc currentlimit {chan} {
    set currentmodes [getchanmode $chan]
    if {[string match "*l*" [lindex $currentmodes 0]]} {
	return [lindex $currentmodes end] 
    }
    return 0
}


putlog "SaNcTuM_limit"
thanks... :)
Last edited by doggo on Tue May 18, 2010 8:09 pm, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Your mask is not correct.
It would match whenever the hour value is 1. However, single-digit values are 0-padded to 2 (4 for year) digits; that is, 1 o'clock is actually 01.

But, you should not match the hour at all, but the minutes. The minute value will match a fixed value once every hour - which is what you'll want:
Examples:

Code: Select all

#trigger every hour, on the hour:
bind time - "00 * * * *" proc

#trigger every hour, 15 minutes past the hour:
bind time - "15 * * * *" proc

#trigger every hour, 5 minutes past - more compact mask:
bind time - "05 *" proc
NML_375
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

nml375 wrote:Your mask is not correct.
It would match whenever the hour value is 1. However, single-digit values are 0-padded to 2 (4 for year) digits; that is, 1 o'clock is actually 01.

But, you should not match the hour at all, but the minutes. The minute value will match a fixed value once every hour - which is what you'll want:
Examples:

Code: Select all

#trigger every hour, on the hour:
bind time - "00 * * * *" proc

#trigger every hour, 15 minutes past the hour:
bind time - "15 * * * *" proc

#trigger every hour, 5 minutes past - more compact mask:
bind time - "05 *" proc
Cheers nml375

i totaly see where i was messing it up now ;)
Post Reply