ON *:START:{
 lagstart
}
alias lagstart {
.timerlag 0 $$?="Check For Lag Every _ Seconds" lagdetector
}
ON ^*:PONG:{
  haltdef
  var %x = $calc($ctime - $2)
  titlebar %x $+ s lag
  if (%x >= 4) {
    echoall  4Lag Alert: You are %x seconds lagged to the server!
  }
}
alias lagdetector {
  .quote ping $ctime
}
alias echoall {
  var %x = $$1-
  echo -st %x
  var %y = 1
  while (%y <= $query(0)) {
    echo -t $query(%y) %x
    inc %y
  }
  var %z = 1
  while (%z <= $chan(0)) {
    echo -t $chan(%z) %x
    inc %z
  }
}