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

	<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>2009-03-09T17:05:31-04:00</updated>

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

		<entry>
		<author><name><![CDATA[username]]></name></author>
		<updated>2009-03-09T17:05:31-04:00</updated>

		<published>2009-03-09T17:05:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87792#p87792</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87792#p87792"/>
		<title type="html"><![CDATA[How to make random pattern selection in given text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87792#p87792"><![CDATA[
Maybe he need something like that: <div class="codebox"><p>Code: </p><pre><code>set file [open myfile.txt r]set data [read $file]close $fileset lines [split $data \n]set randline [lindex $lines [rand [llength $lines]]]</code></pre></div>Or that: <div class="codebox"><p>Code: </p><pre><code>#---------------------------------------------------------------------# randlist# TCL script for IRC-bot eggdrop.# TCL provides specific ordering (ascii, dictionary, integer etc...)# of lists through lsort. The proc "randlist" randomizes a list.# On input a list, returns a randomized list.# v0: 02-Feb-2002#---------------------------------------------------------------------#---------------------------------------------------------------------# For testing purposes from the partyline.#---------------------------------------------------------------------bind dcc - randlist makerandlistproc makerandlist { handle idx arg } {   set list "1 2 3 4 5 6 7 8 9 10"   putlog [randlist $list]}#---------------------------------------------------------------------# Procedure randlist#---------------------------------------------------------------------proc randlist { list } {   # determine length of list   set listlength [llength $list]   # iterate on list, decrease length per iteration    for { set i $listlength } { $i &gt; 1 } { incr i -1 } {      # choose random index       set randindex [rand $i]      # pick the random item      set randitem [lindex $list $randindex]      # cut the random item from the list      set list [lreplace $list $randindex $randindex]      # paste the random item at the end of the list      set list [lappend list $randitem]   }   return $list}</code></pre></div> (c) <a href="http://members.fortunecity.com/eggheadtcl/randlist.tcl.txt" class="postlink">http://members.fortunecity.com/eggheadt ... st.tcl.txt</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6813">username</a> — Mon Mar 09, 2009 5:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-03-09T16:56:00-04:00</updated>

		<published>2009-03-09T16:56:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87791#p87791</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87791#p87791"/>
		<title type="html"><![CDATA[How to make random pattern selection in given text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87791#p87791"><![CDATA[
The most likely reason you have no response until now is nobody understands your question. In mitigation, I accept that English is most likely your second language. Try to explain what you want with an example.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Mon Mar 09, 2009 4:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pranjal_ccna961]]></name></author>
		<updated>2009-02-18T04:49:40-04:00</updated>

		<published>2009-02-18T04:49:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87431#p87431</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87431#p87431"/>
		<title type="html"><![CDATA[How to make random pattern selection in given text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87431#p87431"><![CDATA[
How to make random pattern selection in given text file<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10504">pranjal_ccna961</a> — Wed Feb 18, 2009 4:49 am</p><hr />
]]></content>
	</entry>
	</feed>
