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

	<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-09-13T00:18:42-04:00</updated>

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

		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2007-09-12T22:58:21-04:00</updated>

		<published>2007-09-12T22:58:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75906#p75906</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75906#p75906"/>
		<title type="html"><![CDATA[Word Count/ Stats [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75906#p75906"><![CDATA[
Ok I feel like a dummy now lol, after hours of searching I realized there is a new version just not listed here in TCL Archives  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Wed Sep 12, 2007 10:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-09-12T20:12:16-04:00</updated>

		<published>2007-09-12T20:12:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75902#p75902</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75902#p75902"/>
		<title type="html"><![CDATA[Word Count/ Stats [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75902#p75902"><![CDATA[
There are numerous procs within that script that try to use the variable "lines" before it has been initialized (given a value). Unfortunately, sorting out those issues might not be trivial, as you'd have to thurroghly study the script and "get inside" the authors mind.<br><br>Most likely tho, he is trying to use lines as a global or namespace variable, but failed to access it as such...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Sep 12, 2007 8:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2007-09-12T19:47:02-04:00</updated>

		<published>2007-09-12T19:47:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75901#p75901</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75901#p75901"/>
		<title type="html"><![CDATA[Word Count/ Stats [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75901#p75901"><![CDATA[
Can anyone help me by pointing out what I need to look at? Been trying my hardest lol.<br><br>I load that script then soon as bot joins room it displays this error:<div class="codebox"><p>Code: </p><pre><code>[19:41] Tcl error [::statistics::monitor]: can't read "lines": no such variable[19:41] Tcl error [::statistics::monitor]: can't read "lines": no such variable[19:41] Tcl error [::statistics::monitor]: can't read "lines": no such variable</code></pre></div> <br>Three times in a row, it does keep count and write to file just fine.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":?" title="Confused"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Wed Sep 12, 2007 7:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2007-09-12T09:52:34-04:00</updated>

		<published>2007-09-12T09:52:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75888#p75888</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75888#p75888"/>
		<title type="html"><![CDATA[Word Count/ Stats [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75888#p75888"><![CDATA[
I found one to suit my needs but there is a problem...<br><br>It works and saves data, but if I restart bot it stops working till user re-joins channel by typing /hop<br><br>This is error I get after I restart bot and type $stats<br>[09:44] Tcl error [::statistics::monitor]: can't read "lines": no such variable.<br><br>And this is error I get when I type $top10<br>[09:46] Tcl error [::statistics::toplist]: element 1 missing from sublist " 1"<br><br>Is this normal?<br><br>Here is the script:<div class="codebox"><p>Code: </p><pre><code># Statistics.tcl (C) 2004 perpleXa#  type ".chanset &lt;chan&gt; +stat" on the partyline to ativate the script for a specific channel.#  commands: $stat &lt;nick&gt; - shows information about you or a nick. (works only for other nicks when you are op on a channel)#            $top10 &lt;smilies|words|lines|letters&gt; - shows the top10 chatters, default option is words#            $top20 &lt;smilies|words|lines|letters&gt; - same as $top10 but with places 11-20namespace eval statistics {# Storage file  variable storage {scripts/dbase/statistics}# Kill unused entries after x days  variable killafter 30# Command trigger  variable trigger {$}# smiley regex (only touch this, if you really know, what you are doing!)  variable smileyregex {(:|8|;)(-|o)?(&gt;|&lt;|D|O|o|\)|\(|\]|\[|P|p|\||\\|/)}  bind PUB   -|-  ${trigger}stat   [namespace current]::spew  bind PUB   -|-  ${trigger}top10  [namespace current]::toplist  bind PUB   -|-  ${trigger}top20  [namespace current]::toplist  bind PUBM  -|-  *                [namespace current]::monitor  bind CTCP  -|-  ACTION           [namespace current]::ctcp  bind EVNT  -|-  save             [namespace current]::save  bind TIME  -|-  {00 * * * *}     [namespace current]::cleanupdb  setudef flag stat  namespace export spew top10 toplist save load monitor}proc statistics::ctcp {nickname hostname handle target keyword arguments} {  if {[validchan $target]} {    monitor $nickname $hostname $handle $target $arguments  }  return 0}proc statistics::monitor {nickname hostname handle channel arguments} {  variable data  variable smileyregex  if {([isbotnick $nickname]) || (![channel get $channel stat])} {    return 0  }  set hostname [maskhost *!$hostname]  regsub -all -- {\002|\003[\d]{0,2}(,[\d]{0,2})?|\006|\007|\017|\026|\037|\n|\t} $arguments {} arguments  set added(words) [regexp -all -- {\S+} $arguments]  set added(letters) [regexp -all -- {\S} $arguments]  if {[string length $smileyregex] &gt;= 1} {    set added(smilies) [regexp -all -- $smileyregex $arguments]  } else {    set added(smilies) 0  }  if {(![info exists data($channel,$hostname)])} {    set data($channel,$hostname) "0 0 0 0 0 NULL"  }  regexp -- {^(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\S+)$} $data($channel,$hostname) -&gt; lastseen lines words letters smilies lastnick  incr lines 1  incr words $added(words)  incr letters $added(letters)  incr smilies $added(smilies)  set data($channel,$hostname) "[unixtime] $lines $words $letters $smilies $nickname"}proc statistics::spew {nickname hostname handle channel arguments} {  variable data  if {(![channel get $channel stat])} {    return 0  }  if {([isop $nickname $channel]) &amp;&amp; ([string length $arguments] &gt;= 1)} {    set target [lindex [clean $arguments] 0]  } else {    set target $nickname  }  if {![onchan $target $channel]} {    putserv "PRIVMSG $channel :\[Statistics - Unknown user \002$target\002\]"    return 0  }  set targethost [maskhost *![getchanhost $target $channel]]  if {[info exists data($channel,$targethost)]} {    regexp -- {^(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\S+)$} $data($channel,$targethost) -&gt; lastseen lines words letters smilies lastnick    set wpl [round [expr ($words / $lines.)]]    set spl [round [expr ($smilies / $lines.)]]    set lpw [round [expr ($letters / $words.)]]    putserv "PRIVMSG $channel :\[Statistics - \002$target\002 has written \002$lines\002 lines, \002$words\002 ($wpl per line) words and \002$letters\002 ($lpw per word) letters, containing \002$smilies\002 ($spl per line) smilies\]"  } else {    putserv "PRIVMSG $channel :\[Statistics - No valuable information available for \002$target\002\]"  }}proc statistics::top {channel number {type ""}} {  variable data  set statistics {}  switch $type {    {lines} {set index 1}    {letters} {set index 3}    {smilies} {set index 4}    {default} {set index 2 ; set type "words"}  }  foreach {user stats} [array get data $channel,*] {    set stats [clean $stats]    lappend statistics "[lindex [clean $stats] 5] [lindex $stats $index]"  }  set statistics [lrange [lsort -integer -decreasing -index 1 [lsort -unique -index 0 [lsort -integer -increasing -index 1 $statistics]]] [expr $number - 10] [expr $number - 1]]  if {$statistics == ""} {    return "\[Top$number $type - No valuable information available for \002$channel\002\]"  }  set output "\[Top$number $type -"  for {set i 0} {$i &lt; [llength $statistics]} {incr i 1} {    set item [lindex $statistics $i]    append output "\x20[expr $i+$number-9]: \002[join [lindex [clean $item] 0] { }]\002 ([lindex $item 1])"  }  append output "\]"  return $output}proc statistics::toplist {nickname hostname handle channel arguments} {  global lastbind  if {(![channel get $channel stat])} {    return 0  }  set arguments [clean $arguments]  set key [lindex $arguments 0]  if {![regexp -- {^.*?([0-9]+)$} $lastbind -&gt; number]} {    return 0  }  if {![regexp -nocase -- {^(words|letters|smilies|lines|)$} $key]} {    putserv "PRIVMSG $channel :\[Statistics - Unknown option: \002$key\002, valid options are \002letters\002, \002lines\002, \002smilies\002 and \002words\002\]"    return 0  }  putserv "PRIVMSG $channel :[top $channel $number [string tolower $key]]"}proc statistics::cleanupdb {args} {  variable killafter  variable data  set killed 0  foreach {item} [array names data] {    set lastseen [lindex [clean $data($item)] 0]    set expire [expr 60 * 60 * 24 * $killafter]    if {[expr [unixtime] - $lastseen] &gt;= $expire} {      incr killed      unset data($item)    }  }  return $killed}proc statistics::load {} {  variable data  variable storage  regexp -- {^(\S+/)?.*$} $storage -&gt; directory  if {[string length $directory] &gt;= 1} {    if {![file isdirectory $directory]} {      file mkdir $directory    }  }  if {![file exists $storage]} {    return 0  }  if {[array exists data]} {    array unset data  }  set file [open $storage r]  while {![eof $file]} {    gets $file line    if {[regexp -nocase -- {^channel:(\S+)\sid:(\S+)\svalue:(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\S+)$} $line -&gt; channel hostname lastseen lines words letters smilies lastnick]} {      set data($channel,$hostname) "$lastseen $lines $words $letters $smilies $lastnick"    }  }  close $file}proc statistics::save {args} {  variable data  variable storage  set file [open $storage w]  foreach chan_user [array names data] {    regexp {^(\S+),(\S+)$} $chan_user -&gt; channel user    puts $file "channel:$channel id:$user value:$data($chan_user)"  }  close $file}proc statistics::clean {i} {  regsub -all -- \\\\ $i \\\\\\\\ i  regsub -all -- \\\[ $i \\\\\[ i  regsub -all -- \\\] $i \\\\\] i  regsub -all -- \\\} $i \\\\\} i  regsub -all -- \\\{ $i \\\\\{ i  return $i}proc statistics::round {num} {  if {![string match "*.*" $num]} {    return $num\.0  }  if {![regexp -- {^(\d+?)\.(\d+)$} $num -&gt; primary secondary]} {    error "syntax error in expression '$num'"  }  set secondary [expr round([string index $secondary 0].[string range $secondary 1 end])]  return [expr {($secondary == 10) ? ($primary+1.0) : "$primary.$secondary"}]}statistics::loadputlog "Script loaded: Statistics by perpleXa"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Wed Sep 12, 2007 9:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2007-09-12T08:59:50-04:00</updated>

		<published>2007-09-12T08:59:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75882#p75882</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75882#p75882"/>
		<title type="html"><![CDATA[Word Count/ Stats [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75882#p75882"><![CDATA[
Ok thanks, I will try my search again.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Wed Sep 12, 2007 8:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2007-09-12T08:45:00-04:00</updated>

		<published>2007-09-12T08:45:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75881#p75881</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75881#p75881"/>
		<title type="html"><![CDATA[Re: Word Count/ Stats]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75881#p75881"><![CDATA[
I think the <a href="http://www.kreativrauschen.de/stats.mod/" class="postlink">stats module</a> dose this and, there might be a few scripts that do this in the <a href="http://www.egghelp.org/tclhtml/3478-4-0-0-1-stats.htm" class="postlink">TCL Archive</a>.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Wed Sep 12, 2007 8:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2007-09-13T00:18:42-04:00</updated>

		<published>2007-09-12T02:04:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75874#p75874</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75874#p75874"/>
		<title type="html"><![CDATA[Word Count/ Stats [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75874#p75874"><![CDATA[
I saw someone have this on mIRC just thought it be cool to have it on eggdrop, so if anyone can do this i'd be thankful  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <br><br>Here is what it does.<br><br>Word Count: Keeps track of how many words a chatter typed<br>Letter Count: Keeps track of how many letters chatter typed<br>Smile Count: Keeps track of how many smiles <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile"> chatter used<br>Time Wasted: How long they have wasted sitting in chat (chatting or idle together)<br><br>Sample of it used...<br>&lt;Chatter&gt; !mystats<br>&lt;Bot&gt; [STATS] Chatter: 4135 words, 15222 letters, 80 smilies, time wasted: 315 hours 22 minutes 49 seconds.<br><br>And the "word count" part comes with !top10stats showing the top 10 chatters word count score.<br><br> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_question.gif" width="15" height="15" alt=":?:" title="Question"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Wed Sep 12, 2007 2:04 am</p><hr />
]]></content>
	</entry>
	</feed>
