View Single Post
Old 06-29-2004, 12:17 PM  
godlike
Senior Member
 
Join Date: Dec 2003
Posts: 94
Default [Filled] Standalone BNC script (based off dZSbot)

I have taken some code from dZSbot and tried to make a BNC test script for all my sites which test all sites from a single location and puts back the result in a notice to a user... but the script worked for a few days and some day i just started the bot and i always get when i do !bnc on chan this error on partyline:

TCL error [proc_bnc]: invalid command name "replacevar"
The code is probably a mess
And in c:/ioFTPD/bot/scripts/ i have the ncftpls.exe

The code is:

Code:
set bncchecking "1"
set cmdpre "!"

# SETUP THIS ONLY IF YOU HAVE BNC for your SERVER
set bnc(LIST) "192.168.0.0:7755 193.45.56.23:6655"
set bnc(NAME) "site1 site2"
set bnc(SECTIONS) "PC-GAMES|Divx-Xvid|MP3 MP3|DivX-XviD"
set bnc(USER) "bncuser"
set bnc(PASS) "bncpass"
set bnc(TIMEOUT) 10

set announce(BNC) "%color7%sitename%color * ( %bold%host%bold ) * ( %status ) * %bold%color7%sections%color%bold"

set binary(NCFTPLS) "c:/ioFTPD/bot/scripts/ncftpls.exe"

set disable(NCFTPLS) 0

# set the blowfish encrytion key (empty = no encryption)
set blfs(KEY) ""

# set the blowfish header tag
set blfs(HEADER) "mcps"

set procs {
${cmdpre}bnc:proc_bnc
}

bind pub -|- [set cmdpre]bnc proc_bnc

proc sndchan {puttype nick args} {
	global splitter blfs
	foreach line [split [lindex $args 0] $splitter(CHAR)] {
		if { $blfs(KEY) != "" } {
			set eline [encrypt $blfs(KEY) $line]
			$puttype "NOTICE $nick :$blfs(HEADER) $eline"
		} else {$puttype "NOTICE $nick :$line"}
	}
}

proc proc_bnc { nick uhost hand chan arg } {
global bnc announce binary disable
if { $disable(NCFTPLS) == 0 } {
foreach eachbnc $bnc(LIST) eachname $bnc(NAME) eachsection $bnc(SECTIONS) {
if {$eachbnc == ""} {continue}
set output $announce(BNC)
set now1 [clock clicks -milliseconds]
set status [catch { exec -- $binary(NCFTPLS) -u $bnc(USER) -p $bnc(PASS) -t $bnc(TIMEOUT) -r 00 ftp://$eachbnc } result]
set now2 "Response time: %bold[expr ([clock clicks -milliseconds] - $now1)]%boldms"
if { ([regexp \[.\]*ncftpls\:\ cannot\ open\[.\]* $result] > 0) } { set bncchk "%bold%color4DOWN%color%bold" ; set bncspeed "" } else { set bncchk "%bold%color9UP%color%bold" ; set bncspeed $now2 }
set output [replacevar $output "%host" $eachbnc]
set output [replacevar $output "%status" $bncchk]
set output [replacevar $output "%speed" $bncspeed]
set output [replacevar $output "%sitename" $eachname]
set output [replacevar $output "%sections" $eachsection]
set output [basicreplace $output "BNC"]
sndchan "puthelp" $nick $output
}
}
}

proc basicreplace {strin section} {
	#putlog "proc basicreplace"
	global bncchecking
	set output [replacevar $strin "%bncchecking" $bncchecking]
	set output [replacevar $output "%bold" "\002"]
	set output [replacevar $output "%color" "\003"]
	set output [replacevar $output "%uline" "\037"]
	return "$output"
}
All the names ip`s and such things in this post are made up.
godlike is offline   Reply With Quote