Lag check

From Scriptwiki
Revision as of 17:48, 14 February 2008 by Wiebe (talk | contribs) (minor tweak)

Jump to: navigation, search

Here is a simple example of how to measure the response time from the IRC server.

Response time being the time it takes to travel from your client to the IRC server, be processed by the IRC server, and send back to your client.

; First we create an alias lagcheck, that sends out a "PING :lag <ticks>" to the server.
alias lagcheck {
  .quote PING :lag $ticks
}

; Second we create an on PONG event, to catch the reply and halt the default output.
; The difference between $ticks and the returned value is the response time in milliseconds.
; Echo this to the status window and halt the default output.
on ^*:PONG:{
  if ($2 == lag) && ($3 isnum) {
    echo -s Response time: $calc($ticks - $3) ms
    haltdef
  }
}

Put this in remote (alt+r), and use /lagcheck to check the response time from the IRC server.

You could also save the result to a variable and use this info in any other place, and run a timer to refresh this value at an interval.

If you use a bouncer, the bouncer may be responding to the PING request instead of the IRC server, or even return the wrong reply.