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

	<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-10-10T00:49:30-04:00</updated>

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

		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-10T00:49:30-04:00</updated>

		<published>2007-10-10T00:49:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76551#p76551</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76551#p76551"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76551#p76551"><![CDATA[
Thanks alot rosc, that helps much.<br> Thanks once again<br>iamdeath<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Wed Oct 10, 2007 12:49 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-10-09T14:32:04-04:00</updated>

		<published>2007-10-09T14:32:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76536#p76536</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76536#p76536"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76536#p76536"><![CDATA[
Clock scan is picky about the format you give it,  the manpage doesn't say it but the commas shown in the example formats are necessary.  EG: <span style="text-decoration:underline">day, dd monthname yy</span>  or <span style="text-decoration:underline">monthname dd ?, yy?</span><br><br>There's a little more detail here:<br><a href="http://forum.egghelp.org/viewtopic.php?p=67017#67017" class="postlink">http://forum.egghelp.org/viewtopic.php?p=67017#67017</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Tue Oct 09, 2007 2:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-09T10:29:57-04:00</updated>

		<published>2007-10-09T10:29:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76523#p76523</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76523#p76523"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76523#p76523"><![CDATA[
Thanks alot nml <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile"><br><br>The problem was coming because I was using lrange 3 end when 2 end was needed <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>Thanks alot soo much, you guys rock.<br>iamdeath<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Tue Oct 09, 2007 10:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-10-09T05:36:47-04:00</updated>

		<published>2007-10-09T05:36:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76516#p76516</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76516#p76516"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76516#p76516"><![CDATA[
Keep in mind that lrange returns a list, not a string..<br>Might want to join it into a string before trying to scan it.<div class="codebox"><p>Code: </p><pre><code>set then [clock scan [join [lrange [split $text] 3 end]]]</code></pre></div>The timestamp you mentioned should work just fine with "clock scan":<div class="codebox"><p>Code: </p><pre><code>[11:31] &gt; .tcl clock scan "Mar 07 21:22:37 2006 EST"[11:31] &lt; Tcl: 1141784557</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Oct 09, 2007 5:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-09T05:21:03-04:00</updated>

		<published>2007-10-09T05:21:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76515#p76515</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76515#p76515"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76515#p76515"><![CDATA[
<blockquote class="uncited"><div><blockquote class="uncited"><div>Time registered: Mar 07 21:22:37 2006 EST<br><br>If the format is like that, should'nt it work?</div></blockquote>Yes ( <a href="http://tcl.tk/man/tcl8.4/TclCmd/clock.htm#M45" class="postlink">http://tcl.tk/man/tcl8.4/TclCmd/clock.htm#M45</a> )</div></blockquote>Thanks alot but I did'nt get that.. Can you please be more specific <br><br>Thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Tue Oct 09, 2007 5:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2007-10-09T04:57:02-04:00</updated>

		<published>2007-10-09T04:57:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76514#p76514</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76514#p76514"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76514#p76514"><![CDATA[
<blockquote class="uncited"><div>Time registered: Mar 07 21:22:37 2006 EST<br><br>If the format is like that, should'nt it work?</div></blockquote>Yes ( <a href="http://tcl.tk/man/tcl8.4/TclCmd/clock.htm#M45" class="postlink">http://tcl.tk/man/tcl8.4/TclCmd/clock.htm#M45</a> )<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Tue Oct 09, 2007 4:57 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-09T04:51:07-04:00</updated>

		<published>2007-10-09T04:51:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76512#p76512</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76512#p76512"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76512#p76512"><![CDATA[
Time registered: Mar 07 21:22:37 2006 EST<br><br>If the format is like that, should'nt it work?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Tue Oct 09, 2007 4:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-09T03:34:55-04:00</updated>

		<published>2007-10-09T03:34:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76504#p76504</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76504#p76504"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76504#p76504"><![CDATA[
<blockquote class="uncited"><div>Usually you can set the time for "now" using the tcl 'clock' command, or the eggdrop strftime, ctime or unixtime commands, there's a few different ways to go about it, no real need to depend on chanserv to get it (although you might have to account for the different timezones between what your shell and [unixtime] and chanserv are using. <br><br>As far as how to keep the $then var across proc's, just declare it as a global var at the top of each proc that needs it.  <br><br>Anyway, the logic in your script won't set the vars properly.  <br><br>The errors you're getting is because this proc is being run for each and every notice the bot is receiving, so maybe nest all further processing under the 1st test for <em class="text-italics">if {[string match "*Time registered*" $text]} {</em><br><br>eg:<div class="codebox"><p>Code: </p><pre><code>proc notice-ignore {nick uhost hand text dest} {     if {[string match "*is not a valid nickname*" $text]} {return}     if {[string match "*Time registered*" $text]} {           set then [split $text]           set then [lrange $text 3 end]           set then [clock scan "$then"]           set now  [unixtime]           putlog "debug then '$then'"           putlog "debug now '$now'"           set secondsInADay 86400           set daysAgo [expr {($now-$then)/$secondsInADay}]           putlog "someone registered $daysAgo Days ago"     }}</code></pre></div>One last piece of advice - INDENT YOUR CODE =)<br>Makes it much easier to debug..</div></blockquote>Thank your very very much it solved the problem actually I was trying to help this user thought I would learn something out of it too and I did learn many things, thanks alot to all of you guys for your great support and patience to stand me <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> love you guys<br><br><a href="http://forum.egghelp.org/viewtopic.php?p=76503#76503" class="postlink">HELPED</a><br><br>Thanks once again<br>iamdeath<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Tue Oct 09, 2007 3:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-10-09T02:28:30-04:00</updated>

		<published>2007-10-09T02:28:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76500#p76500</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76500#p76500"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76500#p76500"><![CDATA[
Usually you can set the time for "now" using the tcl 'clock' command, or the eggdrop strftime, ctime or unixtime commands, there's a few different ways to go about it, no real need to depend on chanserv to get it (although you might have to account for the different timezones between what your shell and [unixtime] and chanserv are using. <br><br>As far as how to keep the $then var across proc's, just declare it as a global var at the top of each proc that needs it.  <br><br>Anyway, the logic in your script won't set the vars properly.  <br><br>The errors you're getting is because this proc is being run for each and every notice the bot is receiving, so maybe nest all further processing under the 1st test for <em class="text-italics">if {[string match "*Time registered*" $text]} {</em><br><br>eg:<div class="codebox"><p>Code: </p><pre><code>proc notice-ignore {nick uhost hand text dest} {     if {[string match "*is not a valid nickname*" $text]} {return}     if {[string match "*Time registered*" $text]} {           set then [split $text]           set then [lrange $text 3 end]           set then [clock scan "$then"]           set now  [unixtime]           putlog "debug then '$then'"           putlog "debug now '$now'"           set secondsInADay 86400           set daysAgo [expr {($now-$then)/$secondsInADay}]           putlog "someone registered $daysAgo Days ago"     }}</code></pre></div>One last piece of advice - INDENT YOUR CODE =)<br>Makes it much easier to debug..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Tue Oct 09, 2007 2:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-09T02:24:43-04:00</updated>

		<published>2007-10-09T02:24:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76499#p76499</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76499#p76499"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76499#p76499"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>### Eventbind join - "#Islamabad *!*@*" join-ignorebind notc - "*is not a valid nickname*" notice-ignorebind notc - "*Time registered*" notice-ignorebind notc - "*Time now*" notice-ignore1### Commandproc join-ignore {nick uhost handle chan} {  putquick "PRIVMSG nickserv@services.dal.net :info $nick"}proc notice-ignore {nick uhost hand text dest} {global thenset then [split $text]set then [lrange $text 3 end]set then [clock scan "$then"]putlog "$then"}proc notice-ignore1 {nick uhost hand text dest} {global now thenset now [split $text]set now [lrange $text 3 end]set now [clock scan "$now"]set secondsInADay 86400set daysAgo [expr {($now-$then)/$secondsInADay}]putlog "$daysAgo Days ago"putlog "$now"}putlog "Nickname ignore tcl Loaded!"</code></pre></div>That works fine <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Tue Oct 09, 2007 2:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-09T01:45:45-04:00</updated>

		<published>2007-10-09T01:45:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76498#p76498</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76498#p76498"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76498#p76498"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>### Eventbind join - "#Islamabad *!*@*" join-ignorebind notc - "*is not a valid nickname*" notice-ignorebind notc - "*Time registered*" notice-ignorebind notc - "*Time now*" notice-ignore### Commandproc join-ignore {nick uhost handle chan} {  putquick "PRIVMSG nickserv@services.dal.net :info $nick"}proc notice-ignore {nick uhost hand text dest} {if {[string match "*is not a valid nickname*" $text]} {return}if {[string match "*Time registered*" $text]} {set then [split $text]set then [lrange $text 3 end]set then [clock scan "$then"]if {[string match "*Time now*" $text]} {set now [split $text]set now [lrange $text 3 end]set now [clock scan "$now"]set secondsInADay 86400set daysAgo [expr {($now-$then)/$secondsInADay}]putlog "$daysAgo Days ago"}}}putlog "Nickname ignore tcl Loaded!"</code></pre></div>I even tried that its not working <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Tue Oct 09, 2007 1:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-09T01:17:16-04:00</updated>

		<published>2007-10-09T01:17:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76495#p76495</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76495#p76495"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76495#p76495"><![CDATA[
Thanks rosc actually the script works well when I give it<br><div class="codebox"><p>Code: </p><pre><code>set then [clock scan "Thu 23-Sep-2004 01:00:59 UTC"] set now  [clock scan "Fri 05-Oct-2007 09:31:06 UTC"] set secondsInADay 86400 set daysAgo [expr {($now-$then)/$secondsInADay}]</code></pre></div>but the problem is the date always has to get changed for ever user so  iused $text and $now instead of any specific date. But it;'s not recognizing that variable I wonder why<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Tue Oct 09, 2007 1:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-10-08T16:59:58-04:00</updated>

		<published>2007-10-08T16:59:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76489#p76489</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76489#p76489"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76489#p76489"><![CDATA[
Take a look here: <a href="http://members.dandy.net/~fbn/date.2.tcl.txt" class="postlink">http://members.dandy.net/~fbn/date.2.tcl.txt</a><br><br>Use that for examples of doing time calculations if you like.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Mon Oct 08, 2007 4:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iamdeath]]></name></author>
		<updated>2007-10-07T14:36:39-04:00</updated>

		<published>2007-10-07T14:36:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76458#p76458</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76458#p76458"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76458#p76458"><![CDATA[
Ive tried all the possible ways it's too much for me sorry for bothering you. I just cant solve it on my own<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5982">iamdeath</a> — Sun Oct 07, 2007 2:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-10-07T07:34:31-04:00</updated>

		<published>2007-10-07T07:34:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76447#p76447</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76447#p76447"/>
		<title type="html"><![CDATA[calculating days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76447#p76447"><![CDATA[
One way would be to use global variables, with proper cleanup inbetween requests...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Oct 07, 2007 7:34 am</p><hr />
]]></content>
	</entry>
	</feed>
