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

	<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-10-25T02:26:57-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-25T02:26:57-04:00</updated>

		<published>2002-10-25T02:26:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12347#p12347</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12347#p12347"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12347#p12347"><![CDATA[
i change my code to your advice like this:<br><div class="codebox"><p>Code: </p><pre><code>set a [open $files(1) r+] set b [read $a]if {[string match -nocase "*$text*" $b]} { catch {close $a} return 0 }set c [open $files(2) r+]set d [read $c]if {[string match -nocase "*$text*" $d]} { catch {close $c}return 0 }...etc....puts $a $textcatch {close $a}}putlog "new.tcl loaded"</code></pre></div>but still my eggs getting killed with quit message (Client closed connection), and closed by remote section when i'm using telnet if i test by adding $text that already on the file (i want to test if the code works to denied a text that already on file), but the result is always killed....<br>Why? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"> <br><br>[/code]<p>Statistics: Posted by Guest — Fri Oct 25, 2002 2:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-23T05:51:26-04:00</updated>

		<published>2002-10-23T05:51:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12215#p12215</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12215#p12215"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12215#p12215"><![CDATA[
seek jumps to the specified file position... <br>seek $fa 0 end -&gt; jump to 0 bytes after the end of the file... that's where you are, when reading a file from the start to the end.<br><br>a 'catch { close $fd }' closes file descriptor $fd and returns no error, even if the file is closed already<br><br>This appends $text to the first opened file, if  $text is  in none of the files <br><div class="codebox"><p>Code: </p><pre><code>set fa [open $files(1) r+]set txt [read $fa]### here you're at the end of $files(1) ...if {[string match -nocase "*$text*" $txt]} {    ### remember to close $file(1) if $text is there:    catch { close $fa }    return 0} set fb [open $files(2) r]set txt [read $fb]catch { close $fb }if {[string match -nocase "*$text*" $txt]} {    ### remember to close $file(1) if $text is there:    catch { close $fa }    return 0}... snip ....catch { close $fx }if {[string match -nocase "*$text*" $txt]} {    catch { close $fa }    return 0}puts $fa $textcatch { close $fa }</code></pre></div>If you want to replace the content of $file(1) insert a 'seek $fa 0 start' before the 'puts $fa $text'<p>Statistics: Posted by Guest — Wed Oct 23, 2002 5:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-23T05:26:47-04:00</updated>

		<published>2002-10-23T05:26:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12214#p12214</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12214#p12214"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12214#p12214"><![CDATA[
<img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":-?" title="Confused">  well....actually i dont have any idea, i already try to make variations of that code, but the result is error and this is my last alternative variation and it seems dont have any error (my bot can be loaded) but if i test and add something to it, it killed (i think it because lack of memory of my shell) and now completely confuse and really need help or suggest from anyone, i dont pretty much smart about tcl, so can you make more specify what should i do? thx<p>Statistics: Posted by Guest — Wed Oct 23, 2002 5:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-23T04:18:30-04:00</updated>

		<published>2002-10-23T04:18:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12213#p12213</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12213#p12213"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12213#p12213"><![CDATA[
<blockquote class="uncited"><div>well..i put them like this:<br><br>set a [open $files(1) r+] <br>set b [read $a]<br>if {[string match -nocase "*$text*" $b]} { <br>return 0 <br>}<br>seek $a 0 end<br>catch {close $a}</div></blockquote>Hmm... where's the sense in reading a file, jumping to the end (where you already are when reading the file to the end <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";-)" title="Wink"> )  and then closing the file? ...and you return before closing the file if it matches -&gt; open file descriptor<p>Statistics: Posted by Guest — Wed Oct 23, 2002 4:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-23T03:36:59-04:00</updated>

		<published>2002-10-23T03:36:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12210#p12210</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12210#p12210"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12210#p12210"><![CDATA[
well..i put them like this:<br><br>set a [open $files(1) r+] <br>set b [read $a]<br>if {[string match -nocase "*$text*" $b]} { <br>return 0 <br>}<br>seek $a 0 end<br>catch {close $a}<br>set c [open $files(2) r+]<br>set d [read $c]<br>if {[string match -nocase "*$text*" $d]} { <br>return 0 <br>}<br>etc...<br>seek $g 0 end<br>catch {close $g}<br>puts $a $text<br><br>but when i test add something to my egg, it was killed, no error just seems not enough memory or ram. so...how to make they work well without spend to many memory of my shell? <br>thx<p>Statistics: Posted by Guest — Wed Oct 23, 2002 3:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-10-22T06:36:59-04:00</updated>

		<published>2002-10-22T06:36:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12172#p12172</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12172#p12172"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12172#p12172"><![CDATA[
You would get that, as the error sugests, whent he variable doesn't exist.<br><br>You havn't exactly shown much of the code, other than the file close portion.<br><br>At the moment, the script does the following<br><blockquote class="uncited"><div>open FILEA<br>open FILEB<br>open FILEC<br>open FILED<br><br>perform some command on the file<br><br>close FILEA<br>close FILEB<br>close FILEC<br>close FILED</div></blockquote>This means, it opne 4 files at the same time. WHat you need, is to only open once at a time<br><br>EG<blockquote class="uncited"><div>open FILEA<br>perform action of file<br>close FILEA<br><br>open FILEB<br>perform action on file<br>close FILEB<br><br>open FILEC<br>perform action on file<br>close FILEC<br><br>open FILED<br>perform action on file<br>close FILED</div></blockquote>[/code]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Tue Oct 22, 2002 6:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-22T05:06:21-04:00</updated>

		<published>2002-10-22T05:06:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12167#p12167</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12167#p12167"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12167#p12167"><![CDATA[
but seems it make error like this:<br><br>[01:57] can't read "text": no such variable<br>    while executing<br>"string match -nocase "*$text*" $d"<br>    (file "scripts/test.tcl" line 1)<br>    (file "mybot" line 1)<br>[01:57] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)<br><br>???<p>Statistics: Posted by Guest — Tue Oct 22, 2002 5:06 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-22T04:37:28-04:00</updated>

		<published>2002-10-22T04:37:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12166#p12166</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12166#p12166"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12166#p12166"><![CDATA[
hmm...you mean like this: ??<br><br>if {[string match -nocase "*$text*" $b]} { <br>return 0 <br>}<br>seek $a 0 end<br>catch {close $a}<br>}<br>if {[string match -nocase "*$text*" $d]} { <br>return 0 <br>}<br>seek $c 0 end<br>catch {close $c}<br>}<br>etc...<br>puts $a $text<br>}<br><br>putlog "test.tcl loaded"<p>Statistics: Posted by Guest — Tue Oct 22, 2002 4:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2002-10-22T03:39:45-04:00</updated>

		<published>2002-10-22T03:39:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12163#p12163</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12163#p12163"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12163#p12163"><![CDATA[
it will be the same <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>if I remember correctly you opens all the file for reading then if none of it matches you write to the last file.... correct?<br><br>if that was the case maybe you should try opening just one file at the time.... open 1---&gt;close 1 open 2---&gt;close 2 ....etc <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>this probably means that you'll have to rewrite parts of your code..but maybe it's worth a shot <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=852">Papillon</a> — Tue Oct 22, 2002 3:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-22T01:51:39-04:00</updated>

		<published>2002-10-22T01:51:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12158#p12158</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12158#p12158"/>
		<title type="html"><![CDATA[seek and catch {close $variable} meaning]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12158#p12158"><![CDATA[
I just wandering, what is mean the part of this code, especially seek 0 end command,<br><br>seek $a 0 end <br>seek $c 0 end <br>seek $e 0 end <br>seek $g 0 end <br>catch {close $a} <br>catch {close $c} <br>catch {close $e} <br>catch {close $g} <br><br><br>coz i have problem with too many open files when i load this tcl, so how about if i change a little different at above part code and change them like this:<br><br><br>seek $a 0 end<br>catch {close $a}<br>}<br>seek $c 0 end<br>catch {close $c}<br>}<br>etc...<br><br>so...problem too many open files will be avoid. Hmm...i wander, would it be the same or will give a different meaning from the old code??<br>thx, i just want to know how they work, so maybe i'll understand (at least i try to understand) to fix my current problem about this.<p>Statistics: Posted by Guest — Tue Oct 22, 2002 1:51 am</p><hr />
]]></content>
	</entry>
	</feed>
