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

	<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-06-15T06:31:01-04:00</updated>

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

		<entry>
		<author><name><![CDATA[zleppy]]></name></author>
		<updated>2004-06-15T06:31:01-04:00</updated>

		<published>2004-06-15T06:31:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37396#p37396</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37396#p37396"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37396#p37396"><![CDATA[
ok..thanks...sorry, dont mean to be rude when saying that i dont "bother", but earlier when i have searched, i have found like 1500 posts, and not found anything helpfull....<br>but thanks for answering =)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4821">zleppy</a> — Tue Jun 15, 2004 6:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-06-14T22:36:30-04:00</updated>

		<published>2004-06-14T22:36:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37390#p37390</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37390#p37390"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37390#p37390"><![CDATA[
<blockquote class="uncited"><div>sorry for taking it up again then..just so much work searching the old posts... </div></blockquote>hmm don't wana be a pain but if u don't bother reading old posts why should we bohter answering ??<br><blockquote class="uncited"><div>would 'set answer "mytxt"' work?</div></blockquote>if up put it in the proc yes if not u need to use global to import it !!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Mon Jun 14, 2004 10:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zleppy]]></name></author>
		<updated>2004-06-09T12:23:03-04:00</updated>

		<published>2004-06-09T12:23:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37133#p37133</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37133#p37133"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37133#p37133"><![CDATA[
sorry for taking it up again then..just so much work searching the old posts...<br>i got it fixed now...now only thing is to set the a globa variable with "the answer", so i can check it laters...<br>would 'set answer "mytxt"' work?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4821">zleppy</a> — Wed Jun 09, 2004 12:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2004-06-09T00:10:39-04:00</updated>

		<published>2004-06-09T00:10:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37120#p37120</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37120#p37120"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37120#p37120"><![CDATA[
and had been discussed before. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_mrgreen.gif" width="15" height="15" alt=":mrgreen:" title="Mr. Green"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Jun 09, 2004 12:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[greenbear]]></name></author>
		<updated>2004-06-08T22:48:54-04:00</updated>

		<published>2004-06-08T22:48:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37119#p37119</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37119#p37119"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37119#p37119"><![CDATA[
this is also covered in the faq section on this forum<br><br><a href="http://forum.egghelp.org/viewtopic.php?t=6885" class="postlink">http://forum.egghelp.org/viewtopic.php?t=6885</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=24">greenbear</a> — Tue Jun 08, 2004 10:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-06-08T22:27:24-04:00</updated>

		<published>2004-06-08T22:27:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37118#p37118</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37118#p37118"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37118#p37118"><![CDATA[
to get number of lines try this<br><div class="codebox"><p>Code: </p><pre><code>proc length {file} {  set rf [open $file r]  set length [llength [split [read $rf] \n]]  close $rf  return $length}</code></pre></div>like this you can use it in rand mutch more easyer ..<br><br>then do<br><div class="codebox"><p>Code: </p><pre><code>proc getline {file} {  set rf [open $file r]  foreach x [split [read $rf] \n] {    if {[info exists i]} {      incr i    } else {      set i 0    }    if {[string equal $i [rand [length $file]]]} {      set getline [join [lrange $x 0 end]]      if {[string equal {} [lindex $x 0]]} {        getline $file        break      } else {        break        return $getline      }    }  }  close $rf}</code></pre></div>not tested it tho could be an problem with the if {} string .. second one.. when u restart the proc ..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Tue Jun 08, 2004 10:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[egghead]]></name></author>
		<updated>2004-06-08T19:46:07-04:00</updated>

		<published>2004-06-08T19:46:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37116#p37116</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37116#p37116"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37116#p37116"><![CDATA[
Another way is to determine the file size, set a pointer to a random value between 0 and that file size, open the file, read the line at the random pointer and close the file.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=282">egghead</a> — Tue Jun 08, 2004 7:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[KrzychuG]]></name></author>
		<updated>2004-06-08T16:42:21-04:00</updated>

		<published>2004-06-08T16:42:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37113#p37113</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37113#p37113"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37113#p37113"><![CDATA[
Should work:<br><div class="codebox"><p>Code: </p><pre><code>proc show:random { file } {  set fname [open $file r]  set num 0  while {![eof $fname]} {    incr num    set line($num) [gets $fname]  }  putloglev o * "All lines in $file: $num"  if {$num &gt; 0} then {    putloglev o * "Random line: $line([rand $num])  }} ;# show:random</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3672">KrzychuG</a> — Tue Jun 08, 2004 4:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zleppy]]></name></author>
		<updated>2004-06-08T16:09:28-04:00</updated>

		<published>2004-06-08T16:09:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37112#p37112</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37112#p37112"/>
		<title type="html"><![CDATA[random line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37112#p37112"><![CDATA[
Hey, i'm trying to make my own triviascript (only found buggy ones that would crash my bot), and i want the script to count the lines in a file, and then choose a random line...anyone know how i could do this?<br><br>-zleppy-<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4821">zleppy</a> — Tue Jun 08, 2004 4:09 pm</p><hr />
]]></content>
	</entry>
	</feed>
