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.
Help for those learning Tcl or writing their own scripts.
raven
Voice
Posts: 12 Joined: Mon Aug 08, 2011 9:06 am
Post
by raven » Tue Nov 01, 2011 9:44 am
Hi!
I downloaded a script that is supposed to look at the botnet, and let me know wich bots isn't linked in. It works on one bot, a leaf, but I want to have it on the hub. But it gives me a error.
SCRIPT:
Code: Select all
bind pub m \?bots pub_list_bots
proc pub_list_bots {nick host hand chan arg} {
global botnick
set msg ""
set added_bot 0
set on_chan 0
set not_on_chan 0
set linked 0
set linked_msg ""
set misslink ""
set missonchan ""
foreach hand [userlist] {
set leave 1
if {[matchattr $hand b] == 1} {incr added_bot; set leave 0}
if {($leave == 0) && ([onchan [hand2nick $hand] $chan])} {incr
on_chan}
if {($leave == 0) && (![onchan [hand2nick $hand] $chan])} {incr
not_on_chan; append msg "$hand , "}
if {($leave == 0) && ([islinked $hand])} {incr linked}
if {($leave == 0) && (![islinked $hand]) && ($hand != "$botnick")}
{append linked_msg "$hand , "}
}
if {[string range $msg [expr [string length $msg] -1] end] != ", "} {
set msg "[string trimright $msg ", "]"
}
if {[string range $linked_msg [expr [string length $linked_msg] -1]
end] != ", "} {
set linked_msg "[string trimright $linked_msg ", "]"
}
set plah ""
set linked [expr $linked + 1]
set misslink [expr $added_bot - $linked]
set missonchan [expr $added_bot - $on_chan]
if {$added_bot != "$on_chan"} {
set plah "Added Bots\: [b]$added_bot[b]... But only [b]$on_chan[b]
are here."
if {$linked != $on_chan} {append plah " Linked Bots\:
[b]$linked[b]."}
putserv "PRIVMSG $chan :--\> $plah"
if {$linked == $on_chan} {
putserv "PRIVMSG $chan :--\> Missing ([b]$missonchan[b])\:
$msg"
} else {
putserv "PRIVMSG $chan :--\> Missing on Channel
([b]$missonchan[b])\: $msg"
if {$misslink != "0"} {
putserv "PRIVMSG $chan :--\> Missing Linked
([b]$misslink[b])\: $linked_msg"
}
}
} else {
putserv "PRIVMSG $chan :--\> All [b]$added_bot[b] Bots are here."
}
}
proc b {} {return \002}
proc u {} {return \037}
And the error is:
[13:31] Tcl error [pub_list_bots]: wrong # args: should be "incr varName ?increment?"
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Tue Nov 01, 2011 1:58 pm
You've got a few newlines in this post in inappropriate positions, that would cause this error. Could you check if these newlines are present in the scripts on your eggdrops?
Code: Select all
#############################################################################################################
if {($leave == 0) && ([onchan [hand2nick $hand] $chan])} {incr
on_chan}
if {($leave == 0) && (![onchan [hand2nick $hand] $chan])} {incr
not_on_chan; append msg "$hand , "}
if {($leave == 0) && ([islinked $hand])} {incr linked}
if {($leave == 0) && (![islinked $hand]) && ($hand != "$botnick")}
{append linked_msg "$hand , "}
#############################################################################################################
# Should be:
if {($leave == 0) && ([onchan [hand2nick $hand] $chan])} {incr on_chan}
if {($leave == 0) && (![onchan [hand2nick $hand] $chan])} {incr not_on_chan; append msg "$hand , "}
if {($leave == 0) && ([islinked $hand])} {incr linked}
if {($leave == 0) && (![islinked $hand]) && ($hand != "$botnick")} {append linked_msg "$hand , "}
#############################################################################################################
# Or, for proper postings on the board:
if {($leave == 0) && ([onchan [hand2nick $hand] $chan])} {
incr on_chan
}
if {($leave == 0) && (![onchan [hand2nick $hand] $chan])} {
incr not_on_chan
append msg "$hand , "
}
if {($leave == 0) && ([islinked $hand])} {
incr linked
}
if {($leave == 0) && (![islinked $hand]) && ($hand != "$botnick")} {
append linked_msg "$hand , "
}
NML_375
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Tue Nov 01, 2011 2:36 pm
Unfortunately, those are the only four lines within that script that contains the incr function, and thus are the only reasonable sources for the error you posted.
When editing the script, make sure you are using an editor that does not use word-wrapping.
NML_375
raven
Voice
Posts: 12 Joined: Mon Aug 08, 2011 9:06 am
Post
by raven » Tue Nov 01, 2011 3:32 pm
I re-downloaded the script and upzip'ed without opening in, to both shells..same error om hub bot but working on a leaf!
Can it be outdated TCL on the box?
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Tue Nov 01, 2011 4:08 pm
I doubt that (would have to be an improper tcl parser, not able to handle ; as a command separator).
Regardless, the last version in my earlier post should work for any version of tcl (though I missed to include the following line):
Code: Select all
if {[matchattr $hand b] == 1} {incr added_bot; set leave 0}
#### Change into
if {[matchattr $hand b] == 1} {
incr added_bot
set leave 0
}
NML_375