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

	<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-08-06T07:19:09-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-05-17T05:40:43-04:00</updated>

		<published>2013-05-17T05:40:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101559#p101559</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101559#p101559"/>
		<title type="html"><![CDATA[Timespent Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101559#p101559"><![CDATA[
That is only the first version i know it can be improved but why improve something if its not constantly used. Maybe for sure thats the reason i didnt updated the script.<br><br>And exclude the bot from the list i would have done something like this<div class="codebox"><p>Code: </p><pre><code>if {![isbotnick $var]} { .. }</code></pre></div>and for the n|N flags at the !timespent command i didnt used the flags there because i used switch in that proc and i have more than 1 command in there so i could easy add a command for another flag and the list can continue<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Fri May 17, 2013 5:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2013-05-17T03:30:40-04:00</updated>

		<published>2013-05-17T03:30:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101556#p101556</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101556#p101556"/>
		<title type="html"><![CDATA[Timespent Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101556#p101556"><![CDATA[
Shouldn't you should exclude the bot from adding itself to the list? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>The easiest way to do this would be with replacing:<div class="codebox"><p>Code: </p><pre><code>foreach u [chanlist $chan] { </code></pre></div>with this:<div class="codebox"><p>Code: </p><pre><code>set userlist [lreplace [chanlist $chan] 0 0]foreach u $userlist {</code></pre></div>The time bind you got it's triggered every minute so it's a waste of resources when you could easily integrate the 1 hour check directly in the bind:<div class="codebox"><p>Code: </p><pre><code>bind time {?0 *} gghelp:timespent</code></pre></div>You have the <em class="text-italics">timespent:save</em> function called in like 3 places in the <em class="text-italics">egghelp:timespent</em> proc, why not have it just once?<br><br>In the <em class="text-italics">timespent:pub</em> proc why do you use <em class="text-italics">matchattr</em> to check user flags when you can bind the pub command directly in the bind line?<div class="codebox"><p>Code: </p><pre><code>bind PUB n|N !timespent timespent:pub</code></pre></div>or whatever..<br><br>I see you using <em class="text-italics">[split $arg]</em> for like 7 times in <em class="text-italics">timespent:pub</em>. Why don't you split it just once and use it from there on with just $arg?<br><br>If you want to keep track of since the user joined the channel, why don't you just use <em class="text-italics">getchanjoin</em> instead? The time bind would be triggered every 1 hour (or whatever) and get the info from there and announce the list. Seems more easier than keeping a list in memory, a list that has to be cleaned once the bot itself would quit, part, split, die, whatever.<br><br>Here's what I meant by that:<div class="codebox"><p>Code: </p><pre><code>bind time {?0 *} announce:timespentproc announce:timespent {min hour day month year} {foreach chan [channels] {      if {![channel get $chan timespent]} continueset userlist [lreplace [chanlist $chan] 0 0]foreach user $userlist {set timestamp [getchanjoin $user $chan]if {[expr [unixtime] - $timestamp] &lt; 3600} continuelappend list "$user $timestamp"}set list [lsort -integer -index 1 $list]foreach ele $list {lappend users [lindex [split $ele] 0]}if {![info exists $users]} continueputhelp "PRIVMSG $chan :Users who spent more than 1 hour on $chan are:"while {[llength $users] != 0} {puthelp "PRIVMSG $chan :[join [lrange $users 0 14] ", "]"set users [lrange $users 15 end]}}}</code></pre></div>I've tested it in my head but not on an eggdrop.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri May 17, 2013 3:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-05-16T18:14:12-04:00</updated>

		<published>2013-05-16T18:14:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101555#p101555</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101555#p101555"/>
		<title type="html"><![CDATA[Timespent Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101555#p101555"><![CDATA[
This is how the script works now.<br>The eggdrop is counting (minute by minute) if the user is on the channel and writes the users with their idle time in a file (so it wont be lost)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Thu May 16, 2013 6:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[x0x]]></name></author>
		<updated>2013-05-16T18:12:43-04:00</updated>

		<published>2013-05-16T18:12:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101554#p101554</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101554#p101554"/>
		<title type="html"><![CDATA[Timespent Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101554#p101554"><![CDATA[
Would it be possible to write to a file and keep a record of a nicknames and their total time? So count when they are on and continue counting when they return after a quit or netsplit?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10486">x0x</a> — Thu May 16, 2013 6:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-05-16T17:50:31-04:00</updated>

		<published>2013-05-16T17:50:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101553#p101553</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101553#p101553"/>
		<title type="html"><![CDATA[Timespent Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101553#p101553"><![CDATA[
It only keeps track if the user is seen in the channel<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Thu May 16, 2013 5:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[x0x]]></name></author>
		<updated>2013-05-16T17:37:35-04:00</updated>

		<published>2013-05-16T17:37:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101552#p101552</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101552#p101552"/>
		<title type="html"><![CDATA[Timespent Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101552#p101552"><![CDATA[
Does it keep track of people even after they part/quit/split?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10486">x0x</a> — Thu May 16, 2013 5:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-08-06T07:19:09-04:00</updated>

		<published>2013-01-28T18:11:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100816#p100816</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100816#p100816"/>
		<title type="html"><![CDATA[Timespent Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100816#p100816"><![CDATA[
For any ideas for improving the code <br>For any bugs or questions please post here<br><div class="codebox"><p>Code: </p><pre><code>#### ++++ Author: MadaliN &lt;madalinmen28@yahoo.com&gt; ### +++ Website: www.Ascenture.ro## +++ TCL Name: Timespent # +++ Version: 1.0## Commands: #   !timespent activate         (local or global owner) #   !timespent deactivate         (local or global owner) #   !timespent &lt;$nickname&gt; &lt;$chan&gt;      (local or global owner) # #### # +++ Created: 1/26/2013 #### bind TIME - * egghelp:timespent bind PUB - !timespent timespent:pub set announce(time) "1" ;#setting is in hours setudef flag timespent proc egghelp:timespent {min hour day month year} {    global timespent announce noa    set list ""    foreach chan [channels] {       if {[channel get $chan timespent]} {          foreach u [chanlist $chan] {             set host [lindex [split [getchanhost $u $chan] @] 1]             if {![info exists timespent($chan,$host)]} {                set timespent($chan,$host) "60 $u"                timespent:save             } else {                set timespent($chan,$host) "[expr [lindex [split $timespent($chan,$host)] 0] + 60] $u"                timespent:save                if {$announce(time) != ""} {                   if {[lindex [split $timespent($chan,$host)] 0] &gt; [expr $announce(time) * 3600]} {                      if {![info exists noa($chan,$host)]} {                         set noa($chan,$host) "[unixtime]"                         timespent:save                         lappend list "\00303[lindex [split $timespent($chan,$host)] 1]\003"                      }                   }                }             }          }          if {$list != ""} {             putserv "PRIVMSG $chan :Users who spent more than \00312$announce(time)\003 hour on \00304$chan\003 are: [join $list "\002,\002 "]"         }       }    } } proc timespent:pub {nick uhost hand chan arg} {    global timespent    set host [lindex [split [getchanhost [lindex [split $arg] 0] $chan] @] 1]    switch -exact -- [lindex [split $arg] 0] {       activate {          if {[matchattr $hand n] || [matchattr $hand |N $chan]} {             channel set $chan +timespent             putserv "PRIVMSG $chan :\002$nick\002 - TIMESPENT script \00312activated\003 succesfully"          }       }       deactivate {          if {[matchattr $hand n] || [matchattr $hand |N $chan]} {             channel set $chan -timespent             putserv "PRIVMSG $chan :\002$nick\002 - TIMESPENT script \00304deactivated\003 succesfully"          }       }       default {          if {[matchattr $hand n] || [matchattr $hand |N $chan]} {             if {[string match -nocase "#*" [lindex [split $arg] 1]]} {                if {![info exists timespent([lindex [split $arg] 1],$host)]} {                   putserv "PRIVMSG $chan :\002$nick\002 - Nickname \00303[lindex [split $arg] 0]\003 has no info on \00312[lindex [split $arg] 1]"               } else {                   putserv "PRIVMSG $chan :\002$nick\002 - Nickname \00303[lindex [split $arg] 0]\003 idled on \00312[lindex [split $arg] 1]\003 for \00303[duration [lindex [split $timespent([lindex [split $arg] 1],$host)] 0]]"                }             } else {                if {![info exists timespent($chan,$host)]} {                   putserv "PRIVMSG $chan :\002$nick\002 - Nickname \00303[lindex [split $arg] 0]\003 has no info on this channel"                } else {                   putserv "PRIVMSG $chan :\002$nick\002 - Nickname \00303[lindex [split $arg] 0]\003 idled on \00312$chan\003 for \00303[duration [lindex [split $timespent($chan,$host)] 0]]"                }             }          }       }    } } proc timespent:save {} {    global timespent    set ofile [open timespent w]    puts $ofile "array set timespent [list [array get timespent]]"    close $ofile } catch {source timespent} putlog "+++ Succesfully loaded: \00312Timpespent TCL Script" </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Mon Jan 28, 2013 6:11 pm</p><hr />
]]></content>
	</entry>
	</feed>
