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

	<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>2007-02-28T09:21:27-04:00</updated>

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

		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-02-28T09:21:27-04:00</updated>

		<published>2007-02-28T09:21:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70829#p70829</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70829#p70829"/>
		<title type="html"><![CDATA[add up lines in txt and report total lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70829#p70829"><![CDATA[
The question about replacing spaces with dots, was answered in another thread, basically just use string map:<br><br>set myvar [string map {" " "."} $input]<br><br>As far as find the duration from a time stamp, take a look at the 'duration' command <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>  duration &lt;seconds&gt;<br>    Returns: the number of seconds converted into years, weeks, days, hours, minutes, and seconds. 804600 seconds is turned into 1 week 2 days 7 hours 30 minutes.<br>    Module: core<br><br>The following assumes you grabbed your previous timestamp already, in a var called '$then'<br><br>Get the current timestamp, <br><br>set now [unixtime]  <br><br>then subtract your previous timestamp, <br><br>set timesince [expr $now - $then] <br><br>and then use duration to check the time difference: <br><br>set duration [duration $timesince]<br><br>Or, in a one-liner:<br><br>set timesince [duration [expr $then - [unixtime]]]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Wed Feb 28, 2007 9:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[whittinghamj]]></name></author>
		<updated>2007-02-19T19:10:46-04:00</updated>

		<published>2007-02-19T19:10:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70558#p70558</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70558#p70558"/>
		<title type="html"><![CDATA[add up lines in txt and report total lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70558#p70558"><![CDATA[
thank you for the help - worked perfectly and I understand regarding the unixtime. I did some reading up at work today.<br><br>I have one other question.<br><br>I have the following code to record text from a channel and save it to a file. To record !command 's being used.<br><div class="codebox"><p>Code: </p><pre><code>proc add {nick uhost hand chan text} {        set database [open ${::db} a+]        set date [unixtime]        set command [lindex $text 0 end]        puts $database "$date $command"        close $database}</code></pre></div>The db file looks like<br><br>123431234 !command something was used<br><br>What I wanted to do was findout how to replace the spaces with a "  .  "<br><br>So instead of it being 1234566 one two three it would be<br>123456 one.two.three<br><br>the text on the channel has spaces but I need those spaces converting into periods for saving to the file.<br><br>Any help would be amazing.<br><br>Thanks<br><br>also - I store the time when the command was used. How would I go about checking the time passed since the unixtime time saved in the file to the present - eg 1week 2days 52 minutes ago t!command was used.<br><br>Any help please - cheers<br><br>Jamie aka Quest<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7783">whittinghamj</a> — Mon Feb 19, 2007 7:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-02-19T16:30:13-04:00</updated>

		<published>2007-02-19T16:30:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70551#p70551</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70551#p70551"/>
		<title type="html"><![CDATA[add up lines in txt and report total lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70551#p70551"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc getlines {nick uhost hand chan text} {        set file [open "YOURFILE" r]        set data [split [read $file] \n]        close $file        puthelp "PRIVMSG $chan :number of lines: [llength $data]"}</code></pre></div><div class="codebox"><p>Code: </p><pre><code>proc addtimestamp {nick uhost hand chan text} {       set file [open "YOURFILE" a]       set timestamp [clock format [clock seconds]]       set section [lindex $text 6]       puts $file "$timestamp $section"       close $file}</code></pre></div>Of course, the above addtimestamp thing doesn't do any kind of sanity checking on your input, nor does it do any security checking on who can run it (but you could just limit access with the bind for it..)  I made 2 seperate procs because your request was unclear, and it seemed like you wanted 1 proc for counting lines, and another for adding stuff to the file.<br><br>As far as how to use the stripcode command, you have to feed it strings, what are you trying to strip? Log files? Gnenerally,  you want to make a seperate binding to get the public messages and pass them through a proc with stripcodes, then write them out to a file (although, I'd probably cache the data in memory and use the various EVNT bindings to write the cache out before quit, rehash, etc. and maybe a timer to write the log periodically..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Mon Feb 19, 2007 4:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[whittinghamj]]></name></author>
		<updated>2007-02-19T02:30:15-04:00</updated>

		<published>2007-02-19T02:30:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70541#p70541</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70541#p70541"/>
		<title type="html"><![CDATA[add up lines in txt and report total lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70541#p70541"><![CDATA[
hi guys.<br><br>I been looking thro the forums and the archive but not sure what I would be looking for in the code.<br><br>I have a txt file with lets say 15 lines of info on it. I need a script that would open the file add the lines up close the file then report to the channel <br><br>&lt;bot&gt;There are 15 records in total<br><br>also i am stuck on how to stripcodes c<br><br>i have been going around and around in bllod circles for hours<br><br>here is what i am working with.<br><div class="codebox"><p>Code: </p><pre><code>proc add {nick uhost hand chan text} {        set database [open ${::db} a+]        set timestamp [clock format [clock seconds]]        set section [lindex $text 6]        puts $database "$timestamp $section"        close $database}[code]I know i have to change the line added to the database but not sure how.Any help would be great.CheersQuest</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7783">whittinghamj</a> — Mon Feb 19, 2007 2:30 am</p><hr />
]]></content>
	</entry>
	</feed>
