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

	<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>2003-12-10T08:23:29-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Jag]]></name></author>
		<updated>2003-12-10T08:23:29-04:00</updated>

		<published>2003-12-10T08:23:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31268#p31268</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31268#p31268"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31268#p31268"><![CDATA[
It works!<br>Thanks man <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3871">Jag</a> — Wed Dec 10, 2003 8:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2003-12-10T06:40:59-04:00</updated>

		<published>2003-12-10T06:40:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31266#p31266</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31266#p31266"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31266#p31266"><![CDATA[
I'm not quite sure - as I'm quite new - but I would try it as:<br><div class="codebox"><p>Code: </p><pre><code>proc slowmsg {file {pos 0}} {  set f [open $file]  seek $f $pos  if {[gets $f line]&gt;-1} {    putserv "privmsg #Jag $line"     timer 3 [list slowmsg $file [tell $f]]    } else {     slowmsg $file  }  close $f} </code></pre></div>Probally closing the file should be called before restarting the proc.<br><br>u could also start the timer directly - skipping one read.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">  like:<div class="codebox"><p>Code: </p><pre><code>} else {     timer 3 [list slowmsg $file]}</code></pre></div>(not sure about the list)<p>Statistics: Posted by Guest — Wed Dec 10, 2003 6:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Jag]]></name></author>
		<updated>2003-12-10T06:09:09-04:00</updated>

		<published>2003-12-10T06:09:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31265#p31265</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31265#p31265"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31265#p31265"><![CDATA[
Thanks, it helps.<br>But, what about the:<blockquote class="uncited"><div>But, how can i do that when it get to the end of the file, it will go back to the start (go again from the first line to the end of the file) ?</div></blockquote>?<br> 10x <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3871">Jag</a> — Wed Dec 10, 2003 6:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcane]]></name></author>
		<updated>2003-12-09T15:31:07-04:00</updated>

		<published>2003-12-09T15:31:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31245#p31245</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31245#p31245"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31245#p31245"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set mytimer [timer 3 bla...]</code></pre></div>and<div class="codebox"><p>Code: </p><pre><code>catch { killtimer $mytimer }</code></pre></div>in front of your proc<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2617">arcane</a> — Tue Dec 09, 2003 3:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Jag]]></name></author>
		<updated>2003-12-09T14:35:18-04:00</updated>

		<published>2003-12-09T14:35:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31241#p31241</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31241#p31241"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31241#p31241"><![CDATA[
Thanks, i tried this:<br><div class="codebox"><p>Code: </p><pre><code>proc slowmsg {file {pos 0}} {   set f [open $file]   seek $f $pos   if {[gets $f line]&gt;-1} {     putserv "privmsg #Jag $line"    timer 3 [list slowmsg $file [tell $f]]     } {   }   close $f }slowmsg "news.txt"</code></pre></div>And it's works fine.<br>But, how can i do that when it get to the end of the file, it will go back to the start (go again from the first line to the end of the file) ?<br>And when i do a lot of '.rehash' it starts a lot of timers because the:<blockquote class="uncited"><div>slowmsg "news.txt"</div></blockquote>How can i stop that?<br><br>Thanks again for the help user <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3871">Jag</a> — Tue Dec 09, 2003 2:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-11-11T18:03:39-04:00</updated>

		<published>2003-11-11T18:03:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29897#p29897</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29897#p29897"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29897#p29897"><![CDATA[
<blockquote class="uncited"><div>Thanks a lot, but.... how can i do that when it get to the end of the file, it will go back to the start? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"></div></blockquote>Start a new timer with 0 as the last parameter or call the proc from within itself (make sure your file is not empty if you do this <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz">) instead of doing that putlog.<blockquote class="uncited"><div>EDIT: can you build it in "bind time" please?<br>10x</div></blockquote>I _can_ but you don't provide enough info and I'm not always bored. Do you need it to work with multiple users/files? How are you planning to use this? Why did you change your mind about using 'timer'? Here's something to get you started:<div class="codebox"><p>Code: </p><pre><code>bind time - * time_demoproc time_demo {args} {if {![expr {([clock seconds]/60)%3}]} {# do stuff}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Tue Nov 11, 2003 6:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Jag]]></name></author>
		<updated>2003-11-11T10:42:18-04:00</updated>

		<published>2003-11-11T10:42:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29859#p29859</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29859#p29859"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29859#p29859"><![CDATA[
Thanks a lot, but.... how can i do that when it get to the end of the file, it will go back to the start? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>EDIT: can you build it in "bind time" please?<br>10x<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3871">Jag</a> — Tue Nov 11, 2003 10:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-11-10T17:52:50-04:00</updated>

		<published>2003-11-10T17:52:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29834#p29834</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29834#p29834"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29834#p29834"><![CDATA[
Where are you stuck and what happens when you reach the end of the file?<br><br>EDIT: I was bored...<br>Usage is pretty much explained by the variable names except for 'pos' which is the byte position when we last read from the file (not used when you start a new "slowmsg")<br><br>This proc doesn't care about nick changes, quitting etc., so if you need that, you've got some coding to do <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> It doesn't care if you call it multiple times with the same nick/file as arguments either ...which might become annoying if you .rehash alot and have a call to this proc that is executed every time <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><div class="codebox"><p>Code: </p><pre><code>proc slowmsg {nick file {pos 0}} {set f [open $file]seek $f $posif {[gets $f line]&gt;-1} {putserv "PRIVMSG $nick :$line"timer 3 [list slowmsg $nick $file [tell $f]]} {putserv "PRIVMSG $nick :What am I supposed to do now? (EOF)"}close $f}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Nov 10, 2003 5:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Jag]]></name></author>
		<updated>2003-11-10T12:13:25-04:00</updated>

		<published>2003-11-10T12:13:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29812#p29812</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29812#p29812"/>
		<title type="html"><![CDATA[Reading from a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29812#p29812"><![CDATA[
i need a script that read every 3 mins line from a file and send it to me in a privmsg.<br>something like this:<br>timer 3 "privmsg jag :line 1"<br>and after 3 mins it will do:<br>timer 3 "privmsg jag :line 2"<br>and after 3 mins it will do:<br>timer 3 "privmsg jag :line 3"<br>and after 3 mins it will do:<br>timer 3 "privmsg jag :line 4"<br>somebody can help me with that please?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3871">Jag</a> — Mon Nov 10, 2003 12:13 pm</p><hr />
]]></content>
	</entry>
	</feed>
