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.

Looking BIND processes again ...

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Looking BIND processes again ...

Post by juanamores »

I made a code to verify that bind cron processes are active (bind) and which are not (unbind).
But not working properly, there are processes that are active (bind) and gives me like they are (unbind).
They bind cron processes that are checked if they are ON (bind) or OFF (unbind) are:
bind cron - {*/10 0 * * 1,2,3,4} advertise
bind cron - {*/15 0 * * 1,2,3,4} advertise15
bind cron - {*/20 0 * * 1,2,3,4} advertise2
bind cron - {*/30 0 * * 1,2,3,4} advertise3

Code: Select all

bind pub ato|vn !timers control:timers

proc control:timers { nick uhost hand chan arg } {
global canal_admin 
	foreach ele [binds cron] {
		foreach {type flags cmd hits func} $ele {
			if {$func eq "advertise"} { 
				putquick "PRIVMSG $canal_admin :\0033 \(STATUS TIMERs\)\002\0031 TIMER 10 min \0033ON"
			} 
				if {$func ne "advertise"} { 
					putquick "PRIVMSG $canal_admin :\0034 \(STATUS TIMERs\)\002\0031 TIMER 10 min \0034OFF"
				} 
					if {$func eq "advertise15"} { 
						putquick "PRIVMSG $canal_admin :\0033 \(STATUS TIMERs\)\002\0031 TIMER 15 min \0033ON"
					}					
						if {$func ne "advertise15"} { 
							putquick "PRIVMSG $canal_admin :\0034 \(STATUS TIMERs\)\002\0031 TIMER 15 min \0034OFF"
						}
							if {$func eq "advertise2"} { 
								putquick "PRIVMSG $canal_admin :\0033 \(STATUS TIMERs\)\002\0031 TIMER 20 min \0033ON"
							}
								if {$func ne "advertise2"} { 
									putquick "PRIVMSG $canal_admin :\0034 \(STATUS TIMERs\)\002\0031 TIMER 20 min \0034OFF"
								}
									if {$func eq "advertise3"} { 
										putquick "PRIVMSG $canal_admin :\0033 \(STATUS TIMERs\)\002\0031 TIMER 30 min \0033ON"
									}
										if {$func ne "advertise3"} { 
											putquick "PRIVMSG $canal_admin :\0034 \(STATUS TIMERs\)\002\0031 TIMER 30 min \0034OFF"
										}
		} 
	break
	}
}
I tried several ways, including testing the idea of ​​caesar to look BIND process, which is at the end of this post.

Using the form if - else, at times it not find anything, go to the line off break.
For debuggin purpose, I changed the line break:

Code: Select all

putquick "PRIVMSG $canal_admin :I found nothing!"
And runs that line.
Example:

Code: Select all

if {$func eq "advertise"} {
    putquick "PRIVMSG $canal_admin :\0033 \(STATUS TIMERs\)\002\0031 TIMER 10 min \0033ON"
} else {
        putquick "PRIVMSG $canal_admin :\0034 \(STATUS TIMERs\)\002\0031 TIMER 10 min \0034OFF"
    }
		if {$func eq "advertise15"} {
			putquick "PRIVMSG $canal_admin :\0033 \(STATUS TIMERs\)\002\0031 TIMER 15 min \0033ON"
		} else {
			putquick "PRIVMSG $canal_admin :\0034 \(STATUS TIMERs\)\002\0031 TIMER 15 min \0034OFF"
		} 	
######etc.................
putquick "PRIVMSG $canal_admin :I found nothing!"
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

How you might put a timer between each if ...
Perhaps with that fixed.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
Post Reply