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

	<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>2013-09-22T14:12:38-04:00</updated>

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

		<entry>
		<author><name><![CDATA[tessa1]]></name></author>
		<updated>2013-09-22T13:13:24-04:00</updated>

		<published>2013-09-22T13:13:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102059#p102059</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102059#p102059"/>
		<title type="html"><![CDATA[[Solved] Write multiple lines to file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102059#p102059"><![CDATA[
Yes! Thats it!<br><br>Many 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=6110">tessa1</a> — Sun Sep 22, 2013 1:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2013-09-22T12:56:14-04:00</updated>

		<published>2013-09-22T12:56:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102058#p102058</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102058#p102058"/>
		<title type="html"><![CDATA[[Solved] Write multiple lines to file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102058#p102058"><![CDATA[
Every time proc stats:raw:242  is triggered by the raw bind, the file is being deleted.<br>Thus, only the last one is being saved.<br>See what I mean?<br><br>My mistake.  Sorry.<br><br>Try moving this line:<br>file delete uptimefile <br>from where it is currently, to before the first putserv line in<br>proc stats:cmd:uptime<br><br>That way, the file will only be deleted once - when you issue the <br>!uptime<br>command.     Let's hope this solves it.    <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> — Sun Sep 22, 2013 12:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tessa1]]></name></author>
		<updated>2013-09-22T12:36:21-04:00</updated>

		<published>2013-09-22T12:36:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102057#p102057</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102057#p102057"/>
		<title type="html"><![CDATA[[Solved] Write multiple lines to file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102057#p102057"><![CDATA[
Ok, this is my script now.<br>There are no errors in the partyline.<br>But the script writes only the last server.<br>I rehashed an restarted the Bot.<br>Without deleting the file, the script writes all lines.<br><div class="codebox"><p>Code: </p><pre><code>bind pub - !uptime stats:cmd:uptimeproc stats:cmd:uptime {nick uhost handle channel text} {   global server_statsputserv "STATS u server1.irc.net"putserv "STATS u server2.irc.net"putserv "STATS u server3.irc.net"putserv "STATS u server4.irc.net"putserv "STATS u server5.irc.net"putserv "STATS u server6.irc.net"}bind raw - 242 stats:raw:242proc stats:raw:242 {from keyword text} {   global server_stats   file delete uptimefile   set server_stats(text) "$from:[lindex [split [lrange $text 3 end] " "] 0]"        set fd [open "uptimefile" a]        puts $fd $server_stats(text)        close $fd}   unset -nocomplain server_stats(text)</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6110">tessa1</a> — Sun Sep 22, 2013 12:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2013-09-22T12:13:25-04:00</updated>

		<published>2013-09-22T12:13:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102056#p102056</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102056#p102056"/>
		<title type="html"><![CDATA[[Solved] Write multiple lines to file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102056#p102056"><![CDATA[
We know what happens if you use +w.   You get only the last one saved to the file.  That's because +w is re-writing the file.<br><br>Spike's solution does cure that.  However it creates a never ending file.<br><br>With your latest clarification, it sounds like you want both -  a new file every time, that contains all six lines.<br><br>Would the solution be:<br>Do what Spike said,  AND add a new line to your script.... one that deletes the old file, first?<br><br>Reference:<br><a href="http://www.tcl.tk/man/tcl8.5/TclCmd/file.htm#M12" class="postlink">http://www.tcl.tk/man/tcl8.5/TclCmd/file.htm#M12</a><br><div class="codebox"><p>Code: </p><pre><code>proc stats:raw:242 {from keyword text} {   global server_stats      file delete uptimefile     ....  rest of your script text here .....</code></pre></div>Something like that, anyway...<br><br><br>I hope this helps.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Sun Sep 22, 2013 12:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tessa1]]></name></author>
		<updated>2013-09-22T11:52:55-04:00</updated>

		<published>2013-09-22T11:52:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102055#p102055</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102055#p102055"/>
		<title type="html"><![CDATA[[Solved] Write multiple lines to file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102055#p102055"><![CDATA[
Spike, yes! I know that. But "a" doesn't overwrite the file like "w"<br>It adds a new line to this file. I need this file to read it out with php and publish it on our homepage.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6110">tessa1</a> — Sun Sep 22, 2013 11:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2013-09-22T09:58:17-04:00</updated>

		<published>2013-09-22T09:58:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102052#p102052</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102052#p102052"/>
		<title type="html"><![CDATA[[Solved] Write multiple lines to file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102052#p102052"><![CDATA[
try changing w+ to a...<br><div class="codebox"><p>Code: </p><pre><code>set fd [open "uptimefile" a]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Sun Sep 22, 2013 9:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tessa1]]></name></author>
		<updated>2013-09-22T14:12:38-04:00</updated>

		<published>2013-09-22T00:18:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102050#p102050</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102050#p102050"/>
		<title type="html"><![CDATA[[Solved] Write multiple lines to file.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102050#p102050"><![CDATA[
Hi <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>I want to write the stats data of all 6 servers into a file.<br><br>e.g:<br><br>server1.irc.net:1268<br>server2.irc.net:724<br>server3.irc.net:954<br>...<br> <br>But my script writes only the last server number six into the file. What can I do?<br><br>Here is my script:<div class="codebox"><p>Code: </p><pre><code>bind pub - !uptime stats:cmd:uptimeproc stats:cmd:uptime {nick uhost handle channel text} {global server_statsputserv "STATS u server1.irc.net"putserv "STATS u server2.irc.net"putserv "STATS u server3.irc.net"putserv "STATS u server4.irc.net"putserv "STATS u server5.irc.net"putserv "STATS u server6.irc.net"}bind raw - 242 stats:raw:242proc stats:raw:242 {from keyword text} {global server_statsset server_stats(text) "$from:[lindex [split [lrange $text 3 end] " "] 0]"        set fd [open "uptimefile" w+]        puts $fd $server_stats(text)        close $fd}unset -nocomplain server_stats(text)</code></pre></div>Thank you for help <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=6110">tessa1</a> — Sun Sep 22, 2013 12:18 am</p><hr />
]]></content>
	</entry>
	</feed>
