ctcp ^*:LAG:?:{
if $nick == $me {
set %delay [ $+ [ $cid ] ] $round( $calc( ( $ticks - $2 ) / 1000 ) , 2 )
;[color:grey]The following line simply calculates the time till the next count depending on your awaystatus and you current lag:
;You might as well ignore it and set %newlag to a fixed amount of seconds
var %newlag = $calc( $iif(%awaynick [ $+ [ $cid ] ],1,0) * 20 * 60 + ( 10 - $urange(0,%delay [ $+ [ $cid ] ],8) ) * 30 )[/color]
.timernextlagcount $+ $cid 1 %newlag lagcount $cid
echo $color(info2) -st Lag: $+ $iif(%delay [ $+ [ $cid ] ] == 1,1sec,%delay [ $+ [ $cid ] ] $+ secs) $+ (Next at: $+ $asctime($calc($ctime + %newlag), HH:nn:ss) $+ )
halt
}
}
on *:CONNECT:{ .timerconnectlag $+ $cid 1 2 lagcount $cid }
on *:DISCONNECT:{ unset %delay [ $+ [ $cid ] ] }
alias lagcount { scid $iif($1 isnum,$1,$cid) | .ctcp $me LAG $ticks }