| View previous topic :: View next topic |
| Author |
Message |
Esoteric Voice
Joined: 11 Apr 2005 Posts: 19
|
Posted: Mon Apr 11, 2005 1:15 pm Post subject: TCL Error: wrong # args - google.tcl |
|
|
Hello, I just reinstalled my eggdrop bot and I am having and issue with getting several of my old scripts working. I have installed this on a new server.
My server is gentoo, with the latest version of tcl available in an ebuild. I can't tell you exactly what version I am using.
I get the following error in regards to this line (proc pub:google { nick uhost handle channel arg } {) ...
wrong # args: should be { join nick uhost handle channel arg }
I have tried changing it but still doesn't work, I just get another error. Can anyone help? What is causing this? Something new in TCL?
Thanks
-Erik
The google.tcl file is this:
| Code: |
# google.tcl v0.2.1
#
# !google keywords - displays the first related website found from google in the channel
# !image keywords - displays the first related image found on google in the channel
# !file keywords - displays the first mirror download link found on filemirrors in the channel
#
# by aNa|0Gue - analogue@glop.org - http://www.glop.org/
#
# 04/17/2002 v0.2.1 useragent fix by FAN
package require http
bind pub - !google pub:google
bind pub - !image pub:image
bind pub - !file pub:file
set agent "Mozilla"
proc pub:google { nick uhost handle channel arg } {
global agent
if {[llength $arg]==0} {
putserv "PRIVMSG $channel :hey ! tappes des mots boulet !"
} else {
set query "http://www.google.de/search?btnI=&q="
for { set index 0 } { $index<[llength $arg] } { incr index } {
set query "$query[lindex $arg $index]"
if {$index<[llength $arg]-1} then {
set query "$query+"
}
}
#putserv "PRIVMSG $channel :$query"
set token [http::config -useragent $agent]
set token [http::geturl $query]
puts stderr ""
upvar #0 $token state
set max 0
foreach {name value} $state(meta) {
if {[regexp -nocase ^location$ $name]} {
set newurl [string trim $value]
putserv "PRIVMSG $channel :$newurl"
}
}
}
}
proc pub:image { nick uhost handle channel arg } {
global agent
if {[llength $arg]==0} {
putserv "PRIVMSG $channel :hey ! tappes des mots boulet !"
} else {
set query "http://images.google.de/images?btnI=&q="
for { set index 0 } { $index<[llength $arg] } { incr index } {
set query "$query[lindex $arg $index]"
if {$index<[llength $arg]-1} then {
set query "$query+"
}
}
append query &imgsafe=off
# putserv "PRIVMSG $channel :$query"
set token [http::config -useragent $agent]
set token [http::geturl $query]
puts stderr ""
upvar #0 $token state
set max 0
foreach {name value} $state(meta) {
if {[regexp -nocase ^location$ $name]} {
set starturl "http://"
set newurl [string trim $value]
set newurl [string range $newurl [expr [string first = $newurl]+1] [expr [string first & $newurl]-1]]
append starturl $newurl
putserv "PRIVMSG $channel :$starturl"
}
}
}
}
proc pub:file { nick uhost handle channel arg } {
global agent
if {[llength $arg]==0} {
putserv "PRIVMSG $channel :hey ! tappes un nom de fichier boulet !"
} else {
set query "http://www.filemirrors.com/find.src?file="
set query "$query[lindex $arg 0]"
# putserv "PRIVMSG $channel :$query"
set token [http::config -useragent $agent]
set token [http::geturl $query]
set html [http::data $token]
puts stderr ""
upvar #0 $token state
set max 0
# foreach {name value} $state(meta) {
# putserv "PRIVMSG $channel :$value"
# }
# putserv "PRIVMSG $channel :$html"
set result "[lindex $html 1]"
set result [string range $result [expr [string first = $result]+2] [expr [string first > $result]-2]]
putserv "PRIVMSG $channel :$result"
}
}
putlog "Google v0.2.1 - LOADED!"
|
_________________ -Erik |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Mon Apr 11, 2005 1:33 pm Post subject: |
|
|
have completly restarted your bot with that script?
can you give us the more detailed error from '.set errorInfo'?
have you accidently loaded another google script?
if you have my egghttp port of this script in memory you would encounter the problem because of this line:
| Quote: | | pub:google $nick $uhost $hand $chan google $arg |
you can easily check this by doing a '.binds pub' in the partyline, if you have a bind to pub to the function pub:google:cmd this would proabably be your problem and you would only have to unbind that (if you dont want to .restart your bot) ^^. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
Esoteric Voice
Joined: 11 Apr 2005 Posts: 19
|
Posted: Mon Apr 11, 2005 1:48 pm Post subject: |
|
|
I will give more info as soon as I get home, for now what is your egghttp port? Can you give me a link?
Thanks! _________________ -Erik |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Mon Apr 11, 2005 2:11 pm Post subject: |
|
|
this is basicly the same idea of script, just a bit optimized and rewritten from the package http which often causes problems to the save and non-blocking egghttp (package is the wrong expression, its just a tcl script providing some functions).
http://forum.egghelp.org/viewtopic.php?t=9207 _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
Esoteric Voice
Joined: 11 Apr 2005 Posts: 19
|
Posted: Mon Apr 11, 2005 2:15 pm Post subject: |
|
|
| Code: |
Command bindings:
TYPE FLGS COMMAND HITS BINDING (TCL)
pub -|- !help 1 pub:help
pub -|- !google 2 pub:google
|
I have a lot more binds but that is the only google bind.
.set errorInfo doesn't work... _________________ -Erik |
|
| Back to top |
|
 |
Esoteric Voice
Joined: 11 Apr 2005 Posts: 19
|
Posted: Mon Apr 11, 2005 2:21 pm Post subject: |
|
|
I am running egghttp.tcl and your google script and I still get the error
wrong # args: should be "join nick uhost hand chan" _________________ -Erik |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Mon Apr 11, 2005 2:30 pm Post subject: |
|
|
| Esoteric wrote: | | .set errorInfo doesn't work... |
then you have probably it disabled in the .conf file ^^
but very strange, if you really checked all I mentioned, I cannot help here.
neither my script neither the script posted above can produce that error as they are, there must be an other script interferring with them (unless you do a .restart, once loaded scripts won't unload just because you removed their source and did a .rehash). _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
Esoteric Voice
Joined: 11 Apr 2005 Posts: 19
|
Posted: Mon Apr 11, 2005 2:41 pm Post subject: |
|
|
where is the conf file do I look to enable it ... I can't find it ...
is there anyone else that can help?
it has to be an issue with TCL... what version are you running? _________________ -Erik |
|
| Back to top |
|
 |
Linux Halfop

Joined: 04 Apr 2004 Posts: 71 Location: Under The Sky
|
Posted: Mon Apr 11, 2005 2:56 pm Post subject: |
|
|
| De Kus wrote: | | Esoteric wrote: | | .set errorInfo doesn't work... |
then you have probably it disabled in the .conf file ^^
but very strange, if you really checked all I mentioned, I cannot help here.
neither my script neither the script posted above can produce that error as they are, there must be an other script interferring with them (unless you do a .restart, once loaded scripts won't unload just because you removed their source and did a .rehash). |
Well, restart your bot and load the scripts seperately i.e. 1 by 1 and check out if the problem still there. _________________ I'm an idiot, At least this one [bug] took about 5 minutes to find... |
|
| Back to top |
|
 |
Linux Halfop

Joined: 04 Apr 2004 Posts: 71 Location: Under The Sky
|
Posted: Mon Apr 11, 2005 3:04 pm Post subject: |
|
|
| Code: | # by murf
# Commands
# .google keyword(s) <# of results>
# e.g. .google sick 5
# default number of returns
set google_def_num 4
# max number of returns
set google_max 10
set glpubbind .google
set gl_output "NOTICE $nick"
bind pub -|- $glpubbind pub_google
proc pub_google {nick uhost handle chan search} {
global gl_ouput
set gl_output "NOTICE $nick"
if {[llength $search] == 0} {
puthelp "$gl_output : Whatcha searchin for fool!?"
return 0
}
set url [google_url $search $nick $chan]
google_getpage $url
return 0
}
# Google_url #
# Takes input and parses to set the url, returns the url
proc google_url {search nick chan} {
global google_def_num google_max gl_output
set google_num [lindex $search end]
if {[regexp { [0-9]+} $search match $google_num]} {
if {$google_num > $google_max} { set google_num $google_max }
set search [lrange $search 0 [expr {[llength $search] - 2}]]
} else {
set google_num $google_def_num
}
if {$google_num >= 5} {
set gl_output "NOTICE $nick"
} else {
set gl_output "PRIVMSG $chan"
}
regsub -all { } $search {+} search
set url "/search?hl=en&num=$google_num&lr=&ie=ISO-8859-1&q=$search"
return $url
}
# google_getpage #
# gets the webpage and parses for the returns
proc google_getpage {url} {
global gl_output
## Open socket
if {[catch {set glsock [socket -async www.google.com 80]} sockerr]} {
puthelp "NOTICE $nick :$sockerr"
puthelp "NOTICE $nick :Try again later, look out the window till then!"
close $glsock
return 0
}
puts $glsock "GET $url"
flush $glsock
set i 0
set j 1
set glout [gets $glsock]
while {[regexp {Dissatisfied with your results?} $glout] == 0} {
set glout [gets $glsock]
incr i
if {$i >= 150} {
break
}
if {[regexp {#008000>(.*?) - } $glout match gl_result($j)]} {
puthelp "$gl_output :$j. http://$gl_result($j)"
incr j
}
}
close $glsock
return 0
} |
_________________ I'm an idiot, At least this one [bug] took about 5 minutes to find... |
|
| Back to top |
|
 |
Esoteric Voice
Joined: 11 Apr 2005 Posts: 19
|
Posted: Mon Apr 11, 2005 3:14 pm Post subject: |
|
|
found my issue, it seems that one of my other scripts is corrupting the other scripts ... thanks. now I have to and try to fix the broken script. _________________ -Erik |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Mon Apr 11, 2005 5:22 pm Post subject: |
|
|
This was paragraph 3 in my first post
| Quote: | | have you accidently loaded another google script? |
PS: a scrip with the proc name "pub:google" is a google script, whatever it does, its related to google... _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Last edited by De Kus on Mon Apr 11, 2005 6:44 pm; edited 1 time in total |
|
| Back to top |
|
 |
Esoteric Voice
Joined: 11 Apr 2005 Posts: 19
|
Posted: Mon Apr 11, 2005 5:39 pm Post subject: |
|
|
it wasn't another google script ... it was another script with the same proc name ... screwed things up. _________________ -Erik |
|
| Back to top |
|
 |
|