<?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/12555" />

	<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>2006-10-22T14:36:56-04:00</updated>

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

		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-10-22T14:36:56-04:00</updated>

		<published>2006-10-22T14:36:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67334#p67334</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67334#p67334"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67334#p67334"><![CDATA[
It's just not recognizing it because of the upper/lower case, so you can either use lowercase, it use the [string toupper] command seperately to uppercase the 'ET' part of the filename, eg:<br><br>set cfgtmp [split $line /];set cfgtmp [lindex $cfgtmp 3];set cfgtmp [string toupper $cfgtmp]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sun Oct 22, 2006 2:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zielik]]></name></author>
		<updated>2006-10-22T13:25:31-04:00</updated>

		<published>2006-10-22T13:25:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67333#p67333</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67333#p67333"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67333#p67333"><![CDATA[
Hmm after a few days of testing I've found another problem :/.<br>My scritpt looks like this right now:<div class="codebox"><p>Code: </p><pre><code>#USAGE:  !cfg &lt;cfgname&gt;  where &lt;cfgname&gt; is one of ET Q3 Q4, etc.set mycfgfile "/home/zielik/shared/filesrv/xdcc/xdcc.pack"# set this to the valid cfg names to make checking user's input easierset validcfgnames "ET Q3 Q4 CS CSS WSW"bind pub - !cfg cfgprocproc cfgproc {nick uhost hand chan text} {      global mycfgfile validcfgnames      set text [string toupper $text]      set text [split $text]      if {[lsearch -exact $validcfgnames $text] == -1} {              puthelp "notice $nick :Invalid config filename. Valid names are $validcfgnames"              return      }      if {[file exists $mycfgfile]} {              set input [open $mycfgfile r]              set cfgdata "[split [read $input] \n]"              catch {close $mycfgfile}              foreach line $cfgdata {                   set cfgtmp [split $line /];set cfgtmp [string toupper [lindex $cfgtmp 3]]                   if {$cfgtmp == $text} {                        puthelp "PRIVMSG $nick :CFG Match $line"                   } else {puthelp "notice $nick :no cfg file found!"}              }       }}</code></pre></div>And my xdcc.pack:<div class="codebox"><p>Code: </p><pre><code>1 /home/zielik/filesys/cfg/et/lock.rar cfg_lock.ET 161042 /home/zielik/filesys/cfg/et/cfg.d4rkman30.X.04.rar cfg_d4rkman.ET 153653 /home/zielik/filesys/cfg/et/Sno0pCFG.rar cfg_sno0p.ET 104654 /home/zielik/filesys/cfg/et/nonix.rar cfg_nonix.Q4 5758</code></pre></div>But now when I put: !cfg ET it gives me : no cfg found.<br>I've tried to comment some lines and I've found out that there's a problem in this line:<div class="codebox"><p>Code: </p><pre><code>set cfgtmp [split $line /];set cfgtmp [string toupper [lindex $cfgtmp 3]]</code></pre></div>Please help again . <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":?" title="Confused"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6621">zielik</a> — Sun Oct 22, 2006 1:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-10-21T09:51:54-04:00</updated>

		<published>2006-10-21T09:51:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67312#p67312</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67312#p67312"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67312#p67312"><![CDATA[
Use [split $line /]  and the lindex number 4 to get just the filename, set that into a var and then use that var to show just the filename. <br><br>eg:<div class="codebox"><p>Code: </p><pre><code>foreach line $cfgdata {                   set cfgtmp [split $line /];set cfgtmp [string toupper [lindex $cfgtmp 3]]                    set cfgnametmp [split $line /];set cfgnametmp [lindex $cfgnametmp 4]]</code></pre></div>then puthelp $cfgnametmp instead of $line.<br><br>If you want a linecount then before the foreach put 'set lineno 0'  and inside the foreach after the "if" test to see if the filename matches, put 'incr lineno' and then in the puthelp output, use puthelp "PRIVMSG $nick :$lineno $cfgnametmp"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sat Oct 21, 2006 9:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zielik]]></name></author>
		<updated>2006-10-21T05:35:27-04:00</updated>

		<published>2006-10-21T05:35:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67303#p67303</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67303#p67303"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67303#p67303"><![CDATA[
Thank you it works well <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">.<br>But how to make the bot only send to me:<br><br>#nr desc<br><br>not the whole line ?<br><br>f/e:<br>#1 cfg_locka.ET<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6621">zielik</a> — Sat Oct 21, 2006 5:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-10-21T04:26:42-04:00</updated>

		<published>2006-10-21T04:26:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67293#p67293</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67293#p67293"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67293#p67293"><![CDATA[
Change this:<div class="codebox"><p>Code: </p><pre><code>set text [split [string toupper $text]] and foreach line $cfgdata {                   if {[lindex [split $line /] 3] == "$text"} {                        puthelp "PRIVMSG $nick :CFG Match $line"                   }              } </code></pre></div>to:<div class="codebox"><p>Code: </p><pre><code>set text [string toupper $text]set text [split $text]andforeach line $cfgdata {                   set cfgtmp [split $line /];set cfgtmp [string toupper [lindex $cfgtmp 3]]                   if {$cgftmp == "$text"} {                        puthelp "PRIVMSG $nick :CFG Match $line"                   }              } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sat Oct 21, 2006 4:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zielik]]></name></author>
		<updated>2006-10-20T15:55:17-04:00</updated>

		<published>2006-10-20T15:55:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67285#p67285</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67285#p67285"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67285#p67285"><![CDATA[
Hmmm it doesn't seems to work ok.<br>When i put !cfg on chan it gives me that its invalid - thats ok.<br>But when i put !cfg ET it gives nothing.<br>My file.db looks like this:<br><br>1 ~/filesys/cfg/et/lock.rar cfg_locka.ET 16104<br>2 ~/filesys/cfg/et/141.willstar.rar cfg_willstart.ET 4847<br>3 ~/filesys/cfg/et/cfg.d4rkman30.X.04.rar cfg_d4rkman.ET 15365<br>4 ~/filesys/cfg/et/Cahr_18-12-04.rar cfg_cahr.ET 16479<br>5 ~/filesys/cfg/et/config-16-Lun4t1C.rar cfg_lun4tic.ET 10025<br><br>Maybe it doesn't read the .ET on the endof the desc.<br>Rosc2112 please try again :/.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6621">zielik</a> — Fri Oct 20, 2006 3:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-10-20T15:12:22-04:00</updated>

		<published>2006-10-20T15:12:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67284#p67284</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67284#p67284"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67284#p67284"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>################################################################################################## USAGE:  !cfg &lt;cfgname&gt;  where &lt;cfgname&gt; is one of ET Q3 Q4, etc.set mycfgfile "/path/to/my/file.db"# set this to the valid cfg names to make checking user's input easierset validcfgnames "ET Q3 Q4"bind pub - !cfg cfgprocproc cfgproc {nick uhost hand chan text} {      global mycfgfile validcfgnames      set text [split [string toupper $text]]      if {[lsearch -exact $validcfgnames $text] == -1} {              puthelp "PRIVMSG $nick :Invalid config filename. Valid names are $validcfgnames"              return      }      if {[file exists $mycfgfile]} {              set input [open $mycfgfile r]              set cfgdata "[split [read $input] \n]"              catch {close $mycfgfile}              foreach line $cfgdata {                   if {[lindex [split $line /] 3] == "$text"} {                        puthelp "PRIVMSG $nick :CFG Match $line"                   }              }      } else {               puthelp "PRIVMSG $nick :no cfg file found!"               return      }}</code></pre></div>Not sure if the <br><br>if {[lindex [split $line /] 3] == "$text"}  <br><br>will work, it should =)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Oct 20, 2006 3:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zielik]]></name></author>
		<updated>2006-10-20T13:57:39-04:00</updated>

		<published>2006-10-20T13:57:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67283#p67283</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67283#p67283"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67283#p67283"><![CDATA[
Yea, but I don't understand them too muchan and I need somebody who would write or explain how to read and split text from a file <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad">.<br>Please help.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6621">zielik</a> — Fri Oct 20, 2006 1:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-10-19T12:04:19-04:00</updated>

		<published>2006-10-19T12:04:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67264#p67264</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67264#p67264"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67264#p67264"><![CDATA[
Lots of examples of doing that around the forum..Try searching.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Thu Oct 19, 2006 12:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zielik]]></name></author>
		<updated>2006-10-19T10:34:15-04:00</updated>

		<published>2006-10-19T10:34:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=67261#p67261</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=67261#p67261"/>
		<title type="html"><![CDATA[Reading file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=67261#p67261"><![CDATA[
I have a file called file.db, it contains:<br><br>1 ~/filesys/cfg/et/lock.rar cfg_locka.ET 16104<br>2 ~/filesys/cfg/et/snoop.rar cfg_snoopa.Q4 18028<br><br>--EOF--<br><br>The first column is serial number, next path to the file, third description and fourth the size.<br><br>I need a script which would read this file and privmsg it to the nick that requested it.<br>If somebody msg my channel with !cfg.et i want him to get the list of files with .ET on the end of the description. Similar with !cfg.q4 - Q4 and !cfg.q3 Q3 and others.<br><br>Please somebody, help me.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6621">zielik</a> — Thu Oct 19, 2006 10:34 am</p><hr />
]]></content>
	</entry>
	</feed>
