mIRC Homepage
Posted By: anoxia Check if AFK script help needed - 08/11/07 04:59 PM
Hi,

I decided to make a script that would check if a person is AFK på checking the idletime, and then sending me a /notice with a /beep 4, if it retuns a certain value.

So far I've got:
Code:
raw 317:*: {
  if ($3 < 600) {
    echo -a $2 is not AFK (less than 10 min idle time)
  }
}

This works great when I make a /whois $nick $nick on somebody, I see their idle time, and if they have an idle time less than 600 seconds, I see the "is not AFK" message in my active window, great.

Here is my problem. My mIRC scripting knowledge is very limited, so I am not sure how I can make command that checks this idletime, and sends me a notice. I'd like you guys to help me with that.
I came up with the following:
Code:
alias idlecheck {
  timer 0 10 whois $$1 $$1
  if ($3 <= 600) {
    notice $me user isn't AFK | beep 4
  }
}



My idea is to put this into a nicklist popup and then have options to start the timer, stop it etc.
An awesome idea would be to include the /gtalk command, but I can't seem to get that thing to work at the moment...
Posted By: Panic Re: Check if AFK script help needed - 08/11/07 05:38 PM
Hello

I am not very good at scripting but i was just looking why couldn't you make something along the lines of on /who $nick it would whois them and as well Idle time does not always say if they are afk sometimes they might just be doing other things

Thanks
Panic
Posted By: anoxia Re: Check if AFK script help needed - 08/11/07 07:18 PM
Hi,

The idea is to get a notice when someone is back from not being active, this way I will be notified through four beeps, that a person I have been, well, watching, is back.

This is useful for keeping track of my writers and other people on IRC, so I can make sure they get their work done :-)


The on: only applies if they write some text on a channel where I'm at, where this script will check regulary if they are active or not on the entire network.
Posted By: Lpfix5 Re: Check if AFK script help needed - 08/11/07 07:42 PM
Well on the IRC server I am the idle time is in mins secs etc...

The alternative is to use $duration(token) to reverse it into seconds

Im not sure if this is what you want but I wrote it via menu nicklist

Code:
menu nicklist {
  .IdleCheck 
  ..Start:set %rep.a $?="How many seconds to check?:" | timerxc 0 10 whois $$1 $$1
  ..Stop:.timerxc off
}

raw 317:*: {
  if ($3 < %rep.a) {
    notice $2 is not AFK | beep 4  
  }
}


When you right click someone there will menu a menu called IdleCheck then in that menu is Start, soon you press start it ask for the amount of time you want to check for then sets a var.

The reason why I named the timer is to halt it because of you execute /timer without naming it it will create a random timer which cannot be halted unless A) you know the Nth value or B) You use /timers off.

So now if $3 in the raw check is not in seconds only rather then mins seconds etc... you will have to do something like $duration($3-4) to convert it.
Posted By: RusselB Re: Check if AFK script help needed - 08/11/07 11:30 PM
Any network that I've connected to shows away time in hours:minutes:seconds format, but when checking the actual return using a debug window, it's actually returned in seconds only. The network automatically converts it to the format you see.
Posted By: Lpfix5 Re: Check if AFK script help needed - 09/11/07 12:05 AM
I see
Posted By: Trashlord_ Re: Check if AFK script help needed - 09/11/07 03:45 PM
It is returned in seconds, and mIRC converts it to that specific format, RusselB, not the network.
© mIRC Discussion Forums