Chat stats
Moderator: Moderators
Chat stats
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
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
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.