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

	<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-02-14T08:41:28-04:00</updated>

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

		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2004-02-14T08:41:28-04:00</updated>

		<published>2004-02-14T08:41:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33595#p33595</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33595#p33595"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33595#p33595"><![CDATA[
I don't see where you see [set shortnick *] anything... but there is an error. I forgot the $lines part of the lsearch, i.e. the list to search through heh. So change that line to this:<br><br>set idx [lsearch -glob $lines "set keep-nick *"]<br><br>I dunno if it will work now, but that's at least one error out of the way.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Sat Feb 14, 2004 8:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoMMy]]></name></author>
		<updated>2004-02-14T04:31:39-04:00</updated>

		<published>2004-02-14T04:31:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33593#p33593</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33593#p33593"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33593#p33593"><![CDATA[
Thanks stdragon,<br><br>This adds the line in the config but it doesnt remove a line if it finds one.<br>maybe its something with the [set shortnick *] u have.<br><br>Can you check it out?<br><br>Thanks  <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=3555">CoMMy</a> — Sat Feb 14, 2004 4:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2004-02-11T11:18:29-04:00</updated>

		<published>2004-02-11T11:18:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33461#p33461</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33461#p33461"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33461#p33461"><![CDATA[
Sir_Fz, in your script you often used [open $config ...]. You know that reopens the file each time, right? So in your while loop, you reopen the file each time you read a line... and close it once. The first bit of code, before the while loop, does most of the work, all you had to do was search/replace within the data you read, not re-read the file again. Anyway, something like this should work:<br><div class="codebox"><p>Code: </p><pre><code>set newnick "dragon123"set fp [open $config r]set lines [split [read $fp] \n]close $fpset idx [lsearch -glob "set keep-nick *"]set newline [list set keep-nick $newnick]if {$idx != -1} {  set lines [lreplace $lines $idx $idx $newline]} else {  lappend lines $newline}set fp [open $config w]puts -nonewline $fp [join $lines \n]close $fp</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Feb 11, 2004 11:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoMMy]]></name></author>
		<updated>2004-02-11T10:42:34-04:00</updated>

		<published>2004-02-11T10:42:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33455#p33455</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33455#p33455"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33455#p33455"><![CDATA[
Thanks. But you forgot to set a value for "a"<br><br>[15:42] Tcl error [pub_keepnick]: can't read "a": no such variable<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3555">CoMMy</a> — Wed Feb 11, 2004 10:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-16T09:04:10-04:00</updated>

		<published>2003-11-16T09:04:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30102#p30102</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30102#p30102"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30102#p30102"><![CDATA[
<blockquote class="uncited"><div>Will This add the line if it doesn's exist?</div></blockquote>No!, <strong class="text-strong">putlog "$line was not found in $conf"</strong> means that the line was not found in order to delete it.<div class="codebox"><p>Code: </p><pre><code>proc keepnick { olddata } { global keepnick config if {[info exists keepnick]} {set data "set keep-nick $keepnick"set line [read [open $config r]] split $line close [open $config r] if {[lsearch -exact $line $olddata] != -1} {     set ls ""     while {![eof [open $config r]]} {       set got [gets $a]       if {[string tolower [lindex $got 0]] != [string tolower $olddata]} { lappend ls $got }     }     close [open $config r]     foreach l $ls {       if {$l != ""} { puts [open $config w] $l }     }    putlog "Deleted old data and added new one"    puts [open $config w] $data    utimer 1 [list close [open $config w]]    utimer 2 "rehash"    }  } }</code></pre></div>this is what you want. use <strong class="text-strong">keepnick &lt;old-data&gt;</strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sun Nov 16, 2003 9:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[]Kami[]]></name></author>
		<updated>2003-11-16T08:46:48-04:00</updated>

		<published>2003-11-16T08:46:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30097#p30097</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30097#p30097"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30097#p30097"><![CDATA[
should do it<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3559">]Kami[</a> — Sun Nov 16, 2003 8:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoMMy]]></name></author>
		<updated>2003-11-16T08:39:53-04:00</updated>

		<published>2003-11-16T08:39:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30094#p30094</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30094#p30094"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30094#p30094"><![CDATA[
Will This add the line if it doesn's exist?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3555">CoMMy</a> — Sun Nov 16, 2003 8:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-16T06:33:29-04:00</updated>

		<published>2003-11-16T06:33:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30087#p30087</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30087#p30087"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30087#p30087"><![CDATA[
<blockquote class="uncited"><div>[snip]<br>} else { <br>    puts $config $data <br>    close $config } <br>    rehash <br> }</div></blockquote>replace this with:<div class="codebox"><p>Code: </p><pre><code>} else {   putlog "$line was not found in $conf"    }  }</code></pre></div>and put the data in the line before the else where it found the line and deleted it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sun Nov 16, 2003 6:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoMMy]]></name></author>
		<updated>2003-11-16T06:11:52-04:00</updated>

		<published>2003-11-16T06:11:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30086#p30086</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30086#p30086"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30086#p30086"><![CDATA[
Thanks for that but i still can get it to work. This is what i have.<br>Basically the purpose is of this tcl is a user sets the keepnick by a public cmd and this sets the keep-nick to the value got by the user and after that calls the proc below which gives the error:<br><div class="codebox"><p>Code: </p><pre><code>Tcl error [pub_keepnick]: can not find channel named "eggdrop.conf"</code></pre></div><div class="codebox"><p>Code: </p><pre><code>proc keepnick { } {global keepnick configif {[info exists keepnick]} { set data "set keep-nick $keepnick" set line [read [open $config r]] split $line close [open $config r] if {[lsearch -exact $line $data] != -1} {     set ls ""     while {![eof [open $config r]]} {       set got [gets $a]       if {[string tolower [lindex $got 0]] != [string tolower $data]} { lappend ls $got }     }     close [open $config r]     foreach l $ls {       if {$l != ""} { puts [open $config w] $l }     }     close [open $config w]     rehash  } else {     puts $config $data    close $config }    rehash  }</code></pre></div>HELP PLS<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3555">CoMMy</a> — Sun Nov 16, 2003 6:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-15T17:59:11-04:00</updated>

		<published>2003-11-15T17:59:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30068#p30068</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30068#p30068"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30068#p30068"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set line [read [open $conf r]]split $lineclose [open $conf r]if {[lsearch -exact $line your-line] != -1} {    set ls ""    while {![eof [open $conf r]]} {      set got [gets $a]      if {[string tolower [lindex $got 0]] != [string tolower your-line]} { lappend ls $got }    }    close [open $conf r]    foreach l $ls {      if {$l != ""} { puts [open $conf w] $l }    }    close [open $conf w]   ##line found and deleted  } else {   ##Line wasn't found in the conf file }</code></pre></div>this should remove a line.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Nov 15, 2003 5:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoMMy]]></name></author>
		<updated>2003-11-15T15:45:18-04:00</updated>

		<published>2003-11-15T15:45:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30060#p30060</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30060#p30060"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30060#p30060"><![CDATA[
Thanks egghead.<br><br>And can you tell me please how to remove a custom line once i added it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3555">CoMMy</a> — Sat Nov 15, 2003 3:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[egghead]]></name></author>
		<updated>2003-11-15T09:00:23-04:00</updated>

		<published>2003-11-15T09:00:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30043#p30043</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30043#p30043"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30043#p30043"><![CDATA[
<blockquote class="uncited"><div>Is there a variable that gives out the main bots config file name?</div></blockquote>The global variable "config" contains the config file name.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=282">egghead</a> — Sat Nov 15, 2003 9:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoMMy]]></name></author>
		<updated>2003-11-15T08:23:13-04:00</updated>

		<published>2003-11-15T08:23:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30037#p30037</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30037#p30037"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30037#p30037"><![CDATA[
Thanks For That. I made it work. But i also want Something else please.<br>Is there a variable that gives out the main bots config file name?<br>And can you tell me how to remove a custom line once i added it?<br><br>Thanks again.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3555">CoMMy</a> — Sat Nov 15, 2003 8:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z_one]]></name></author>
		<updated>2003-11-15T06:12:36-04:00</updated>

		<published>2003-11-15T06:12:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30030#p30030</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30030#p30030"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30030#p30030"><![CDATA[
The problem seems to be in the way you use <strong class="text-strong">open</strong> to access your file.<br>It looks like you are using the <strong class="text-strong">w</strong> or <strong class="text-strong">w+</strong> attributes. They truncate (empty) the file.<br>Use <strong class="text-strong">a</strong> or <strong class="text-strong">a+</strong> to append the line at the end of the file.<br><br>For more details about the available attributes check out: <a href="http://www.cotse.com/dlf/man/TclCmd/open.htm#M8" class="postlink">http://www.cotse.com/dlf/man/TclCmd/open.htm#M8</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=698">z_one</a> — Sat Nov 15, 2003 6:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoMMy]]></name></author>
		<updated>2003-11-15T05:35:03-04:00</updated>

		<published>2003-11-15T05:35:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30028#p30028</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30028#p30028"/>
		<title type="html"><![CDATA[Need Help Adding A Line in bot config.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30028#p30028"><![CDATA[
I Do That But It Replaces Everything In The Config File And Puts That Line.<br>help pls.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3555">CoMMy</a> — Sat Nov 15, 2003 5:35 am</p><hr />
]]></content>
	</entry>
	</feed>
