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.
sdays
Halfop
Posts: 98 Joined: Sat Oct 21, 2006 4:46 am
Post
by sdays » Fri Feb 09, 2007 4:38 am
Can some one help me with this socket bot..
i get:
Code: Select all
<eggdrop> [02:46] Tcl error [socket:add]: missing close-bracket
Code: Select all
bind pub - !addbot socket:add
proc socket:add {nick uhost hand chan} {
global nick realname username socket:chan socket:serv socket:nick socket:conn
set socketnick $nick[rand 1000]
set chan "$text0"
set serv "text1"
set port "text2"
if {![validchan $chan]} {
putserv "NOTICE $nick :Invalid Channel"
putserv "NOTICE $nick :usage: !addbot <channel> <server> \[port\]"
} else {
if {$serv == ""} {
putserv "NOTICE $nick :Specify a Server"
putserv "NOTICE $nick :usage: !addbot <channel> <server> \[port\]"
} else {
if {[info exists $socket:conn]} {
if {[valididx $socket:conn} {
putserv "NOTICE $nick :QUIT :Switching Servers"
killdcc $socket:conn
}
}
if {$port == ""} {
set socket:conn [connect $serv 6667]
} else {
if {$port != ""} {set socket:conn [connect $serv $port]}
}
set socket:chan $chan
set socket:serv $serv
putlc "USER $username 0 0 :$realname"
putlc "NICK :$socket:nick"
}
return 1
}
}
rosc2112
Revered One
Posts: 1454 Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania
Post
by rosc2112 » Fri Feb 09, 2007 5:18 am
If you indented your code properly, you'd be able to find the missing close bracket.
sdays
Halfop
Posts: 98 Joined: Sat Oct 21, 2006 4:46 am
Post
by sdays » Fri Feb 09, 2007 5:56 am
Im not really good a tcl scripting..
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Fri Feb 09, 2007 6:19 am
sdays wrote: Im not really good a tcl scripting..
For every open brace '{' there has to be a matching closing one '}'.
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM
sdays
Halfop
Posts: 98 Joined: Sat Oct 21, 2006 4:46 am
Post
by sdays » Fri Feb 09, 2007 6:22 am
Ok i fix that part but now it, now won't connect to irc..
Code: Select all
bind pub - !addbot socket:add
proc socket:add {nick uhost hand chan arg} {
global realname username socket:chan socket:serv socket:conn
set nick [lindex $arg 0]
set chan [lindex $arg 1]
set serv [lindex $arg 2]
set port [lindex $arg 3]
if {![validchan $chan]} {
putserv "NOTICE $nick :Invalid Channel"
putserv "NOTICE $nick :usage: !addbot <nick> <channel> <server> \[port\]"
} else {
if {$serv == ""} {
putserv "NOTICE $nick :Specify a Server"
putserv "NOTICE $nick :usage: !addbot <nick> <channel> <server> \[port\]"
}
}
if {$port == ""} {
set socket:conn [connect $serv 6667]
} else {
if {$port != ""} {set socket:conn [connect $serv $port]}
}
set socket:chan $chan
set socket:serv $serv
puts "USER $username 0 0 :$realname"
puts "NICK :$nick"
}
return 1
}
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Fri Feb 09, 2007 6:24 am
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM
sdays
Halfop
Posts: 98 Joined: Sat Oct 21, 2006 4:46 am
Post
by sdays » Fri Feb 09, 2007 6:35 am
i get this <eggdrop> Currently: wrong # args: should be "error message ?errorInfo? ?errorCode?"
sdays
Halfop
Posts: 98 Joined: Sat Oct 21, 2006 4:46 am
Post
by sdays » Fri Feb 09, 2007 6:54 am
Btw im wanting this tcl so it check for invite spam every 10 mins or so..
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Fri Feb 09, 2007 10:04 am
sdays wrote: Btw im wanting this tcl so it check for invite spam every 10 mins or so..
http://www.demond.net/spambuster.tcl
Have you ever read "The Manual"?
sdays
Halfop
Posts: 98 Joined: Sat Oct 21, 2006 4:46 am
Post
by sdays » Fri Feb 09, 2007 1:23 pm
hmm thats not what im looking for im wanting it on a socket bot
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Fri Feb 09, 2007 1:27 pm
sdays wrote: hmm thats not what im looking for im wanting it on a socket bot
Then why are you using 'connect'? demond's script does what you claim to be trying to do.
...using 'connect' to make the tcp connection
Have you ever read "The Manual"?
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Fri Feb 09, 2007 3:11 pm
Might be worth mentioning, that you currently mix tcl's I/O mechanisms with eggdrop's own socket-implementations. They are not compatible; ie. you cannot use 'puts' with sockets opened with 'connect' or 'listen'. In the same fashion, you cannot use 'putidx' or 'control' with sockets created with the 'socket' command.
Each method has it own advantages and disadvantages; so I'd suggest you read up on both and decide on which to use before you proceed with coding this script.
Also, on a sidenote, I can't stress enough how bad it is to use list-commands (such as 'lindex') on strings. Please use 'split' to convert strings into lists when neccesary.
NML_375