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

	<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-09-15T19:09:15-04:00</updated>

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

		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2003-09-15T19:09:15-04:00</updated>

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

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27114#p27114"><![CDATA[
thanks m8 Works a treat  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Mon Sep 15, 2003 7:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2003-09-15T18:37:54-04:00</updated>

		<published>2003-09-15T18:37:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27112#p27112</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27112#p27112"/>
		<title type="html"><![CDATA[Reading from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27112#p27112"><![CDATA[
<blockquote class="uncited"><div>ok here is the code i botched together. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"> <br><div class="codebox"><p>Code: </p><pre><code>proc qot_all {nick uhost hand chan rest} {global qot    if {![file exists $qot(file)]} {putchan $chan "Error: No Servers found or database does not exist"return    }    set qot_fd [open $qot(file) r]    for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt 1 } {gets $qot_fd qot_list($qot_cnt)    }    close $qot_fd    set qot_cnt [expr $qot_cnt - 2]    unset qot_list([expr $qot_cnt + 1])    if {![info exists qot_list([expr $rest - 1])]} {putchan $chan "Error: that server does not exist"return    } else {    foreach line [split $qot_list \n] {     putchan $chan "[expr $qot_cnt + 1] Servers in total"    putchan "PRIVMSG $chan :$line"     return    }  }}</code></pre></div>Thanks strikelight  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"></div></blockquote>Ok, so instead of a list, you have created an array...<br><br>I believe you'll want to change:<div class="codebox"><p>Code: </p><pre><code>    } else {    foreach line [split $qot_list \n] {       putchan $chan "[expr $qot_cnt + 1] Servers in total"      putchan "PRIVMSG $chan :$line"       return    }</code></pre></div>To the following:<div class="codebox"><p>Code: </p><pre><code>   } else {    putchan $chan "[expr $qot_cnt + 1] Servers in total"    foreach id [array names qot_list] {       putchan $chan "$qot_list($id)"     }   }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Mon Sep 15, 2003 6:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2003-09-15T12:32:37-04:00</updated>

		<published>2003-09-15T12:32:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27105#p27105</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27105#p27105"/>
		<title type="html"><![CDATA[Reading from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27105#p27105"><![CDATA[
ok here is the code i botched together. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"> <br><div class="codebox"><p>Code: </p><pre><code>proc qot_all {nick uhost hand chan rest} {global qot    if {![file exists $qot(file)]} {putchan $chan "Error: No Servers found or database does not exist"return    }    set qot_fd [open $qot(file) r]    for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt 1 } {gets $qot_fd qot_list($qot_cnt)    }    close $qot_fd    set qot_cnt [expr $qot_cnt - 2]    unset qot_list([expr $qot_cnt + 1])    if {![info exists qot_list([expr $rest - 1])]} {putchan $chan "Error: that server does not exist"return    } else {    foreach line [split $qot_list \n] {     putchan $chan "[expr $qot_cnt + 1] Servers in total"    putchan "PRIVMSG $chan :$line"     return    }  }}</code></pre></div>Thanks strikelight  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Mon Sep 15, 2003 12:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2003-09-14T20:37:03-04:00</updated>

		<published>2003-09-14T20:37:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27087#p27087</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27087#p27087"/>
		<title type="html"><![CDATA[Reading from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27087#p27087"><![CDATA[
<blockquote class="uncited"><div>Thanks for your prompt reply m8 much appreciated  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"> <br><br>im sure im doing it right but i get this error now.<br><blockquote class="uncited"><div>[23:17] Tcl error [qot_all]: can't read "qot_list": variable is array</div></blockquote>any ideas?</div></blockquote>well, the error message means that TCL is sure you <strong class="text-strong">aren't</strong> doing it right...  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"> <br><br>I'm not sure how you are creating the variable <em class="text-italics">qot_list</em>, but somehow you are creating it as an array... You'll need to show that.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sun Sep 14, 2003 8:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2003-09-14T19:06:06-04:00</updated>

		<published>2003-09-14T19:06:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27086#p27086</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27086#p27086"/>
		<title type="html"><![CDATA[Reading from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27086#p27086"><![CDATA[
Thanks for your prompt reply m8 much appreciated  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"> <br><br>im sure im doing it right but i get this error now.<br><blockquote class="uncited"><div>[23:17] Tcl error [qot_all]: can't read "qot_list": variable is array</div></blockquote>any ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Sun Sep 14, 2003 7:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2003-09-14T17:58:08-04:00</updated>

		<published>2003-09-14T17:58:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27085#p27085</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27085#p27085"/>
		<title type="html"><![CDATA[Re: Reading from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27085#p27085"><![CDATA[
<blockquote class="uncited"><div>Hello again im having trouble reading from a flat file on my shell.<br><br>Well i can read it but i cant display its contents in channel.<br><br>It's based on a quote script by Koloth, v1.0. i altered it so people could add quake servers to it for people to play on. and remove them if they are down. it currently displays how many servers are added and it will pull a random server (Was a random quote) from the list with !server (which used to be !quote) so everything works fine. now instead of having a random server displayed on channel id like it to reel off the entire list. can someone give me an example of how display a document on channel. I have already opened the file, read the contents and closed it again.<br><br>Thanks in advance. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"> <br><br>^DooM^</div></blockquote>if you have read the contents into a variable, then it is a simple matter of regular variable manipulation... <br><br>For example..<div class="codebox"><p>Code: </p><pre><code>foreach line [split $your_data_variable \n] {  puthelp "PRIVMSG $chan :$line"}(or if you've already created a _list_ from the file):foreach element $your_data_list {  puthelp "PRIVMSG $chan :$element"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sun Sep 14, 2003 5:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2003-09-14T17:41:07-04:00</updated>

		<published>2003-09-14T17:41:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27084#p27084</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27084#p27084"/>
		<title type="html"><![CDATA[Reading from a file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27084#p27084"><![CDATA[
Hello again im having trouble reading from a flat file on my shell.<br><br>Well i can read it but i cant display its contents in channel.<br><br>It's based on a quote script by Koloth, v1.0. i altered it so people could add quake servers to it for people to play on. and remove them if they are down. it currently displays how many servers are added and it will pull a random server (Was a random quote) from the list with !server (which used to be !quote) so everything works fine. now instead of having a random server displayed on channel id like it to reel off the entire list. can someone give me an example of how display a document on channel. I have already opened the file, read the contents and closed it again.<br><br>Thanks in advance. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"> <br><br>^DooM^<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Sun Sep 14, 2003 5:41 pm</p><hr />
]]></content>
	</entry>
	</feed>
