mIRC Home    About    Download    Register    News    Help

Print Thread
#114283 13/03/05 03:15 PM
Joined: Mar 2005
Posts: 8
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Mar 2005
Posts: 8
does someone have a simple script that +v people when the idle time is less than 600 sec.. and -v all with idle time over 600 secs?

i cant figure it our, tried many times now

thx

#114284 13/03/05 04:15 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
only way i know to get a nick's idle is with /whois nick nick (the nick twice is required if you are not on the same Server)


Quote:

RAW Code Display on
311 M`` mikechat host-66-81-113-157.rev.o1.com * Dont you have homework to do?
-
M`` is mikechat@host-66-81-113-157.rev.o1.com * Dont you have homework to do?
319 M`` @#ASCII_ART
M`` on @#ASCII_ART
312 M`` broadway.ny.us.dal.net 42nd Street
M`` using broadway.ny.us.dal.net 42nd Street
307 M`` has identified for this nick
M`` has identified for this nick
317 M`` 2665 1110725735 seconds idle, signon time
M`` has been idle 44mins 25secs, signed on Sun Mar 13 06:55:35
318 M`` End of /WHOIS list.
M`` End of /WHOIS list.
-

I used this bit to see the raw code(s)
Code:
#showraw on
raw *:*:echo 4 -a $numeric $2-
on *:mode:#: { echo -a 4 $1 8 $2 9 $3 11 $4 13 $5 4 $6 }
#showraw end 
menu menubar {
  Show &RAW codes:{
    if ($group(#showraw) = off) { .enable #showraw }
    else { .disable #showraw }
    echo $color(action) -a RAW Code Display $group(#showraw)
  }
}


so I see that RAW code 317 has the nick, the idle time and the signon date/time
317 M`` 2665 1110725735 seconds idle, signon time
//say $duration(2665)
gives: 44mins 25secs

if you are in a busy/large channel this could take quite a bit of runtime to check everyone, so you will want to restrict the search to just $chan(#,v) users

the RAW events have you as the first parameter( $1)
so this should give the nick and idle time (in seconds)
raw 317:*: { echo -a $2 $3 }

#114285 13/03/05 05:17 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
You can also check the person's idle time with $nick().idle

I can see 2 ways to do the script:
1) You can run a single /timer that cycles through all nicks and checks their idle (not accurate but doesn't make mIRC slow);
2) You can make a /timer everytime that a person talks (accurate but makes mIRC slow).

Hope this can help smile
Zyzzyx.

Note: the "slowness" depends on the number of users and on your computer. When I say 'slow' I mean 'slower' smile

Last edited by Zyzzyx26; 13/03/05 05:21 PM.
#114286 13/03/05 06:03 PM
Joined: Mar 2005
Posts: 8
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Mar 2005
Posts: 8
but im a bit lost .. well.. the way i would do it.. but im not sure ican code it smirk

make a timer that checks idletimes.. it should store nicks with idletime over 600 secs .. and make a while loop that devoice them..

And the other way.. timer again.. that make a loop on the devoiced people and voice them if they got idle time under 600 secs ect.

#114287 13/03/05 06:23 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I tested this with an echo and it looks like it will work, I just made it as fast as I could though so it's not the most efficient:

Code:
alias idle.setmode {
  if ($me isop $1) {
    var %i = 1, %nicks.idle, %nicks.active
    while ($nick($1,%i,$3)) {
      if ($nick($1,%i,$3).idle > $2) { %nicks.idle = %nicks.idle $nick($1,%i,$3) }
      inc %i
    }
    %i = 1
    while ($nick($1,%i,a,$3)) {
      if ($nick($1,%i,a,$3).idle <= $2) { %nicks.active = %nicks.active $nick($1,%i,a,$3) }
      inc %i
    }
    %i = 1
    while (%nicks.idle) {
      mode $1 $+(-,$str($3,$iif($modespl > $numtok(%nicks.idle,32),$v2,$v1))) $gettok(%nicks.idle,$+(1-,$modespl),32)
      %nicks.idle = $deltok(%nicks.idle,$+(1-,$modespl),32)
    }
    %i = 1
    while (%nicks.active) {
      mode $1 $+(+,$str($3,$iif($modespl > $numtok(%nicks.active,32),$v2,$v1))) $gettok(%nicks.active,$+(1-,$modespl),32)
      %nicks.active = $deltok(%nicks.active,$+(1-,$modespl),32)
    }
  }
}


New username: hixxy
#114288 13/03/05 06:48 PM
Joined: Mar 2005
Posts: 8
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Mar 2005
Posts: 8
Quote:
I tested this with an echo and it looks like it will work, I just made it as fast as I could though so it's not the most efficient:

Code:
alias idle.setmode {
  if ($me isop $1) {
    var %i = 1, %nicks.idle, %nicks.active
    while ($nick($1,%i,$3)) {
      if ($nick($1,%i,$3).idle > $2) { %nicks.idle = %nicks.idle $nick($1,%i,$3) }
      inc %i
    }
    %i = 1
    while ($nick($1,%i,a,$3)) {
      if ($nick($1,%i,a,$3).idle <= $2) { %nicks.active = %nicks.active $nick($1,%i,a,$3) }
      inc %i
    }
    %i = 1
    while (%nicks.idle) {
      mode $1 $+(-,$str($3,$iif($modespl > $numtok(%nicks.idle,32),$v2,$v1))) $gettok(%nicks.idle,$+(1-,$modespl),32)
      %nicks.idle = $deltok(%nicks.idle,$+(1-,$modespl),32)
    }
    %i = 1
    while (%nicks.active) {
      mode $1 $+(+,$str($3,$iif($modespl > $numtok(%nicks.active,32),$v2,$v1))) $gettok(%nicks.active,$+(1-,$modespl),32)
      %nicks.active = $deltok(%nicks.active,$+(1-,$modespl),32)
    }
  }
}


how would you call it?

#114289 13/03/05 06:50 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
* tidy_trax slaps himself
I was supposed to add that at the end of my last post.

/idle.setmode <channel> <idle time> <mode>

So for the one you want specifically: /idle.setmode <channel> 600 v


New username: hixxy
#114290 13/03/05 06:57 PM
Joined: Mar 2005
Posts: 8
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Mar 2005
Posts: 8
thanks.. it works.. and thanks for the snip..

#114291 13/03/05 07:18 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Here's a much more effecient one (Uses one while loop instead of four), usage is the same as the other one.

Code:
alias idle.setmode {
  if ($me isop $1) {
    var %i = 1, %idle.nicks, %active.nicks
    while ($nick($1,%i)) {
      if ($nick($1,$nick($1,%i),$3)) &amp;&amp; ($nick($1,%i).idle &gt; $2) { %idle.nicks = %idle.nicks $nick($1,%i) }
      elseif ($nick($1,$nick($1,%i),a,$3)) &amp;&amp; ($nick($1,%i).idle &lt;= $2) { %active.nicks = %active.nicks $nick($1,%i) }
      if ($numtok(%idle.nicks,32) == $modespl) { 
        mode $1 $+(-,$str($3,$modespl)) %idle.nicks 
        %idle.nicks = ""
      }
      if ($numtok(%active.nicks,32) == $modespl) { 
        mode $1 $+(+,$str($3,$modespl)) %active.nicks 
        %active.nicks = ""
      }
      inc %i
    }
    if (%idle.nicks) { mode $1 $+(-,$str($3,$numtok(%idle.nicks,32))) %idle.nicks }
    if (%active.nicks) { mode $1 $+(+,$str($3,$numtok(%active.nicks,32))) %active.nicks }
  }
}


New username: hixxy

Link Copied to Clipboard