This script returns the percentage and names of inactive users. It does this by doing a '/whois' and then using the data.
The instructions are inside the code.
;+-------------------------------------------------------------------------------------+
;| Inactivity Report (for mIRC 6.35+) - by vSkyzv |
;| ------------------------------------------------------------------------------------|
;| Usage Instructions: |
;| 1. Right click on the "Nicklist" (the list of names on the right) |
;| 2. Goto "Control" |
;| 3. Click on "Inactivity Report" |
;| 4. Wait two seconds for the script to start sending "/whois" commands |
;| 5*. Wait for the data to finish (it may take a long time in large channels). |
;| * If you want to stop the script before it finishes, close the dialog. |
;| ------------------------------------------------------------------------------------|
;| Troubleshooting: |
;| * If errors are found, please type "/unset %active.*" without the quotes. |
;+-------------------------------------------------------------------------------------+
menu Nicklist {
.Control
..$iif(%active.trigger,$style(2)) Inactivity Report {
inc %active.trigger
set %active.chan $chan
dialog -m inactivity_report inactivity_report
names $chan
}
}
raw 307:*:{ if (%active.trigger) { haltdef } }
raw 310:*:{ if (%active.trigger) { haltdef } }
raw 312:*:{ if (%active.trigger) { haltdef } }
raw 313:*:{ if (%active.trigger) { haltdef } }
raw 319:*:{ if (%active.trigger) { haltdef } }
raw 320:*:{ if (%active.trigger) { haltdef } }
raw 355:*:{ if (%active.trigger) { haltdef } }
raw 361:*:{ if (%active.trigger) { haltdef } }
raw 366:*:{ if (%active.trigger) { haltdef } }
raw 378:*:{ if (%active.trigger) { haltdef } }
raw 311:*:{ if (%active.trigger) { haltdef | inc %active.whoised } }
raw 317:*:{
if (%active.trigger) {
haltdef
if ($3 > 600) { set %active.inactive.list %active.inactive.list $2 ( $+ $round($calc($3 / 60),2) minutes) }
else { set %active.active.list %active.active.list $2 ( $+ $round($calc($3 / 60),2) minutes) }
}
}
raw 318:*:{
if (%active.trigger) {
haltdef
if (%active.whoised == %active.nicks) {
var %active.inactive.count = $calc($numtok(%active.inactive.list,32) / 3 / %active.nicks * 100)
var %active.active.count = $calc($numtok(%active.active.list,32) / 3 / %active.nicks * 100)
did -i inactivity_report 4 1 Inactive Users ( $+ %active.inactive.count $+ % $+ ): $iif(%active.inactive.list != $null,%active.inactive.list,No users are inactive)
did -i inactivity_report 4 2 Active Users ( $+ %active.active.count $+ % $+ ): $iif(%active.active.list != $null,%active.active.list,No users are active)
did -i inactivity_report 4 3 Other*: $calc(100 - (%active.inactive.count + %active.active.count)) $+ %
did -i inactivity_report 4 4 *Users that fall into the "Other" category are users who do not submit idle information such as network services.
}
}
}
raw 353:*:{
if (%active.trigger) {
haltdef
set %active.nicks $calc($numtok($1-,32) - 3)
set %active.loop %active.nicks
var %delay = 0
while (%active.loop > 0) {
inc %delay
timer 1 $calc(%delay * 2) whois $gettok($remove($4-,:,~,&,@,%,+),%active.loop,32)
timer 1 $calc(%delay * 2) did -o inactivity_report 2 1 $round($calc(%delay / %active.nicks * 100),0) $+ %
dec %active.loop
}
}
}
dialog inactivity_report {
title "Inactivity Report"
size -1 -1 300 167
text "Gathering Data:",1,10 10 80 15
edit "0%",2,95 7 40 20
text "Statistics:",3,10 40 80 15
edit "Edit2",4,10 55 280 80, multi hsbar vsbar
button "Copy Statistics to Window",5,10 140 280 22
}
on *:DIALOG:inactivity_report:*:*:{
if ($devent == init) {
did -d $dname 4 1
did -b $dname 2
did -m $dname 4
}
elseif ($devent == sclick) && ($did == 5) {
var %active.inactive.count = $calc($numtok(%active.inactive.list,32) / 3 / %active.nicks * 100)
var %active.active.count = $calc($numtok(%active.active.list,32) / 3 / %active.nicks * 100)
echo 5 -a Inactive Users ( $+ %active.inactive.count $+ % $+ ): $iif(%active.inactive.list != $null,%active.inactive.list,No users are inactive)
echo 5 -a Active Users ( $+ %active.active.count $+ % $+ ): $iif(%active.active.list != $null,%active.active.list,No users are active)
echo 5 -a Other*: $calc(100 - (%active.inactive.count + %active.active.count)) $+ %
echo 5 -a *Users that fall into the "Other" category are users who do not submit idle information such as network services.
}
elseif ($devent == close) { unset %active.* }
}
For some reason $nick(,).idle is inaccurate when the idle time of a user is in hours.
Example 1:
I whois'd myself and got an idle time of "7 seconds".
I then used $nick and it also echoed "7".
However when I did it to a person who was inactive for 9+ hours, it echoed "1096". If you do the math there are 32,400 seconds in 9 hours, which means something is wrong.
Well, you can setup a while loop to loop through all the users, I dont know what you do with that info, but heres an example of making a token set with every user and there idle time in the "nick=idletime,nick2=idletime" format.
alias idlechan {
var %x 1
while (%x <= $nick($1,0)) {
var %idle $addtok(%idle,$+($nick($1,%x),=,$nick($1,%x).idle),44)
inc %x
}
return %idle
}
Use: $idlechan(#channel)