| View previous topic :: View next topic |
| Author |
Message |
FightingNavyman Voice
Joined: 18 Jan 2011 Posts: 35
|
Posted: Sun Mar 31, 2013 6:35 pm Post subject: some type of quote script but its not |
|
|
when I do !list to get to know how many url's i have inside boobs.txt I get this error on my bot via dcc chat:
| Quote: |
«05:15:12:pm» <chachin> .set errorInfo
«05:15:12:pm» <BoobsBot> [02:15:13] #chachin# set errorInfo
«05:15:12:pm» <BoobsBot> Currently: can not find channel named "boobs.txt"
«05:15:12:pm» <BoobsBot> Currently: while executing
«05:15:12:pm» <BoobsBot> Currently: "eof "boobs.txt""
«05:15:12:pm» <BoobsBot> Currently: (procedure "listboobs" line 12)
«05:15:12:pm» <BoobsBot> Currently: invoked from within
«05:15:12:pm» <BoobsBot> Currently: "listboobs $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
|
was wondering what I would have to do to fix this
http://paste.tclhelp.net/?id=d2p |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Mar 31, 2013 9:30 pm Post subject: |
|
|
| Code: | proc listboobs {nick uhost hand chan arg} {
if {[string equal -nocase $chan "#chick3n"]} {
if {[file exists "boobs.txt"]} {
set file [open "boobs.txt" r]
set line 0 ; set quotes [list]
set line_counter 0
while {![eof $file]} {
set quote [gets $file]
if {$quote != ""} {
lappend quotes $quote
incr line_counter
}
} |
That should fix the beginning of that proc.
Not really sure what you are trying to do with the rest of the proc, but it's probably broke too. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
FightingNavyman Voice
Joined: 18 Jan 2011 Posts: 35
|
Posted: Sun Mar 31, 2013 10:02 pm Post subject: |
|
|
I dont know if i copy/pasted your code right or wrong but when I .rehashed the bot it said this after:
| Quote: |
«08:58:06:pm» <BoobsBot> [05:58:07] Tcl error in file 'BoobsBot/BoobsBot.conf':
«08:58:06:pm» <BoobsBot> [05:58:07] missing close-brace
«08:58:06:pm» <BoobsBot> while executing
«08:58:06:pm» <BoobsBot> "proc listboobs {nick uhost hand chan arg} {
«08:58:06:pm» <BoobsBot> if {[string equal -nocase $chan "#chick3n"]} {
«08:58:06:pm» <BoobsBot> if {[file exists "boobs.txt"]} {
«08:58:06:pm» <BoobsBot> se..."
«08:58:06:pm» <BoobsBot> (file "scripts/boobies.tcl" line 47)
«08:58:06:pm» <BoobsBot> invoked from within
«08:58:06:pm» <BoobsBot> "source scripts/boobies.tcl"
«08:58:06:pm» <BoobsBot> (file "BoobsBot/BoobsBot.conf" line 302)
«08:58:06:pm» <BoobsBot> [05:58:07] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
|
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Mar 31, 2013 10:11 pm Post subject: |
|
|
lol...
Well, that was just supposed to replace the same chunk in your script, and still needed the rest of your proc, like...
| Code: | proc listboobs {nick uhost hand chan arg} {
if {[string equal -nocase $chan "#chick3n"]} {
if {[file exists "boobs.txt"]} {
set file [open "boobs.txt" r]
set line 0 ; set quotes [list]
set line_counter 0
while {![eof $file]} {
set quote [gets $file]
if {$quote != ""} {
lappend quotes $quote
incr line_counter
}
}
putserv "privmsg $chan :line count is: $line_counter"
close $file
if {$arg != ""} {
foreach quote $quotes {
set pattern [string tolower $arg]
set lowquote [string tolower $quote]
if {[string match $pattern $lowquote]} {
set line [expr {$line+1}]
}
putserv "privmsg $chan :$line"
}
} else {
foreach quote $quotes {
set line [expr {$line+1}]
}
putserv "privmsg $chan :$line"
}
}
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
FightingNavyman Voice
Joined: 18 Jan 2011 Posts: 35
|
Posted: Mon Apr 01, 2013 4:04 pm Post subject: |
|
|
Hey sorry if if I didnt answer right away when you posted the 2nd fix or whatever.. My stupid vps provider got a ddos last night and i couldnt get back the bot but now it's online and when I rehashed and all.. when i do !list it does this:
«03:01:26:pm» <@chachin> !list
«03:01:27:pm» <@BoobsBot> line count is: 1011
«03:01:28:pm» <@BoobsBot> 1011
So should I take:
| Code: | if {$arg != ""} {
foreach quote $quotes {
set pattern [string tolower $arg]
set lowquote [string tolower $quote]
if {[string match $pattern $lowquote]} {
set line [expr {$line+1}]
}
putserv "privmsg $chan :$line"
} | this or this off from the script?
| Code: |
} else {
foreach quote $quotes {
set line [expr {$line+1}]
}
putserv "privmsg $chan :$line"
}
}
}
}
|
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Apr 01, 2013 4:44 pm Post subject: |
|
|
Explain what you are expecting the bot to do when you type: !list
I only fixed the issues that were generating your error from above.
I did not change or fix what your process does or displays.
Looks to me that the file in question has 1011 lines in it, there is no way the bot can be expected to list out all 1011 lines to a channel:) _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Mon Apr 01, 2013 4:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
FightingNavyman Voice
Joined: 18 Jan 2011 Posts: 35
|
Posted: Mon Apr 01, 2013 4:50 pm Post subject: |
|
|
yeah I thank you for fixing it.. but which one of the 2 codes should I take off or should i just take both off to make it only say "line count is: 1011" or whatever because..
<@chachin> !lines
<+BoobsBot> line count is: 1011
<+BoobsBot> 1011 |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Apr 01, 2013 4:57 pm Post subject: |
|
|
There is no bind for '!lines' in your script, just for !list
But either way, to make that proc reply with just: to make it only say "line count is: 1011" or whatever...
| Code: |
proc listboobs {nick uhost hand chan arg} {
if {[string equal -nocase $chan "#chick3n"]} {
if {[file exists "boobs.txt"]} {
set file [open "boobs.txt" r]
set line 0 ; set quotes [list]
set line_counter 0
while {![eof $file]} {
set quote [gets $file]
if {$quote != ""} {
lappend quotes $quote
incr line_counter
}
}
}
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
|