Top

Inactivity Report


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  5.7 (of 3 scores)
Date Added  Dec 28, 2008
Last Updated  Dec 28, 2008
Tags  idle  inacitivity  inactive  mirc  report 

Introduction



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.

Grab 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.* }
}
 

Comments

  (9)  RSS
Kirby
Comments: 475
 
mIRC Snippet:  Inactivity Report
Posted on Dec 28, 2008 7:19 pm
Code:
if (%active.trigger != $null)

You could just do:
Code:
if (%active.trigger)
vSkyzv
Comments: 22
 
mIRC Snippet:  Inactivity Report
Posted on Dec 28, 2008 7:36 pm
Thanks. Updated.
NIGathan
Comments: 208
 
mIRC Snippet:  Inactivity Report
Posted on Dec 28, 2008 9:44 pm
Is this for specific channels? Or of the entire server?

If its just a channel, instead of whois'ing everyone, you can use $duration($nick($chan,%x).idle) to return the idle time of a user
PunkTuReD
Comments: 461
 
mIRC Snippet:  Inactivity Report
Posted on Dec 28, 2008 10:27 pm
i would say its for channels you are on.
niice snippet vSkyzv
7 from me
vSkyzv
Comments: 22
 
mIRC Snippet:  Inactivity Report
Posted on Dec 28, 2008 11:57 pm
Thanks for the comments.

@NIGathan
Could you give me a general idea on how to use that? I'm always looking forward to shortening my code.
NIGathan
Comments: 208
 
mIRC Snippet:  Inactivity Report
Posted on Dec 29, 2008 12:02 am
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.

Code:
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)
NIGathan
Comments: 208
 
mIRC Snippet:  Inactivity Report
Posted on Dec 29, 2008 12:04 am
That will return the idle in seconds, to get this into formatted time, use $duration, for more info see: /help $duration and /help $nick
vSkyzv
Comments: 22
 
mIRC Snippet:  Inactivity Report
Posted on Dec 29, 2008 12:37 pm
For some reason $nick(<channel>,<order>).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.
NIGathan
Comments: 208
 
mIRC Snippet:  Inactivity Report
Posted on Dec 30, 2008 12:21 am
Its not inaccurate, its merely channel based. The idle time in the whois is server based. So if they talk anywhere, it changes. Also if you just joined the channel and the person you are getting the idle time for hasnt spoken since youve been in there, it will return the time since you joined.

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom