Chat stats

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
Paul_Don
Posts: 146
Joined: 2003-01-29 06:41
Location: uk
Contact:

Chat stats

Post by Paul_Don » 2003-05-29 04:16

is there a chat stats script for the nmdc hub like there is for ptokax that show top ten posters and what not, ive looked about and cant find one :(

BSOD2600
Forum Moderator
Posts: 503
Joined: 2003-01-27 18:47
Location: USA
Contact:

Post by BSOD2600 » 2003-05-29 09:14

Here is one written on vbscript that will run through your main log (which ever you want) and outputs the stats to a text file.

Code: Select all

Option Explicit

Dim oFS, WshShell, oFileIn, oFileOut, oFileLog, sLine, iUsers, nStart, nEnd, i, j, n
Dim aUsers()

Const ForReading   = 1
Const ForWriting   = 2
Const ForAppending = 8

Const FileIn  = "CountUsersIn.txt"
Const FileOut = "CountUsersOut_user.txt"
Const FileLOG = "CountUsersLOG_user.txt"

ReDim aUsers(2, 0)

Set oFS = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell") 

Set oFileIn  = oFS.OpenTextFile(FileIn, ForReading)
Set oFileOut = oFS.CreateTextFile(FileOut, True)
Set oFileLog = oFS.OpenTextFile(FileLog, ForAppending, True)

oFileLog.WriteBlankLines(2)
oFileLog.WriteLine now & "  CHECKING USERS..."
oFileLog.WriteLine "======================================"

While oFileIn.AtEndOfStream <> True
  sLine = oFileIn.ReadLine
  nStart = Instr(sLine, "<")
  If nStart > 0 Then
    nEnd = Instr(nStart, sLine, ">")
    If nEnd > 0 Then
      ' SEARCH IN USERS
      nStart = nStart + 1
      sLine = Mid(sLine, nStart, nEnd - nStart)
      oFileLog.Write now & "  @LINE: " & oFileIn.Line & " USER FOUND: <" & sLine
      If NewUser(sLine) Then
        oFileLog.WriteLine ">  NEW"
      Else
        oFileLog.WriteLine ">  ALREADY FOUND"
      End If
    Else
      oFileLog.WriteLine now & "  @LINE: " & oFileIn.Line & " NO USER FOUND"
    End If
  Else
    oFileLog.WriteLine now & "  @LINE: " & oFileIn.Line & " NO USER FOUND"
  End If
  
Wend

oFileLog.WriteLine now & "  SORTING..."
If UBound(aUsers, 2) > 0 Then
  For i = 1 To UBound(aUsers, 2) Step 1
    n = 1
    For j = 1 To UBound(aUsers, 2) Step 1
      If aUsers(2, j) > aUsers(2, n) Then
        n = j
      Else
        If aUsers(2, j) = aUsers(2, n) Then
          If aUsers(1, j) > aUsers(1, n) Then
            n = j
          End If 
        End If 
      End If 
    Next
    oFileOut.WriteLine i & vbTab & aUsers(2, n) & vbTab & aUsers(1, n) 
    aUsers(2, n) = 0
  Next
Else
  oFileOut.WriteLine "NO USER FOUND"
End If
oFileLog.WriteLine now & "  END OF SORT"

oFileLog.WriteLine "======================================"
oFileLog.WriteLine now & "  END OF CHECK"

oFileIn.Close
oFileOut.Close
oFileLog.Close



Function NewUser(sUser)
  Dim i
  If UBound(aUsers, 2) > 0 Then
    For i = 1 To UBound(aUsers, 2) Step 1
      If UCase(sUser) = UCase(aUsers(1, i)) Then
        aUsers(2, i) = aUsers(2, i) + 1 
        NewUser = False
        Exit Function
      End If
    Next
  Else
    i = 1
  End If
  ReDim Preserve aUsers(2, i)
  aUsers(1, i) = sUser 
  aUsers(2, i) = 1 
  NewUser = True
End Function

Paul_Don
Posts: 146
Joined: 2003-01-29 06:41
Location: uk
Contact:

Post by Paul_Don » 2003-05-29 10:24

rght lets see would that give u like top 10 posters and top 10 ops post sorta thing?

BSOD2600
Forum Moderator
Posts: 503
Joined: 2003-01-27 18:47
Location: USA
Contact:

Post by BSOD2600 » 2003-05-29 18:22

It will give you ALL the stats for the chatters.....starting from the #1 all the way down to the #567th ;-). yes, its a litle much and I'm sure there are other automated methods for Top 10, but this is what I use.

yakko
Posts: 258
Joined: 2003-01-27 01:04
Contact:

Post by yakko » 2003-05-29 23:06

try my stats script that automates rotating a DC++ log, running stats, and archiving old stats at http://dcppstats.iaconhub.com/. I've been running it since last november with no problems.

Paul_Don
Posts: 146
Joined: 2003-01-29 06:41
Location: uk
Contact:

Post by Paul_Don » 2003-05-30 03:16

cheerz guys

Locked