mIRC Homepage
Posted By: Insanatic User stats - 28/11/03 07:55 AM
i know its possbile to count all messages, words and characters i have seen, but is it possible to count how many each user has said?

i am currently using this as the counters:

on *:TEXT:*:*:{
/inc %count.msgs
/inc %count.words $0
/inc %count.chars $len($1-)
}
-Baden
Posted By: Collective Re: User stats - 28/11/03 07:59 AM
Code:
on *:TEXT:*:*:{
  inc %count.msgs
  inc %count.words $0
  inc %count.chars $len($1-)
  inc %count.msgs. $+ $nick
  inc %count.words. $+ $nick $0
  inc %count.chars. $+ $nick $len($1-)
}


Edit: Typo
Posted By: KingTomato Re: User stats - 28/11/03 08:07 AM
Code:
on *:TEXT:*:#: {
  /stats -i:msgs $nick
  /stats -i:words $nick $0
  /stats -i:chars $nick $len($1-)
}

alias stats {
  if (-i:* iswm $1) {
    var %thing = $gettok($1, 2, $asc(:)), %nick = $2, %value = $iif($3, $3, 1)
    /inc % [ $+ [ %thing ] $+ [color:blue]] . [ $+[/color] [ %nick ] ] %value
  }
  else if ($prop) {
    var %nick == $2
    if (($prop == msgs) || ($prop == messages)) return %msgs. [ $+ [ %nick ] ]
    else if ($prop == words) return %words. [ $+ [ %nick ] ]
    else if ($prop == chars) return %chars. [ $+ [ %nick ] ]
    else return Invalid Property
  }
  else /echo -s /stats: Insufficient Parameters (/stats [-i:property] <Name> [value])
}

*Untested*

This should work just like yours, then to recal the values use:

$stats(name).msgs ( or $stats(name).messages )
$stats(name).words
$stats(name).chars

EDIT: Sorry, i found an error. It highlighted in blue in the code, if you just want to change it. Either that, or just re-copy it
Posted By: Insanatic Re: User stats - 28/11/03 08:14 AM
Ok thank you both!
Thanks,
Baden.
Posted By: KingTomato Re: User stats - 28/11/03 08:21 AM
Read the ammendment if you are using mine >:P
Posted By: LocutusofBorg Re: User stats - 28/11/03 01:30 PM
Just a FYI -- if you are seriously counting all the words, letters and lines said by every single user you encounter, I would urge you to use a hastbale. Or three actually, one for words, one for letters and one for lines.
Posted By: Insanatic Re: User stats - 28/11/03 02:55 PM
Are hash tables easy to retreive and stall information?
Also, King Tomato i tried your code with the corrections but it did not work.
Is it possible to create an .ini file and create a [SECTION] for each user and then add the amount of words, characters to it by using the /writeini commands? or can't they be added up?
Posted By: Canario Re: User stats - 28/11/03 08:58 PM
iniĀ“s are very slow to do that. Try hashtables and see what simply are. You can see hashtable tutorial in www.helpdesk.zaz.net. See the globby log.
© mIRC Discussion Forums