Skip to content
General Chat Talk

Room Stats Code

A TG007 community discussion started by Bloodyboss.

Discussion 12 posts
Page 1 of 1
Open
Topic #13826 · 12 published posts · 3,589 views

I want this code to put it in my script

[14:00] <~TG007_Bot> Room Stats generation for #TG007 has begun

[14:01] <~TG007_Bot> QuickStats by mIRCStats - Today's top talkers: IP__`: 2 lines

hey there mate,

 

Thought I'd post something here to help you on the way... I wouldn't know the exact code they use... but I have an idea on what you could use to get you started...

 

Basically its an on TEXT event, which would record and store data of each nickname which posts a message to the channel..

 

You could use variables or an .ini file, or even better still hash tables which I'm a bit of a fan of.. However for this purpose I'll just use .ini to show an example, you can edit however you like..

 

on !:TEXT:*:#:{
  var %n = $nick, %c = $chan, %x = $readini(chanlog.ini,%c,%n), %v = $gettok(%log. [ $+ %c],1,32)
  inc %x
  writeini -n chanlog.ini %c %n %x
  if (%x < %v) return
  else { set %log. [ $+ %c ] $iif(%x == %v,%log. [ $+ %c ],$iif(%x > %v,%x)) %n }
}
/*
Note: "on !:TEXT" means, whoever writes something to the channel except for you!
Note: The "-n" flag in /writeini, means it will attempt to write to the .ini file if it is bigger than 64k
*/

 

Thats a simple code to log the data...

Then to show the data could be something like...

 

on *:TEXT:@stat:#:{
if (!%log. [ $+ [ $chan ] ]) msg # No data is stored for this Channel.
else msg # Top Talker in this Channel $gettok(%log. [ $+ [ # ] ],2,32) with $gettok(%log. [ $+ [ # ] ],1,32) Lines!
}

/*
Note: With this on TEXT event, anyone could use this command by typing @stat, so either add a user level or something along the lines of that... 
*/

 

Just an idea of the code... I'm sure there's plenty of ways to do this, and you can add, edit this to suit your needs now =)

 

Kind Regards,

Daniel

Edited Jan 12, 2010 1:53 PM by Dan*

Thank you danial it is very helpful and simple , ty for ur effort

 

hope for many ccomplicated ideas :D

 

where are your ideas err0r !! :$

Note: "on !:TEXT" means, whoever writes something to the channel except for you!
It's impossible to trigger your own text, thus the ! prefix by the text event is not necessary.
Edited Jan 12, 2010 9:05 PM by Fanfare

Hahah, thanks fanfare =)

 

Didnt realise it until you mentioned it, the ! prefix would be be4tter for like on JOIN events and others haha :) Cheers buddy :)

 

Kind Regards,

Daniel

ooo, Also realised there were a few bugs in this code... Heres the new code which straightens out some of the bugs...

 

/*
Bug Fixes Include:
- If local variable = $null, set it as 0...
- Added evaluation tags in the logging process, as it will evaluate the local variable %c now!
- Added support for multiple people to be the top talkers.. So if Daniel and James have both the highest lines, will now say " Daniel & James"

NOTE: @stat command is available to anyone, I'd strongly recommend you changing this to only allow a user level nickname...

*/

on *:TEXT:*:#:{
if ($1 == @stat) {
  if (!%log. [ $+ [ # ] ]) msg # No data is stored for this Channel.
  else msg # Top Talker in this Channel $replace($gettok(%log. [ $+ [ # ] ],2-,32),$chr(32),$+($chr(32),$chr(38),$chr(32))) with $gettok(%log. [ $+ [ # ] ],1,32) Lines!
}
else {
  var %n = $nick, %c = $chan, %x = $readini(chanlog.ini,%c,%n), %v = $iif(%log. [ $+ [ %c ] ],$gettok(%log. [ $+ [ %c ] ],1,32),0)
  inc %x
   writeini -n chanlog.ini %c %n %x
  if (%x < %v) return
  set %log. [ $+ [ %c ] ] $iif(%x == %v,%log. [ $+ [ %c ] ],$iif(%x > %v,%x)) %n
}
}

 

Hope this helps...

 

Kind Regards,

Daniel

Edited Jan 13, 2010 9:35 AM by Dan*

What you see there Bloodyboss is from here

 

 

http://www.nic.fi/~mauvinen/mircstats/

______________________________________________________

T.ogether
E.veryone
A.chieves
M.ore


 

 

coderirclogo.png.8580c336378f27471a13a95ffd242c9d (1).png

Has the Chevy Vortec looking heads, and Ford style exhaust manifolds :P Very nice setup though lol

Thanks Chain for the link.

 

Thanks chain for the handy link :)

 

Kind Regards,

Daniel

Pleasure thats what we do here help each other :yes:

______________________________________________________

T.ogether
E.veryone
A.chieves
M.ore


 

 

coderirclogo.png.8580c336378f27471a13a95ffd242c9d (1).png

yes what chain posted is what we use.. sorry i'm working on a project that has all my attention atm.. follow the instructions on that page and it will work fine. If u decide to use it on a ircx network you are going to have to jump through a few hoops.. as long as u stick to ircd you won't have any trouble with the default setup

Get information about ircWx here