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.

some type of quote script but its not

Help for those learning Tcl or writing their own scripts.
Post Reply
F
FightingNavyman
Voice
Posts: 35
Joined: Tue Jan 18, 2011 12:39 pm

some type of quote script but its not

Post by FightingNavyman »

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:
«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
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Code: Select all

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
.
F
FightingNavyman
Voice
Posts: 35
Joined: Tue Jan 18, 2011 12:39 pm

Post by FightingNavyman »

I dont know if i copy/pasted your code right or wrong but when I .rehashed the bot it said this after:
«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)
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

lol...
Well, that was just supposed to replace the same chunk in your script, and still needed the rest of your proc, like...

Code: Select all

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
.
F
FightingNavyman
Voice
Posts: 35
Joined: Tue Jan 18, 2011 12:39 pm

Post by FightingNavyman »

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: Select all

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: Select all

} else { 
            foreach quote $quotes { 
               set line [expr {$line+1}] 
            } 

            putserv "privmsg $chan :$line" 

         } 
      } 
   } 
}
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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:)
Last edited by SpiKe^^ on Mon Apr 01, 2013 4:50 pm, edited 1 time in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
F
FightingNavyman
Voice
Posts: 35
Joined: Tue Jan 18, 2011 12:39 pm

Post by FightingNavyman »

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
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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: Select all

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
.
Post Reply