mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2019
Posts: 20
S
Stephen Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2019
Posts: 20
I had the following script working prior to the 7.64 update now it is giving results that it did not give prior.

Script runs on a 1 second timer and checks the idle times of the people in the channel. I get a notice at 6 hours, they get a message at 7 hours 30 minutes, then kicked at 8 hours. but since update to 7.64 outputs are duplicated

/timeridlecheck 0 1 /idlecheck

12/14/20-4:24:03:A] Allie2 is at 6 hours idle
[12/14/20-4:24:03:A] Allie2 is at 6 hours idle
[12/14/20-4:24:04:A] Allie2 is at 6 hours idle
[12/14/20-4:24:05:A] Allie2 is at 6 hours idle
[12/14/20-4:24:06:A] Allie2 is at 6 hours idle
[12/14/20-4:24:07:A] Allie2 is at 6 hours idle
[12/14/20-4:24:08:A] Allie2 is at 6 hours idle
[12/14/20-4:24:09:A] Allie2 is at 6 hours idle
[12/14/20-4:24:10:A] Allie2 is at 6 hours idle
[12/14/20-4:24:11:A] Allie2 is at 6 hours idle
[12/14/20-4:24:12:A] Allie2 is at 6 hours idle
[12/14/20-4:24:13:A] Allie2 is at 6 hours idle
[12/14/20-4:24:14:A] Allie2 is at 6 hours idle
[12/14/20-4:24:15:A] Allie2 is at 6 hours idle
[12/14/20-4:24:16:A] Allie2 is at 6 hours idle
[12/14/20-4:24:17:A] Allie2 is at 6 hours idle
[12/14/20-4:24:18:A] Allie2 is at 6 hours idle
[12/14/20-4:24:19:A] Allie2 is at 6 hours idle
[12/14/20-4:24:20:A] Allie2 is at 6 hours idle
[12/14/20-4:24:21:A] Allie2 is at 6 hours idle
[12/14/20-4:24:22:A] Allie2 is at 6 hours idle
[12/14/20-4:24:23:A] Allie2 is at 6 hours idle
[12/14/20-4:24:24:A] Allie2 is at 6 hours idle
[12/14/20-4:24:25:A] Allie2 is at 6 hours idle
[12/14/20-4:24:26:A] Allie2 is at 6 hours idle
[12/14/20-4:24:27:A] Allie2 is at 6 hours idle
[12/14/20-4:24:28:A] Allie2 is at 6 hours idle
[12/14/20-4:24:29:A] Allie2 is at 6 hours idle
[12/14/20-4:24:30:A] Allie2 is at 6 hours idle
[12/14/20-4:24:31:A] Allie2 is at 6 hours idle
[12/14/20-4:24:32:A] Allie2 is at 6 hours idle
[12/14/20-4:24:33:A] Allie2 is at 6 hours idle
[12/14/20-4:24:34:A] Allie2 is at 6 hours idle
[12/14/20-4:24:35:A] Allie2 is at 6 hours idle
[12/14/20-4:24:36:A] Allie2 is at 6 hours idle
[12/14/20-4:24:37:A] Allie2 is at 6 hours idle
[12/14/20-4:24:38:A] Allie2 is at 6 hours idle
[12/14/20-4:24:39:A] Allie2 is at 6 hours idle
[12/14/20-4:24:40:A] Allie2 is at 6 hours idle
[12/14/20-4:24:41:A] Allie2 is at 6 hours idle
[12/14/20-4:24:42:A] Allie2 is at 6 hours idle
[12/14/20-4:24:43:A] Allie2 is at 6 hours idle
[12/14/20-4:24:44:A] Allie2 is at 6 hours idle
[12/14/20-4:24:45:A] Allie2 is at 6 hours idle
[12/14/20-4:24:46:A] Allie2 is at 6 hours idle
[12/14/20-4:24:47:A] Allie2 is at 6 hours idle
[12/14/20-4:24:48:A] Allie2 is at 6 hours idle
[12/14/20-4:24:49:A] Allie2 is at 6 hours idle
[12/14/20-4:24:50:A] Allie2 is at 6 hours idle
[12/14/20-4:24:51:A] Allie2 is at 6 hours idle
[12/14/20-4:24:52:A] Allie2 is at 6 hours idle
[12/14/20-4:24:53:A] Allie2 is at 6 hours idle
[12/14/20-4:24:54:A] Allie2 is at 6 hours idle
[12/14/20-4:24:55:A] Allie2 is at 6 hours idle
[12/14/20-4:24:56:A] Allie2 is at 6 hours idle
[12/14/20-4:24:57:A] Allie2 is at 6 hours idle
[12/14/20-4:24:58:A] Allie2 is at 6 hours idle
[12/14/20-4:24:59:A] Allie2 is at 6 hours idle
[12/14/20-4:25:00:A] Allie2 is at 6 hours idle
[12/14/20-4:25:01:A] Allie2 is at 6 hours idle

Code
idlecheck {
  set %idlecheck.count 1
  :next
  set %idlecheck.nick $nick(%guard,%idlecheck.count)
  if %idlecheck.nick == $null goto done
  if %idlecheck.nick isop # goto skip
  if $nick(#,%idlecheck.nick).idle == 21600 {
    /echo 4 # %idlecheck.nick is at 6 hours idle
  }

  if $nick(#,%idlecheck.nick).idle == 27000 {
    /.timer 1 $calc(30 + %idlecheck.count) //msg %idlecheck.nick hi, you have been idle now for over  7 hrs and 30 minutes (no talking in the channel. Private message does not count) Please say something in the channel. If you are idle past 8hrs we will kick you.
    /echo 4 # %idlecheck.nick 7 hr 30 minute warning issued
  }
  if $nick(#,%idlecheck.nick).idle == 28800 {
    //ban -ku10 # %idlecheck.nick "you were idle for 8 hours you are not banned we just kicked you because you were idle

  }

  inc %idlecheck.count
  goto next
  :skip
  inc %idlecheck.count
  goto next
  :done
   
}



Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Hmm, that is strange, because line 7 should prevent that from happening by the nature of the if-check only being true for that single second in time.

Code
if $nick(#,%idlecheck.nick).idle == 21600 {

Now, not to be too critical, but your code is awfully primordial in design and could easily be modernized and simplified... But I am rather curious to know what Khaled broke for it to behave this way suddenly.



Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
OH! How odd!

Khaled. You changed $nick().idle such that it only returns a resolution of 60 seconds now. 0, 60, 120, 180, 240, 300, etc...

The above script triggers every second for 60 seconds because the target's idle time remains static for those 60 seconds.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Dec 2019
Posts: 20
S
Stephen Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2019
Posts: 20
Originally Posted by Raccoon

Now, not to be too critical, but your code is awfully primordial in design and could easily be modernized and simplified... But I am rather curious to know what Khaled broke for it to behave this way suddenly.



Yea it was a throw together and work fast script been working on it slowly but as it works (or did until this update) just been working on it as I come up with other ways to do it cleaner.

Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
This is due to item 41 in versions.txt, where the Nick Colors idle time resolution was changed to once a minute. As scripts seem to be depending on a once a second update, I will be changing this back to once a second in the next release.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
As a work-around for now, you should be able to change the frequency of the timer from 1 second to 60 seconds, and it should just work again without changing anything else.
BUT, this will break again once this bug is fixed, since the idle time resolution will be more exact to the second and not rounded down to the nearest minute. For that we'll need some code changes.

First up, I would recommend switching from goto labels to a while loop. See /help /while

Secondly, I would keep the timer at 1 minute instead of checking every second, and instead of checking if the .idle property is exactly equal == to a value, I'd check if it's greater-than-or-equal >= a value, and then I would add the person to a naughty list that indicates they have passed this threshold, checking if they're already on that list next time around. This will prevent multiple firings from occurring for the same person. There are a number of ways of doing this, from using /ialmark to store notes on the nickname, to /set-ing a global variable or variables, to keeping a Hash Table which is the basically same as variables but are automatically destroyed when mIRC is restarted (and keeps your global variables tidier). You could also assign the person a different color and check that color with each idle threshhold they pass, using the /cline and $nick().color command and property. Experiment!


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard