mIRC Home    About    Download    Register    News    Help

Topic Options
#62109 - 28/11/03 07:55 AM User stats
Insanatic Offline
Pikka bird

Registered: 03/10/03
Posts: 18
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

Top
#62110 - 28/11/03 07:59 AM Re: User stats
Collective Offline
Planetary brain

Registered: 10/12/02
Posts: 3138
Loc: London, UK
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


Edited by Collective (28/11/03 08:01 AM)

Top
#62111 - 28/11/03 08:07 AM Re: User stats
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
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
_________________________
-KingTomato

Top
#62112 - 28/11/03 08:14 AM Re: User stats
Insanatic Offline
Pikka bird

Registered: 03/10/03
Posts: 18
Ok thank you both!
Thanks,
Baden.

Top
#62113 - 28/11/03 08:21 AM Re: User stats
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
Read the ammendment if you are using mine >:P
_________________________
-KingTomato

Top
#62114 - 28/11/03 01:30 PM Re: User stats
LocutusofBorg Offline
Hoopy frood

Registered: 23/03/03
Posts: 1271
Loc: Sunnydale, CA
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.
_________________________
DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius

Top
#62115 - 28/11/03 02:55 PM Re: User stats
Insanatic Offline
Pikka bird

Registered: 03/10/03
Posts: 18
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?

Top
#62116 - 28/11/03 08:58 PM Re: User stats
Canario Offline
Babel fish

Registered: 13/11/03
Posts: 67
Loc: Buenos Aires, Argentina
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.
_________________________
irc.universochat.net
#escripting

Top