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

	<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-08-11T14:12:28-04:00</updated>

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

		<entry>
		<author><name><![CDATA[KrzychuG]]></name></author>
		<updated>2004-08-11T14:12:28-04:00</updated>

		<published>2004-08-11T14:12:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39694#p39694</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39694#p39694"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39694#p39694"><![CDATA[
Nice, i can update it in my scripts <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3672">KrzychuG</a> — Wed Aug 11, 2004 2:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-08-11T13:13:01-04:00</updated>

		<published>2004-08-11T13:13:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39693#p39693</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39693#p39693"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39693#p39693"><![CDATA[
<blockquote class="uncited"><div>Use this to replace or remove line from file:<br><div class="codebox"><p>Code: </p><pre><code> # Replace line(s) in file  # Usage:  #  replaceLines &lt;file&gt; &lt;first line&gt; &lt;last line&gt; [replacement data]  proc replaceLines { args } {    if {[llength $args] &gt;= 3} then {      foreach {file start end} $args break      set cmd [list lreplace [split [read [set f [open $file r]]] \n] $start $end]      close $f      if {[llength $args] &gt; 3} then {lappend cmd [lindex $args 3]}      puts -nonewline [set f [open $file w]] [join [eval $cmd] \n]      close $f    } else {      error "wrong # args: should be "[lindex [info level 0] 0] file start end ?replacement?""    }  } ;# replaceLines</code></pre></div></div></blockquote>What's up with the screwed up indentation and added braces and keywords? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br>btw: here's a more recent version of that proc (the syntax is identical, but you can also add more lines passed as separate arguments and it's a bit faster)<div class="codebox"><p>Code: </p><pre><code>proc replaceLines {file args} {if {[llength $args]&gt;=2} {set data [eval lreplace [list [split [read [set f [open $file]]] \n]] $args]close $fputs -nonewline [set f [open $file w]] [join $data \n]close $f} {error "wrong # args: should be "[lindex [info level 0] 0] file start end ?replacement?""}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Aug 11, 2004 1:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[the_crow]]></name></author>
		<updated>2004-08-11T12:34:06-04:00</updated>

		<published>2004-08-11T12:34:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39692#p39692</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39692#p39692"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39692#p39692"><![CDATA[
thks by helping but i have solved the problem <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2778">the_crow</a> — Wed Aug 11, 2004 12:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[KrzychuG]]></name></author>
		<updated>2004-08-11T12:15:56-04:00</updated>

		<published>2004-08-11T12:15:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39691#p39691</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39691#p39691"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39691#p39691"><![CDATA[
Use this to replace or remove line from file:<br><div class="codebox"><p>Code: </p><pre><code> # Replace line(s) in file  # Usage:  #  replaceLines &lt;file&gt; &lt;first line&gt; &lt;last line&gt; [replacement data]  proc replaceLines { args } {    if {[llength $args] &gt;= 3} then {      foreach {file start end} $args break      set cmd [list lreplace [split [read [set f [open $file r]]] \n] $start $end]      close $f      if {[llength $args] &gt; 3} then {lappend cmd [lindex $args 3]}      puts -nonewline [set f [open $file w]] [join [eval $cmd] \n]      close $f    } else {      error "wrong # args: should be \"[lindex [info level 0] 0] file start end ?replacement?\""    }  } ;# replaceLines</code></pre></div>To remove first line use:<div class="codebox"><p>Code: </p><pre><code>replaceLines "file.txt" 0 0</code></pre></div>To replace first line use:<div class="codebox"><p>Code: </p><pre><code>replaceLines "file.txt" 0 0 "new data"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3672">KrzychuG</a> — Wed Aug 11, 2004 12:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[the_crow]]></name></author>
		<updated>2004-08-11T10:09:18-04:00</updated>

		<published>2004-08-11T10:09:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39686#p39686</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39686#p39686"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39686#p39686"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !duvida idle_getnickbind pub o !listar listar:pubbind pub o !apagar apagar:pubbind join - * file_checkset id 0proc file_check {n u h c} {  set ficheiro "scripts/duvidas.txt"  if {[file size $ficheiro] &gt; 0} then {    putserv "PRIVMSG $n :Existem duvidas para tirar,faz !listar para veres e depois de resolvidas faz !apagar"  }}proc idle_getnick {nick mask hand chan text} {global botnick idset ficheiro "scripts/duvidas.txt"putserv "PRIVMSG $chan : A sua duvida foi enviada com sucesso. Será respondido o mais depressa possível."set fp [open $ficheiro a+]puts $fp "$id -&gt; $nick : $text"catch {close $fp}incr id 1}proc listar:pub {nick mask hand chan text} {global botnickset ficheiro "scripts/duvidas.txt"putserv "PRIVMSG $nick : Lista de Duvidas por user"set fs [open $ficheiro r]while {![eof $fs]} {gets $fs lineputserv "PRIVMSG $nick : $line"}close $fs}proc apagar:pub {nick mask hand chan text} {set id [string tolower [lindex $text 0]]set ficheiro "scripts/duvidas.txt"if {$id == ""} { putserv "privmsg $nick : insert the id to clean." }set fs [open $ficheiro a]while {![eof $fs]} {   set linha "[gets $fs]"   if {$linha != ""} {     set ident [lindex $linha 0]     if {$id == $ident} {      puts $fs2 ""      close $fs2      putserv "privmsg $nick : THe id that you wanted was clean."     }    }   }}</code></pre></div>Like you saw i made same alterations, but know when i try to clean one ID like !apagar 1, it doesn´t work... <br><br>its a exemple:<br>!duvita hellp<br><br>!listar<br>(it will appear) 0 - $nick - Hello<br><br>!apagar 0<br><br>it doesn't work <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2778">the_crow</a> — Wed Aug 11, 2004 10:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[the_crow]]></name></author>
		<updated>2004-08-10T20:24:14-04:00</updated>

		<published>2004-08-10T20:24:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39676#p39676</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39676#p39676"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39676#p39676"><![CDATA[
thanks <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Netux pois agora começo a reparar... vai aparecendo la mais vezes <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> ja agora obrigado pelo codigo... mas prefiro o do outro bacano nao keria tar a fazer incrementacoes :S<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2778">the_crow</a> — Tue Aug 10, 2004 8:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[KrzychuG]]></name></author>
		<updated>2004-08-10T20:13:58-04:00</updated>

		<published>2004-08-10T20:13:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39675#p39675</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39675#p39675"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39675#p39675"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind join - * file_checkproc file_check {n u h c} {  set ficheiro "scripts/duvidas.txt"   if {[file size $ficheiro] &gt; 0} then {    putserv "PRIVMSG $n :File $ficheiro is not empty"  }} ;# file_check</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3672">KrzychuG</a> — Tue Aug 10, 2004 8:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[netux]]></name></author>
		<updated>2004-08-10T20:05:54-04:00</updated>

		<published>2004-08-10T20:05:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39674#p39674</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39674#p39674"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39674#p39674"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind join - * file_checkproc file_check {n u h c} {  if {$n != "|The_Crow|"} {return 0} ; set ficheiro [open "scripts/duvidas.txt"] ; set linhas 0  while {![eof $ficheiro]} {gets $ficheiro line ; if {$line != ""} {incr linhas 1}} ; close $ficheiro  if {$linhas != 0} {puthelp "PRIVMSG $n : ficheiro não está vazio!"}}</code></pre></div>tinhas ajuda ai ao lado ;]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5272">netux</a> — Tue Aug 10, 2004 8:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[the_crow]]></name></author>
		<updated>2004-08-10T19:10:23-04:00</updated>

		<published>2004-08-10T19:10:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39673#p39673</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39673#p39673"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39673#p39673"><![CDATA[
thanks by the help... by the way... how can i make a onjoin that sendme a msg if the file is not empty?can you help me?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2778">the_crow</a> — Tue Aug 10, 2004 7:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[KrzychuG]]></name></author>
		<updated>2004-08-10T16:57:24-04:00</updated>

		<published>2004-08-10T16:57:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39672#p39672</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39672#p39672"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39672#p39672"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set fs [open $ficheiro w]close $fs</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3672">KrzychuG</a> — Tue Aug 10, 2004 4:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[the_crow]]></name></author>
		<updated>2004-08-10T16:34:42-04:00</updated>

		<published>2004-08-10T16:34:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39671#p39671</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39671#p39671"/>
		<title type="html"><![CDATA[cant clean file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39671#p39671"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !duvida idle_getnickbind pub o !listar listar:pubproc idle_getnick {nick mask hand chan text} {global botnickset ficheiro "scripts/duvidas.txt"putserv "PRIVMSG $chan : A sua duvida foi enviada com sucesso. Será respondido o mais depressa possível."set fp [open $ficheiro a+]puts $fp "$nick : $text"catch {close $fp}}proc listar:pub {nick mask hand chan text} {global botnickset ficheiro "scripts/duvidas.txt"set fs [open $ficheiro r]while {![eof $fs]} {gets $fs lineputserv "PRIVMSG $nick : $line"}close $fs}</code></pre></div><br>how can i make procedure that clean my file when i trig !clean ? thanks <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2778">the_crow</a> — Tue Aug 10, 2004 4:34 pm</p><hr />
]]></content>
	</entry>
	</feed>
