Go Back   FlashFXP Forums > > > >

! Requests Need a script or some sort of cool .bat file ? Ask here!

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-29-2004, 12:17 PM   #1
godlike
Senior Member
ioFTPD Foundation User
 
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
Old 06-29-2004, 01:17 PM   #2
tuff
Senior Member
FlashFXP Registered User
ioFTPD Scripter
 
Join Date: Jan 2003
Posts: 277
Default

where is the replacevar proc?
__________________
#iotools #ioftpd (both on efnet)
tuff is offline   Reply With Quote
Old 06-29-2004, 01:19 PM   #3
jeza
Senior Member
ioFTPD Scripter
 
jeza's Avatar
 
Join Date: May 2003
Posts: 530
Default

there is a missing proces replacevar


proc replacevar {strin what withwhat} {

set output $strin
set replacement $withwhat
set cutpos 0
while { [string first $what $output] != -1 } {
set cutstart [expr [string first $what $output] - 1]
set cutstop [expr $cutstart + [string length $what] + 1]
set output [string range $output 0 $cutstart]$replacement[string range $output $cutstop end]
}
return $output
}
jeza is offline   Reply With Quote
Old 06-29-2004, 01:43 PM   #4
godlike
Senior Member
ioFTPD Foundation User
 
Join Date: Dec 2003
Posts: 94
Default

HAHA damn im blind LOL

Thx ... hahahahaha
godlike is offline   Reply With Quote
Old 08-02-2004, 08:43 AM   #5
buffi
Junior Member
 
Join Date: Jul 2004
Posts: 18
Default

Hi All,
I also used that script and managed to get it working but it announces only if the windrop is also running dszbot.tcl
without that it wont announce on the channel. I want it to be a selfscript.

this is the script :
Code:
set bncchecking "1"
set cmdpre "!"

# SETUP THIS ONLY IF YOU HAVE BNC for your SERVER
set bnc(LIST) "localhost:4147"
set bnc(NAME) "Home"
set bnc(SECTIONS) "GAMES/APPS"
set bnc(USER) "SiteBoT"
set bnc(PASS) "12345678"
set bnc(TIMEOUT) 10

set announce(BNC) "%bold%color0%sitename%color%bold - %bold%color12%sections:%color%bold%color0 %host is%color %status"

set binary(NCFTPLS) "C:/WINDOWS/system32/Setup/Driver/ioFTPD/windrop/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}bncroc_bnc
}

bind pub -|- [set cmdpre]bnc proc_bnc

proc sndchan {puttype chan args} {
global splitter blfs
foreach line [split [lindex $args 0] $splitter(CHAR)] {
if { $blfs(KEY) != "" } {
set eline [encrypt $blfs(KEY) $line]
$puttype "PRIVMSG $chan :$blfs(HEADER) $eline"
} else {$puttype "PRIVMSG $chan :$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 "BNCS"]
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"
}
proc replacevar {strin what withwhat} {

set output $strin
set replacement $withwhat
set cutpos 0
while { [string first $what $output] != -1 } {
set cutstart [expr [string first $what $output] - 1]
set cutstop [expr $cutstart + [string length $what] + 1]
set output [string range $output 0 $cutstart]$replacement[string range $output $cutstop end]
}
return $output
}
where do i need to set the channel that i want it to post on???

pls help thanks
buffi is offline   Reply With Quote
Reply

Tags
$output, bnc, output, set, [replacevar

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:38 PM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)