| View previous topic :: View next topic |
| Author |
Message |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Fri Mar 25, 2011 2:50 am Post subject: |
|
|
Not sure what happened with that snippet of code. Eggdrop crashed, and I'm getting this error:
| Code: | [23:49:49] Tcl error in file 'oldskewl.conf':
[23:49:49] invalid character "}"
in expression "0}"
(parsing expression "0}")
invoked from within
"if [catch {set shoefile [http::geturl "http://www.oldskewl.info/links.txt" -timeout 5000]} error]} {
putlog "ERROR: Cannot create link list ( $erro..."
(file "scripts/SorgIS.tcl" line 50)
invoked from within
|
|
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri Mar 25, 2011 2:55 am Post subject: |
|
|
Try this instead...
| Code: | package require http
if {[catch {set shoefile [::http::geturl "http://www.whateverdomain.com/links.txt" -timeout 5000]} error]} {
putlog "ERROR: Cannot create link list ( $error )"
set shoelace [list] ; unset shoefile
} else {
set shoelace [split [http::data $shoefile] "\n"]
::http::cleanup $shoefile ; unset shoefile
} |
That's what giving advice at midnight does to me.. lmfao
I missed a leading start brace { to lead the "if" expression containing the catch. My bad.. sorry to have caused your bot to crash...  _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Fri Mar 25, 2011 3:01 am Post subject: |
|
|
| Hahaha, no problem. I should have caught that myself =P |
|
| Back to top |
|
 |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Tue Mar 29, 2011 7:22 pm Post subject: |
|
|
I'm having a super weird problem with my script, and it's been happening from the beginning of usage, I just figured it was something random.
Every time I .rehash the bot crashes with the following errors:
| Code: | <oldskewl> [16:18:17] *** Can't load Userinfo TCL v1.07 -- At least Eggdrop v1.4.3 required
<oldskewl> [16:18:17] Loading netbots.tcl v4.10...
<oldskewl> [16:18:17] Tcl error in file 'oldskewl.conf':
<oldskewl> [16:18:17] can't read "version": no such variable
<oldskewl> while executing
<oldskewl> "split $version"
<oldskewl> invoked from within
<oldskewl> "if {[string trimleft [lindex [split $version] 1] 0] < 1032200} {
<oldskewl> die "*** netbots.tcl $nb_ver requires eggdrop 1.3.22 or later. Please upgrade your ..."
<oldskewl> (file "netbots/netbots.tcl" line 13)
<oldskewl> invoked from within
<oldskewl> "source netbots/netbots.tcl"
<oldskewl> (file "oldskewl.conf" line 1374)
<oldskewl> [16:18:17] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
*** Connection closed |
I have absolutely no idea what this might be, because its two totally different scripts which are not communicating with each other. Also, this only happens when I load the TCL in question. If I disable i can start/rehash with no problems. Eggdrop version is 1.6.20 |
|
| Back to top |
|
 |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Wed Mar 30, 2011 1:30 pm Post subject: |
|
|
Actually I take it back. All of these conflicts seem to be due to this piece of code
| Code: | package require http
if [catch {set shoefile [::http::geturl "http://www.whateverdomain.com/links.txt" -timeout 5000]} error]} {
putlog "ERROR: Cannot create link list ( $error )"
set shoelace [list] ; unset shoefile
} else {
set shoelace [split [http::data $shoefile] "\n"]
::http::cleanup $shoefile ; unset shoefile
} |
Any possible reasons? |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Mar 30, 2011 1:33 pm Post subject: |
|
|
| Quote: |
<oldskewl> die "*** netbots.tcl $nb_ver requires eggdrop 1.3.22 or later. Please upgrade your ..."
<oldskewl> (file "netbots/netbots.tcl" line 13)
<oldskewl> invoked from within
<oldskewl> "source netbots/netbots.tcl"
|
The error clearly states the contrary to what you think is the culprit.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Wed Mar 30, 2011 1:39 pm Post subject: |
|
|
You would think so, and thats why this issue is so odd. When I disable the script and restart the eggdrop there are no errors, and i can rehash fine. Only when the script is loaded will it crash the bot with the errors, unrelating to the script.
Also, when I changed
| Code: | package require http
if [catch {set shoefile [::http::geturl "http://www.whatever.com/links.txt" -timeout 5000]} error]} {
putlog "ERROR: Cannot create link list ( $error )"
set shoelace [list] ; unset shoefile
} else {
set shoelace [split [http::data $shoefile] "\n"]
::http::cleanup $shoefile ; unset shoefile
} |
To
| Code: | set shoefile [open "scripts/links.txt" r]
set shoelace [split [read -nonewline $shoefile] "\n"]
close $shoefile ; unset shoefile |
There are no longer errors. This is why I assume it must be in the first set of code.
Last edited by streamish on Wed Mar 30, 2011 1:43 pm; edited 1 time in total |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Mar 30, 2011 1:43 pm Post subject: |
|
|
| Code: | | if [catch {set shoefile [::http::geturl "http://www.whateverdomain.com/links.txt" -timeout 5000]} error]} { |
I thought you said you fixed that missing brace there son...
Notice, between if and [ is a missing { ...
We discussed this above, scroll up... This is the problem, that unaligned brace.. Fix it like you said you already did... Mark your thread [solved] once you do ... heh _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Wed Mar 30, 2011 1:46 pm Post subject: |
|
|
Sorry, I was copying the code from here rather than from my source. My code does have the bracket.
| Code: | package require http
if {[catch {set shoefile [::http::geturl "http://shoelace.org/picdump.txt" -timeout 5000]} error]} {
putlog "ERROR: Cannot create link list ( $error )"
set shoelace [list] ; unset shoefile
} else {
set shoelace [split [http::data $shoefile] "\n"]
::http::cleanup $shoefile ; unset shoefile
}
|
But rehash is still crashing the bot with the odd errors |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Mar 30, 2011 1:57 pm Post subject: |
|
|
You missed a brace somewhere else then or otherwise made a small mistake. To remedy the issue, try the complete code below. This should work. | Code: | # requires http package
package require http
# can we load our web sourced shoelace list?
if {[catch {set shoefile [::http::geturl "http://shoelace.org/picdump.txt" -timeout 5000]} error]} {
# no, report error, empty the list
putlog "ERROR: Cannot create link list ( $error )"
set shoelace [list]
} else {
# yes, success, build the list
set shoelace [split [http::data $shoefile] "\n"]
::http::cleanup $shoefile ; unset shoefile
}
bind pub - !shoelace pub_shoelace
proc pub_shoelace {nick mask hand channel text} {
global shoelace
if {[string length [string trim $text]]} {
#user supplied a search-term
set hits [lsearch -all $shoelace *[string trim $text]*]
#test if we found any..
if {[llength $hits] > 0} {
#We've got atleast one match, pick a random one if we've got multiple ones
set item [lindex $hits [rand [llength $hits]]] ; set status "SEARCH FOUND"
} else {
#No hits, pick a random line from the list
set item [rand [llength $shoelace]] ; set status "RANDOMIZED"
}
} else {
#No search-term supplied, pick a random item
set item [rand [llength $shoelace]] ; set status "RANDOMIZED"
}
putserv "PRIVMSG $channel :\[$status\] [lindex $shoelace $item]"
} |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Wed Mar 30, 2011 2:08 pm Post subject: |
|
|
Used your code exactly.
Launches fine
| Code: | [11:05:49] Writing channel file...
[11:05:49] Userfile loaded, unpacking...
[11:05:49] === oldskewl: 3 channels, 349 users.
Launched into the background (pid: 94069)
|
Rehash fails
| Code: | [oldskewl(dcc)] [11:06:29] Writing channel file...
[oldskewl(dcc)] [11:06:29] Listening at telnet port 42000 (all).
[oldskewl(dcc)] [11:06:29] Loading netbots.tcl v4.10...
[oldskewl(dcc)] [11:06:29] Tcl error in file 'oldskewl.conf':
[oldskewl(dcc)] [11:06:29] can't read "version": no such variable
[oldskewl(dcc)] while executing
[oldskewl(dcc)] "split $version"
[oldskewl(dcc)] invoked from within
[oldskewl(dcc)] "if {[string trimleft [lindex [split $version] 1] 0] < 1032200} {
[oldskewl(dcc)] die "*** netbots.tcl $nb_ver requires eggdrop 1.3.22 or later. Please upgrade your ..."
[oldskewl(dcc)] (file "netbots/netbots.tcl" line 13)
[oldskewl(dcc)] invoked from within
[oldskewl(dcc)] "source netbots/netbots.tcl"
[oldskewl(dcc)] (file "oldskewl.conf" line 1374)
[oldskewl(dcc)] [11:06:29] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
*** Connection closed |
I simply do not get it. lol
But like I said, if I change the code to read the file locally, everything works fine. |
|
| Back to top |
|
 |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Wed Mar 30, 2011 2:09 pm Post subject: |
|
|
| On a side note, I have tried this on multiple eggdrops on different servers. Same result. The script itself runs fantastic. It only crashes when I need to rehash the eggdrop |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Mar 30, 2011 2:59 pm Post subject: |
|
|
| syllable3 wrote: |
Rehash fails
| Code: | [oldskewl(dcc)] [11:06:29] Writing channel file...
[oldskewl(dcc)] [11:06:29] Listening at telnet port 42000 (all).
[oldskewl(dcc)] [11:06:29] Loading netbots.tcl v4.10...
[oldskewl(dcc)] [11:06:29] Tcl error in file 'oldskewl.conf':
[oldskewl(dcc)] [11:06:29] can't read "version": no such variable
[oldskewl(dcc)] while executing
[oldskewl(dcc)] "split $version"
[oldskewl(dcc)] invoked from within
[oldskewl(dcc)] "if {[string trimleft [lindex [split $version] 1] 0] < 1032200} {
[oldskewl(dcc)] die "*** netbots.tcl $nb_ver requires eggdrop 1.3.22 or later. Please upgrade your ..."
[oldskewl(dcc)] (file "netbots/netbots.tcl" line 13)
[oldskewl(dcc)] invoked from within
[oldskewl(dcc)] "source netbots/netbots.tcl"
[oldskewl(dcc)] (file "oldskewl.conf" line 1374)
[oldskewl(dcc)] [11:06:29] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
*** Connection closed |
I simply do not get it. lol
But like I said, if I change the code to read the file locally, everything works fine. |
It isn't this script causing your issue. It's "netbots" causing your issue here. For some reason or another. You may need to contact "slennox" personally on this one. The owner of these very forums. "netbots" is his baby..
note: You can likely #comment or remove all those $version checks as your likely not using such an ancient eggdrop.  _________________ speechles' eggdrop tcl archive
Last edited by speechles on Wed Mar 30, 2011 3:08 pm; edited 1 time in total |
|
| Back to top |
|
 |
streamish Voice
Joined: 03 Dec 2010 Posts: 21
|
Posted: Wed Mar 30, 2011 3:02 pm Post subject: |
|
|
| Alright, thanks for all your help |
|
| Back to top |
|
 |
|