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

	<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-01-17T15:40:05-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Buffy_25]]></name></author>
		<updated>2004-01-17T15:40:05-04:00</updated>

		<published>2004-01-17T15:40:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=32608#p32608</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=32608#p32608"/>
		<title type="html"><![CDATA[Statistics from file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=32608#p32608"><![CDATA[
Thnx a lot!<br><br>Best regards,<br><br>Buffy<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4178">Buffy_25</a> — Sat Jan 17, 2004 3:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-11-27T13:57:10-04:00</updated>

		<published>2003-11-27T13:57:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30783#p30783</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30783#p30783"/>
		<title type="html"><![CDATA[Statistics from file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30783#p30783"><![CDATA[
Try this:<div class="codebox"><p>Code: </p><pre><code>proc sumStuff {file} {# open, read and close the file, split the returned data on line breaks and loop# through the returned list...foreach line [split [read [set f [open $file]]][close $f] \n] {# extract the name and online timeif {[scan $line {%s was online for %[^z]} name time]!=2} {continue;# ignore invalid/empty lines}# convert the duration to number of seconds ('clock scan' doesn't interpret # "d" and "h" as "day" and "hour", so this 'string map' is used to translate # your duration to something 'clock scan' can understand :)set time [clock scan [string map {"d " "day " "h " "hour "} $time] -base 0]if {[info exists names($name)]} {incr names($name) $time} {set names($name) $time}}array get names}</code></pre></div>You can loop through the returned list to display it or create an array or whatever you like. Eg:<div class="codebox"><p>Code: </p><pre><code>array set ftptime [sumStuff your_list.txt]</code></pre></div> (use 'duration' (provided by eggdrop) to format the seconds returned by my proc)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Nov 27, 2003 1:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Buffy_25]]></name></author>
		<updated>2003-11-25T18:15:21-04:00</updated>

		<published>2003-11-25T18:15:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30708#p30708</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30708#p30708"/>
		<title type="html"><![CDATA[Statistics from file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30708#p30708"><![CDATA[
I have already the following, BUT i'm stuck with the "string" part  <br><br>bind pub - "!Statistics_ftp" ftp:stat <br><br>proc ftp:stat {nick uhost hand chan arg} <br>set file [open ftpsuptime.txt r] <br>set buf [read $file] <br>set ftp [lindex [split [lindex [split $buf /n] 0] " "] 0] <br><br>This catches already the first ftp_name that is written in my file (this would be in my example "Master-ftp"). <br>But now i will need to see all the lines that contains "Master-ftp" and then i need to make the subtotal of all the times that is at the end of those lines. <br>Once that is done, i need to put that into a new variable : example ftptime($ftp) so that later on it can be showed in the room once all the ftp-names have been taken in charge (and time has been calculated).<br>And then i need to take the second ftp-name that appears in the file and make again for this one the subtotal time. <br>etc... <br><br>Can some1 help me a bit more with this plz? <br><br>Thnx.<br><br>Kindest regards,<br><br>Buffy<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4178">Buffy_25</a> — Tue Nov 25, 2003 6:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Buffy_25]]></name></author>
		<updated>2003-11-22T07:04:43-04:00</updated>

		<published>2003-11-22T07:04:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30508#p30508</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30508#p30508"/>
		<title type="html"><![CDATA[Statistics from file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30508#p30508"><![CDATA[
Hello all,<br><br>I have a question with the contents of a file:<br><br>I have my bot that write downs the following info into a file:<br>(the txt file contains the uptime of my ftp's in my channel)<br><br>&lt;ftpname&gt; was online for &lt;time d h m s&gt;<br><br>Those info lines are under each other in the txt file.<br>So for example:<br><br>Master-ftp was online for 10h 25min 12sec<br>Erlend was online for 12h 45min 32sec<br>Erick was online for 1day 13h 45min 3sec<br>Master-ftp was online for 2days 3h 12min 5sec<br>Bryan was online for 4d 5h 47min 3sec<br>Erlend was online for 2d 8h 8min 7sec<br>...<br><br>Now is my question:<br><br>I would like to have a script that react when i type in my #channel:<br><br>!Statistics_ftp<br><br>When i type this, then my bot will read the current txt file, with the current ftp's time in it and he will look for same ftp's name, he will take into account all those hours for that same ftpname, and he will make a totaltime of those times (ftp_totaltime) for example...<br>So i will have only each ftpname once in my channel written, with the total ftpuptime till now...<br><br>Can some1 help me with this plz?<br><br>Thnx a lot!<br><br>See u later.<br><br>Buffy<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4178">Buffy_25</a> — Sat Nov 22, 2003 7:04 am</p><hr />
]]></content>
	</entry>
	</feed>
