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

	<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-02-21T09:26:24-04:00</updated>

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

		<entry>
		<author><name><![CDATA[NewzUK]]></name></author>
		<updated>2004-02-21T09:26:24-04:00</updated>

		<published>2004-02-21T09:26:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33793#p33793</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33793#p33793"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33793#p33793"><![CDATA[
thanks - I think we're off track here...<br><br>I should have explained more - there are lots of lines with /04 in it but I only want it to set the first line of /04 as the variable and send it to the channel...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2210">NewzUK</a> — Sat Feb 21, 2004 9:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-02-21T09:17:54-04:00</updated>

		<published>2004-02-21T09:17:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33792#p33792</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33792#p33792"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33792#p33792"><![CDATA[
well hmm <br><div class="codebox"><p>Code: </p><pre><code># usage !test /04 or something else of course only checks arg 0, # if you want it to check more then you have to combine stuff or if u# wana use spaces well then u got to use lrange ..bind n !test test:pubproc test:pub {nick uhost hand chan arg} {  if {[linematch "[lindex $arg 0]"] &amp;&amp; ![string match {} [lindex $arg 0]]} {    putserv "PRIVMSG $chan :Found [lindex $arg 0]."   } else {    putserv "PRIVMSG $chan :Nothing Found."  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sat Feb 21, 2004 9:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[NewzUK]]></name></author>
		<updated>2004-02-21T08:24:05-04:00</updated>

		<published>2004-02-21T08:24:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33791#p33791</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33791#p33791"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33791#p33791"><![CDATA[
thanks - I think I get it - how do I test it by using a pub command? Sorry for all the questions...!  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2210">NewzUK</a> — Sat Feb 21, 2004 8:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-02-21T08:10:49-04:00</updated>

		<published>2004-02-21T08:10:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33790#p33790</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33790#p33790"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33790#p33790"><![CDATA[
hmm i edited the result cause there where some errors in it .. just wokeup sorry hehe<br><br>well u can use it now like this [linematch "/04"]<br><br>and if it finds something it will return 1 if it doesn't it will return 0<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sat Feb 21, 2004 8:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[NewzUK]]></name></author>
		<updated>2004-02-21T08:09:09-04:00</updated>

		<published>2004-02-21T08:09:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33789#p33789</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33789#p33789"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33789#p33789"><![CDATA[
thanks but eventually this will be on a timer and not a bindpub so I just need it to read the first line with /04 in it and that's it...thanks!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2210">NewzUK</a> — Sat Feb 21, 2004 8:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-02-21T08:10:01-04:00</updated>

		<published>2004-02-21T08:06:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33788#p33788</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33788#p33788"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33788#p33788"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc linematch {var} {  set rfile [open "file" "r"]  while {![$rfile]} {    gets $rfile line    if {[string match -nocase "*$var*" $line]} {      # your script here....      close $rfile      return 1 ;# This will verrify that the while matched a string    }  }  close $rfile  return 0}</code></pre></div>hehe sorry misread first time ..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sat Feb 21, 2004 8:06 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-02-21T08:02:02-04:00</updated>

		<published>2004-02-21T08:02:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33787#p33787</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33787#p33787"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33787#p33787"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># like this u can use it to read any line# usage: readfile &lt;line number&gt;proc readfile {number} {  set count "0"  set rfile [open "file" "r"]  while {![$rfile]} {    gets $rfile line    set count [expr $count + 1]    if {"$count" == "$number"} {      putlog "This is line $number of ur script: $line" ;#change this line to what u want to do with line      close $rfile       return 1 ;#Or change it to return $line if u want the proc to return the line instead then remove the return 0 and putlog line    }  }  close $rfile  return 0}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sat Feb 21, 2004 8:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[NewzUK]]></name></author>
		<updated>2004-02-21T07:52:48-04:00</updated>

		<published>2004-02-21T07:52:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33786#p33786</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33786#p33786"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33786#p33786"><![CDATA[
thanks - it works with this but:<br><br>bind pub - .cbsnews pub:readmkw<br>proc pub:readmkw { nick uhost handle channel arg } {<br>set mkwf [open /home/citinews/Bots/Undernet/news/mkw.txt r]<br>set data [read $mkwf]<br>foreach line [split $data \n] {<br> if {[string match */04* $line]} {<br>putserv "PRIVMSG #Newsroom2 :4,4 1,15 [gettime -18]ET $line "<br>}<br>}<br>}<br><br>it reads the whole file - can I get it to just read the first /04 line then stop?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2210">NewzUK</a> — Sat Feb 21, 2004 7:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-02-21T07:39:12-04:00</updated>

		<published>2004-02-21T07:39:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33784#p33784</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33784#p33784"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33784#p33784"><![CDATA[
use <br><div class="codebox"><p>Code: </p><pre><code>set data [read $mkwf] ;#reads entire file at once and sets it to the variable data</code></pre></div>i think gets only reads one line<br><br>if u use gets use it in a while<br><div class="codebox"><p>Code: </p><pre><code>while {![eof $mkwf]} {  gets $mkwf line  .... then line is ur varable reads line by line}</code></pre></div>if u do read $mkwf then it will read the entire file<br><br>then u split it line by line and output it line by line using foreach<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sat Feb 21, 2004 7:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[NewzUK]]></name></author>
		<updated>2004-02-21T07:13:12-04:00</updated>

		<published>2004-02-21T07:13:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33783#p33783</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33783#p33783"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33783#p33783"><![CDATA[
thanks - still no luck - am I doing something else wrong?<br><br>bind pub - .cbsnews pub:readmkw<br>proc pub:readmkw { nick uhost handle channel arg } {<br>set mkwf [open /home/citinews/Bots/Undernet/news/mkw.txt r]<br>set data [gets $mkwf]<br>foreach line [split $data \n] {<br> if {[string match "/04*" $line]} {<br>putserv "PRIVMSG #Newsroom2 :$line"<br>}<br>}<br>}<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2210">NewzUK</a> — Sat Feb 21, 2004 7:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[GodOfSuicide]]></name></author>
		<updated>2004-02-21T06:53:53-04:00</updated>

		<published>2004-02-21T06:53:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33782#p33782</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33782#p33782"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33782#p33782"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set data [gets $mkwf]foreach line [split $data \n] { if {[string match "/04*" $line]} {  &lt;do something&gt; break}</code></pre></div>btw, you might what to close your file too<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1433">GodOfSuicide</a> — Sat Feb 21, 2004 6:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[NewzUK]]></name></author>
		<updated>2004-02-21T06:46:35-04:00</updated>

		<published>2004-02-21T06:46:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33781#p33781</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33781#p33781"/>
		<title type="html"><![CDATA[readfile problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33781#p33781"><![CDATA[
Hi - I'm working on a script to read a text file but don't seem to be able to get past this...I'm not getting any errors:<br><br>bind pub - .cbsnews pub:readmkw<br>proc pub:readmkw { nick uhost handle channel arg } {<br>set mkwf [open /home/citinews/Bots/Undernet/news/mkw.txt r]<br>set mkw [lsearch -glob $mkwf "/04"]<br>if {$mkw != -1} {<br>  putserv "PRIVMSG #Newsroom2 :$mkw"<br>} else {<br>  return<br>}<br>}<br><br>The line of the file I want is the first one with /04 in it...<br>Thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2210">NewzUK</a> — Sat Feb 21, 2004 6:46 am</p><hr />
]]></content>
	</entry>
	</feed>
