egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Existing script addedbots.tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
raven
Voice


Joined: 08 Aug 2011
Posts: 6

PostPosted: Tue Nov 01, 2011 9:44 am    Post subject: Existing script addedbots.tcl Reply with quote

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:
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?"
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Nov 01, 2011 1:58 pm    Post subject: Reply with quote

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:
#############################################################################################################
    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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
raven
Voice


Joined: 08 Aug 2011
Posts: 6

PostPosted: Tue Nov 01, 2011 2:29 pm    Post subject: Reply with quote

Heya!

Cleaned up that part in the script, really didn't help. Below is a directlink to the script itself if you wanna take a look.

http://www.egghelp.org/tclhtml/3478-4-0-0-1-addedbots.htm
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Nov 01, 2011 2:36 pm    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
raven
Voice


Joined: 08 Aug 2011
Posts: 6

PostPosted: Tue Nov 01, 2011 3:32 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Nov 01, 2011 4:08 pm    Post subject: Reply with quote

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:
    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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber