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

	<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>2010-10-12T20:08:34-04:00</updated>

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

		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2010-10-12T20:08:34-04:00</updated>

		<published>2010-10-12T20:08:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94709#p94709</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94709#p94709"/>
		<title type="html"><![CDATA[A script monitoring irc network status (/map &gt; .txt)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94709#p94709"><![CDATA[
<blockquote class="uncited"><div>...<br>Excellent, now <em class="text-italics">mapfile</em> is being overwritten as requested! Thanks for the update, willyw! It is a fine script.</div></blockquote>Great!   and you are welcome.    <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>I'm glad you like it, and that it does what you wanted.<br><br>Thanks for taking time to post back.  It is good to know.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Tue Oct 12, 2010 8:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[coke]]></name></author>
		<updated>2010-10-12T19:28:27-04:00</updated>

		<published>2010-10-12T19:28:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94708#p94708</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94708#p94708"/>
		<title type="html"><![CDATA[A script monitoring irc network status (/map &gt; .txt)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94708#p94708"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>if {[file exists $mapfile]} {file delete $mapfile }</code></pre></div></div></blockquote><br>Excellent, now <em class="text-italics">mapfile</em> is being overwritten as requested! Thanks for the update, willyw! It is a fine script.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11380">coke</a> — Tue Oct 12, 2010 7:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2010-10-12T10:25:02-04:00</updated>

		<published>2010-10-12T10:25:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94703#p94703</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94703#p94703"/>
		<title type="html"><![CDATA[A script monitoring irc network status (/map &gt; .txt)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94703#p94703"><![CDATA[
<blockquote class="uncited"><div>Just wanted to say that I am pretty sure you can accomplish the same thing by simply changing this:<br><div class="codebox"><p>Code: </p><pre><code>set fp [open $fname "a"] </code></pre></div>to<div class="codebox"><p>Code: </p><pre><code>set fp [open $fname "w]"</code></pre></div>This basically accomplishes an "overwrite" of the file. In tcl, when you open a file with write permissions, it clears any existing content first. This is why there is "a" for "append" and "w" for "write". <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> "w" will also create the file if it does not exist.<br><br><a href="http://www.astro.princeton.edu/~rhl/Tcl-Tk_docs/tcl/open.n.html" class="postlink">http://www.astro.princeton.edu/~rhl/Tcl ... pen.n.html</a></div></blockquote>Right.<br>That's why I said:<blockquote class="uncited"><div>It's not going to work, with a true "overwrite", when opening the file. </div></blockquote>Perhaps you missed that.<br><br>When I was building it, and first tested it,  <br>bind raw -|- 006 mapstuff006 <br>caused two returns from the server.   Thus, the accompanying proc ran twice... and the second time through, it overwrote the results from the first time.<br>Not good.<br><br>It might be easier to see, if you consider that <br>bind raw -|- 007 mapstuff007 <br>would come along after <br>bind raw -|- 006 mapstuff006 <br>and its accompanying proc would overwrite everything that came before.<br>( I didn't get to actually test this far, as I changed it to append before I had it watch for 007)<br><br>While 006 is not listed here, 007 is:<br><a href="http://www.mirc.net/raws/" class="postlink">http://www.mirc.net/raws/</a><br>and 007 looks to be one that would produce a result every time.<br><br>I hope this explains it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Tue Oct 12, 2010 10:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-10-12T00:50:57-04:00</updated>

		<published>2010-10-12T00:50:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94697#p94697</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94697#p94697"/>
		<title type="html"><![CDATA[A script monitoring irc network status (/map &gt; .txt)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94697#p94697"><![CDATA[
Just wanted to say that I am pretty sure you can accomplish the same thing by simply changing this:<br><div class="codebox"><p>Code: </p><pre><code>set fp [open $fname "a"] </code></pre></div>to<div class="codebox"><p>Code: </p><pre><code>set fp [open $fname "w]"</code></pre></div>This basically accomplishes an "overwrite" of the file. In tcl, when you open a file with write permissions, it clears any existing content first. This is why there is "a" for "append" and "w" for "write". <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> "w" will also create the file if it does not exist.<br><br><a href="http://www.astro.princeton.edu/~rhl/Tcl-Tk_docs/tcl/open.n.html" class="postlink">http://www.astro.princeton.edu/~rhl/Tcl ... pen.n.html</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Tue Oct 12, 2010 12:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2010-10-11T19:25:15-04:00</updated>

		<published>2010-10-11T19:25:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94696#p94696</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94696#p94696"/>
		<title type="html"><![CDATA[A script monitoring irc network status (/map &gt; .txt)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94696#p94696"><![CDATA[
<blockquote class="uncited"><div>Thank you very much for helping me. I edited <em class="text-italics">set mapfile "map.txt"</em> and I run the script. There were errors:<br><div class="codebox"><p>Code: </p><pre><code>&lt;bot&gt; [23:45] Tcl error [do:map]: can't read "mapfile": no such variable&lt;bot&gt; [23:45] Tcl error [mapstuff006]: can't read "mapfile": no such variable&lt;bot&gt; [23:45] Tcl error [mapstuff006]: can't read "mapfile": no such variable&lt;bot&gt; [23:45] Tcl error [mapstuff006]: can't read "mapfile": no such variable&lt;bot&gt; [23:45] Tcl error [mapstuff007]: can't read "mapfile": no such variable</code></pre></div>I compared the script with some other script and added <em class="text-italics">global mapfile</em> to every proc. It seemed to fix it - eggdrop 1.6.19<br></div></blockquote>da**it !!<br>as soon as I started to read this, I knew what it was.<br>You are exactly correct.<br>(the script originally had the path/filename 'hardcoded',  and I remembered to change that, half-way into posting my reply here.<br>sigh...   apparently, I flubbed it, and forgot to edit in the fix.<br>I apologize.<br><blockquote class="uncited"><div>The script works fine. /map is being saved to a file. That's exactly what i wanted.</div></blockquote>And I'm very glad that you realized the problem, and got it fixed and working for you.     <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><blockquote class="uncited"><div> One more thing. Could the script overwrite mapfile instead of appending to it?</div></blockquote>As long as you are sure -  Yes. <br>All you'd see, whenever you viewed the file, was the text that is less than 15 minutes old.<br><br>Here's the thing:<br>It's not going to work, with a true "overwrite", when opening the file.<br>But, we can get the same result, by simply deleting the file, each time before we start to write new info in it,  right?    <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br><br>You have this, I believe:<div class="codebox"><p>Code: </p><pre><code>proc do:map {min hour day month year} {global mapfile     bind raw -|- 006 mapstuff006     bind raw -|- 007 mapstuff007 ....</code></pre></div>Add to it.  Insert some commands, so it looks like this:<div class="codebox"><p>Code: </p><pre><code>proc do:map {min hour day month year} {global mapfileif {[file exists $mapfile]} {file delete $mapfile }     bind raw -|- 006 mapstuff006     bind raw -|- 007 mapstuff007 ....</code></pre></div>Basically,  check to see if the file exists, and if it does,  then delete it.<br><br>Since this happens before anything that would append to it,  each time there is nothing to append to,  ... the file is created new.<br>Does this sound like what you'd like it to do?    <br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br><br>p.s.  Above changes are untested.   Let us know if it does not perform properly, and if somebody else here doesn't beat me to it,  I'll test it and fix it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Mon Oct 11, 2010 7:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[coke]]></name></author>
		<updated>2010-10-11T18:16:50-04:00</updated>

		<published>2010-10-11T18:16:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94695#p94695</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94695#p94695"/>
		<title type="html"><![CDATA[A script monitoring irc network status (/map &gt; .txt)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94695#p94695"><![CDATA[
Thank you very much for helping me. I edited <em class="text-italics">set mapfile "map.txt"</em> and I run the script. There were errors:<br><div class="codebox"><p>Code: </p><pre><code>&lt;bot&gt; [23:45] Tcl error [do:map]: can't read "mapfile": no such variable&lt;bot&gt; [23:45] Tcl error [mapstuff006]: can't read "mapfile": no such variable&lt;bot&gt; [23:45] Tcl error [mapstuff006]: can't read "mapfile": no such variable&lt;bot&gt; [23:45] Tcl error [mapstuff006]: can't read "mapfile": no such variable&lt;bot&gt; [23:45] Tcl error [mapstuff007]: can't read "mapfile": no such variable</code></pre></div>I compared the script with some other script and added <em class="text-italics">global mapfile</em> to every proc. It seemed to fix it - eggdrop 1.6.19<br><br>The script works fine. /map is being saved to a file. That's exactly what i wanted. One more thing. Could the script overwrite mapfile instead of appending to it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11380">coke</a> — Mon Oct 11, 2010 6:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2010-10-11T00:31:38-04:00</updated>

		<published>2010-10-11T00:31:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94683#p94683</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94683#p94683"/>
		<title type="html"><![CDATA[Re: A script monitoring irc network status (/map &gt; .txt)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94683#p94683"><![CDATA[
<blockquote class="uncited"><div><br>I need a script that would make the bot send /map command to the ircd (unreal) and then save ircd's replay to a txt file, say every 15 minutes. </div></blockquote><div class="codebox"><p>Code: </p><pre><code># tested on a version 1.6.19 Windrop test bot.   I haven't upgraded any bots to .20 yet.# Version .20 may have better capability to handle the 15 minute requirement# I believe this method used below still works on ver .20 thoughbind time - "00 * * * *" do:mapbind time - "15 * * * *" do:mapbind time - "30 * * * *" do:mapbind time - "45 * * * *" do:map#you need to set this -  path and filenameset mapfile "scripts/path/to/your/map_output.txt"proc do:map {min hour day month year} {     bind raw -|- 006 mapstuff006     bind raw -|- 007 mapstuff007     putserv "map"     utimer 10 [list unbind raw "-|-" 006 mapstuff006]     utimer 10 [list unbind raw "-|-" 007 mapstuff007]     # reference: http://forum.egghelp.org/viewtopic.php?t=6885     set fname $mapfile     set fp [open $fname "a"]     puts $fp [strftime %c]     close $fp}proc mapstuff006 {from key text} {        set line_to_add "[string trimleft [lrange $text 1 end] :]"        set fname $mapfile        set fp [open $fname "a"]        puts $fp $line_to_add        close $fp}proc mapstuff007 {from key text} {        set line_to_add "[string trimleft [lrange $text 1 end] :]"        set fname $mapfile        set fp [open $fname "a"]        puts $fp $line_to_add        puts $fp "-----------------"        close $fp}</code></pre></div>Tested the above, on version Unreal3.2.8.1, and it worked, creating a file containing the results of the  /map command.<br><blockquote class="uncited"><div>Nothing else. </div></blockquote>This is basic, no frills.   <br>Especially note: It runs four times per hour, appending to a text file.  That text file will  just get bigger, and bigger, and bigger.  As it is, it is up to you to go find it occasionally, and delete it.<br>After observing for a while, if this script does what you want, perhaps we can build in something to help manage that.   <br><blockquote class="uncited"><div>If you have any better idea how to monitor network status, don't hesitate to let me know.</div></blockquote>Since I can't answer this part, I too would be interested to know.   <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=10420">willyw</a> — Mon Oct 11, 2010 12:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[coke]]></name></author>
		<updated>2010-10-09T13:24:17-04:00</updated>

		<published>2010-10-09T13:24:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94676#p94676</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94676#p94676"/>
		<title type="html"><![CDATA[A script monitoring irc network status (/map &gt; .txt)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94676#p94676"><![CDATA[
Hey,<br><br>I need a script that would make the bot send /map command to the ircd (unreal) and then save ircd's replay to a txt file, say every 15 minutes. Nothing else. <br><br>If you have any better idea how to monitor network status, don't hesitate to let me know.<br><br>Would anybody be kind enough to help me out?<br>Thanks in advance!<br><br>coke<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11380">coke</a> — Sat Oct 09, 2010 1:24 pm</p><hr />
]]></content>
	</entry>
	</feed>
