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

	<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>2002-05-22T10:40:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-05-22T10:40:00-04:00</updated>

		<published>2002-05-22T10:40:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7158#p7158</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7158#p7158"/>
		<title type="html"><![CDATA[looping?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7158#p7158"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc read_ini_section {ini section} {  set fp [open $ini r]  set insec 0  set ret {}  while {![eof $fp]} {    set in [gets $fp]    if {($insec)  || ([string match "[${section}]" $in])} {      set insec 1      if {[string match "[*]" $in]} { break }      if {[llength [split $in =]] == 2} {lappend ret [list [lindex [split $in =] 0][lindex [split $in =] 1]] }    }  }  catch {close $fp}  return $ret}</code></pre></div>This is a generic INI section reader.<br><br>It can be used to populate a Tcl array, or simply use a foreach loop to use the return value.<br><br>EG<div class="codebox"><p>Code: </p><pre><code>array set array1 [read_ini_section file.ini section1]</code></pre></div>EG<div class="codebox"><p>Code: </p><pre><code>foreach {name value} [read_ini_section file.ini section1] {  puthelp "PRIVMSG $chan :"${name}" is set to "${value}""}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed May 22, 2002 10:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2002-05-21T11:37:00-04:00</updated>

		<published>2002-05-21T11:37:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7126#p7126</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7126#p7126"/>
		<title type="html"><![CDATA[looping?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7126#p7126"><![CDATA[
already got that <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br>The problem was not the reading part... but how to make one command read through the same section 25 times and output the value of the items, one item on each line in say.. a privmsg<br><br>..but as I said.. I used several small procs and that works fine actually. Easier to modify the bot's reply on each item <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><br><br>Thx anyway <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><br><br>_________________<br>Elen sila lúmenn' omentielvo<br><br>&lt;font size=-1&gt;[ This Message was edited by: Papillon on 2002-05-21 09:39 ]&lt;/font&gt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=852">Papillon</a> — Tue May 21, 2002 11:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-05-21T10:30:00-04:00</updated>

		<published>2002-05-21T10:30:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7125#p7125</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7125#p7125"/>
		<title type="html"><![CDATA[looping?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7125#p7125"><![CDATA[
It would be simpler to get make a generic INI parser.<br><div class="codebox"><p>Code: </p><pre><code>proc read_ini {ini section item} {  set fp [open $ini r]  set insec 0  set ret ""  while {![eof $fp]} {    set in [gets $fp]    if {($insec)  || ([string match "[${section}]" $in])} {      set insec 1      if {[string match "[*]" $in]} { break }      if {$item == [lindex [split $in =] 0]} {        set ret [lindex [split $in =] 1]        break      }    }  }  catch {close $fp}  return $ret}</code></pre></div>My Tcl is a little rusty, but this should parse a INI file, and return a item, under a certain section, while ignoring items named the same, under other sections.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Tue May 21, 2002 10:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2002-05-21T09:22:00-04:00</updated>

		<published>2002-05-21T09:22:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7122#p7122</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7122#p7122"/>
		<title type="html"><![CDATA[looping?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7122#p7122"><![CDATA[
thx but it does not mather anymore.. I just made alot of procs <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"> <br>Actually the "items" are limited so I just had to make 25 small procs.. works fine.<br><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=852">Papillon</a> — Tue May 21, 2002 9:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-05-20T10:26:00-04:00</updated>

		<published>2002-05-20T10:26:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7088#p7088</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7088#p7088"/>
		<title type="html"><![CDATA[looping?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7088#p7088"><![CDATA[
If you could paste an example of the layout of the INI file (maybe some real data, with many 4 or 5 entries under 3 sections) and how you want the data (from example posted) presented, it will be clearer.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Mon May 20, 2002 10:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2002-05-19T12:14:00-04:00</updated>

		<published>2002-05-19T12:14:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7061#p7061</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7061#p7061"/>
		<title type="html"><![CDATA[looping?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7061#p7061"><![CDATA[
when working with inifiles the bot does not read to the end of the file. It read one specified [section] and one [item] under that. <br><br>[section]<br>item=value<br><br>so what I want it to do is to read one section multiple times and output the value of the different "items" , one on each lines... like if the items are nicknames...<br>it would reply : Nick 1(the item) is st00pid(the value of the item)<br><br>thx anyway <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=852">Papillon</a> — Sun May 19, 2002 12:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-05-18T14:39:00-04:00</updated>

		<published>2002-05-18T14:39:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7040#p7040</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7040#p7040"/>
		<title type="html"><![CDATA[looping?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7040#p7040"><![CDATA[
Something like this?<br><div class="codebox"><p>Code: </p><pre><code>set read_ini [open $filename r]while {![eof $read_ini]} {set data [gets $read_ini]if {[eof $read_ini]} {break}if {[string compare [lindex [split $data =] 0] $id] == 0} {putlog "Info for $id : [lrange [split $data =] 1 end] "}}close $read_ini</code></pre></div>&lt;font size=-1&gt;[ This Message was edited by: Jules_74 on 2002-05-18 12:40 ]&lt;/font&gt;<p>Statistics: Posted by Guest — Sat May 18, 2002 2:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2002-05-16T20:43:00-04:00</updated>

		<published>2002-05-16T20:43:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=6996#p6996</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=6996#p6996"/>
		<title type="html"><![CDATA[looping?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=6996#p6996"><![CDATA[
here's the problem I can't seem to figure out...<br><br>I'm working with ini files in a script for storing info<br><br>[info]<br>1=blabla<br>2=blabla<br>7=blabla<br>12=blabla<br><br>now the problem is how to make the bot search trought [info] and output the info of 1,2,7 and 12, one on each line...(those numbers might be different in each section)<br><br>anyone able to help me on this?<br><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=852">Papillon</a> — Thu May 16, 2002 8:43 pm</p><hr />
]]></content>
	</entry>
	</feed>
