<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/5217" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2004-07-03T17:59:02-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/5217</id>

		<entry>
		<author><name><![CDATA[devilsoulblack]]></name></author>
		<updated>2004-07-03T17:59:02-04:00</updated>

		<published>2004-07-03T17:59:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=38171#p38171</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=38171#p38171"/>
		<title type="html"><![CDATA[thnaks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=38171#p38171"><![CDATA[
nice<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4165">devilsoulblack</a> — Sat Jul 03, 2004 5:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-08-14T02:44:43-04:00</updated>

		<published>2003-08-14T02:44:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24885#p24885</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24885#p24885"/>
		<title type="html"><![CDATA[search script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24885#p24885"><![CDATA[
feel free to give pointers on the current script <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"> so i can make it shorter or/and more functional tnx<br><div class="codebox"><p>Code: </p><pre><code>bind PUB - @find find:pubproc find:pub {nick uhost hand chan arg} {global ftppass0 ftplog0 ftpport  if {[lindex $arg 0] == ""} {    putserv "NOTICE $nick :Usage: @find &lt;query*query*..&gt;"  } else {    set pre "0"    set MyIP ""     foreach a {a b c d e f g h i j k} {       catch {         set external [socket $a.root-servers.net 53]         set MyIP [lindex [fconfigure $external -sockname] 0]         close $external                   }       if { ![string equal $MyIP ""] } { break }     }    set index [open "|index.exe" "r+"]    index:dirs    set srch [lindex $arg 0]    set wfile [open "cnt.txt" "w"]    puts -nonewline $wfile 0    close $wfile    putquick "PRIVMSG $nick :\00314Searching for \0037$srch \00314plz be patient.."    set fs [open "search.txt" r]    while {![eof $fs]} {      gets $fs line      set sline [string tolower $line]      if {[string match *$srch* $sline] == 1} {        set rfile [open "cnt.txt" "r"]        set rcnt [read $rfile]        close $rfile        set count [expr $rcnt + 1]        set wfile [open "cnt.txt" "w"]        puts -nonewline $wfile $count        close $wfileset dline [file tail $line]        putserv "PRIVMSG $nick :\00314Search result $count:\0037 $dline"        set pre "1"      }    }    set rfile [open "cnt.txt" "r"]    set cnt [read $rfile]    close $rfile    putserv "PRIVMSG $nick :\00314Search complete found\0037 $cnt \00314results."     if {$pre == "1"} {      putserv "PRIVMSG $nick :\00314FTPinfo:\0037 ftp://$ftplog0:$ftppass0@$MyIP:$ftpport/"    }   return 0  }}proc index:dirs {} {    set rfile [open "app.txt" "r"]    set afile [open "search.txt" "w"]    foreach line [split [read $rfile] \n] {      puts $afile $line    }    close $rfile    close $afile    set rfile [open "mov.txt" "r"]    set afile [open "search.txt" "a"]    foreach line [split [read $rfile] \n] {      puts $afile $line     }    close $rfile    close $afile    set rfile [open "gme.txt" "r"]    set afile [open "search.txt" "a"]    foreach line [split [read $rfile] \n] {      puts $afile $line    }    close $rfile    close $afile    set rfile [open "mp3.txt" "r"]    set afile [open "search.txt" "a"]    foreach line [split [read $rfile] \n] {      puts $afile $line    }    close $rfile    close $afile       set rfile [open "bks.txt" "r"]    set afile [open "search.txt" "a"]    foreach line [split [read $rfile] \n] {      puts $afile $line    }    close $rfile    close $afile    putlog "\002The @find function is been used. All files are indexed\002"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Thu Aug 14, 2003 2:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-08-14T02:39:44-04:00</updated>

		<published>2003-08-14T02:39:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24884#p24884</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24884#p24884"/>
		<title type="html"><![CDATA[search script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24884#p24884"><![CDATA[
hmm cause i tryed set var "0" and then incr var  but that didn't work so from this point i only get it to work if i cache a var to a txt i mean var counter i know its a crappy way but ... it works i solved all the rest only replacing the spaces by s .. ima read up on what you sad and answer back then cause at this point it seems logic but not entirly clear on how i will do it i know you put me in the write direction and its almost in front of me but now i just need to understand it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"> so let me go true the code <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"> then ill answer the rest <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"> still learing to code tcl hehe me n00b eh <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Thu Aug 14, 2003 2:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-08-13T06:17:58-04:00</updated>

		<published>2003-08-13T06:17:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24833#p24833</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24833#p24833"/>
		<title type="html"><![CDATA[search script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24833#p24833"><![CDATA[
<blockquote class="uncited"><div>how can i make it search as well if i do this<br><br>@find test test1<br>in stead of @find test*test1<br>and also make it work if it's the other way arround<br>cause now it only finds the words if it's in the txt like this "test ... test1"<br>and if i would use @find test1 test it wouldn't give any results<br><br>oh also and how could i return an other msg if there is no search results</div></blockquote>To make '@find a b' become '@find a*b' is as simple as replacing the spaces with *'s.<br><br>Your code fetch the first word of the argument <em class="text-italics">string</em> using 'lindex' <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_surprised.gif" width="15" height="15" alt=":o" title="Surprised"> , so typing '@find a b' would result in searching for '*a*' and typing '@find {' would cause an error.<br><br>Use the counter value to determine which message to display after completion (x matches / no matches)<br><div class="codebox"><p>Code: </p><pre><code>bind pub - @find find:pubproc find:pub {n u h c a} {  set a *[string map {" " *} $a]*  putserv "PRIVMSG $n :Searching for $a"  set i 0  set f [open "search.txt"]  while {[gets $f b]&gt;-1} {    if {[string match -nocase $a $b]} {      incr i      putserv "PRIVMSG $n :$b"    }  }  close $f  if {$i} {    putserv "PRIVMSG $n :Search complete found $i result[expr {$i==1?"":"s"}]"  } {    putserv "PRIVMSG $n :No matches."  }}</code></pre></div>You could (should?) of course lappend the matching lines to a variable inside the while-loop and check the number of matches before you msg the user (to prevent abuse). Then you could also get rid of the counter variable and use [llength the_list] to get the number.<br><br>btw: in your code, what's the point of all that "cnt.txt" reading/writing?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Aug 13, 2003 6:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-08-10T02:00:58-04:00</updated>

		<published>2003-08-10T02:00:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24625#p24625</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24625#p24625"/>
		<title type="html"><![CDATA[search script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24625#p24625"><![CDATA[
how can i make it search as well if i do this<br><br>@find test test1<br>in stead of @find test*test1<br>and also make it work if it's the other way arround<br>cause now it only finds the words if it's in the txt like this "test ... test1"<br>and if i would use @find test1 test it wouldn't give any results<br><br>oh also and how could i return an other msg if there is no search results<br>ive tryed<br><div class="codebox"><p>Code: </p><pre><code>if {$cnt == 0} {  ...} else {  ...}return 0}</code></pre></div>full script <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><div class="codebox"><p>Code: </p><pre><code>bind PUB - @find find:pubproc find:pub {nick uhost hand chan arg} {  set srch [lindex $arg 0]  set wfile [open "cnt.txt" "w"]  puts -nonewline $wfile 0  close $wfile  putserv "PRIVMSG $nick :Searching for $srch"  set fs [open "search.txt" r]  while {![eof $fs]} {    gets $fs line    set sline [string tolower $line]    if {[string match *$srch* $sline] == 1} {      set rfile [open "cnt.txt" "r"]      set rcnt [read $rfile]      close $rfile      set count [expr $rcnt + 1]      set wfile [open "cnt.txt" "w"]      puts -nonewline $wfile $count      close $wfile      putserv "PRIVMSG $nick :$line"    }  }  set rfile [open "cnt.txt" "r"]  set cnt [read $rfile]  close $rfile  putserv "PRIVMSG $nick :Search complete found $cnt results"   return 0}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sun Aug 10, 2003 2:00 am</p><hr />
]]></content>
	</entry>
	</feed>
