This is a simple script which displays your ping (in milliseconds) to the server via a custom window.
After loading the script and connecting to a server, the script will set a timer to ping all connected servers every 60 seconds. This will be displayed in the custom window list.
on *:CONNECT:{
if (!$timer(pingservers)) { timerpingservers 0 60 scon -at1 pingservers }
if (!$window($+(@,$cid,.Ping:*),1)) { window -nk0 @ $+ $cid $+ .Ping: - }
}
alias pingservers {
if ($($+(%,pingResp,$cid),2)) {
renwin $window($+(@,$cid,.Ping:*),1) @ $+ $cid $+ .Ping: >60000
echo -t $window($+(@,$cid,.Ping:*),1) >60000
}
set %pingResp $+ $cid 1
.raw PING : $+ $ticks
}
on ^*:PONG:{
var %ticks = $ticks
if ($($+(%,pingResp,$cid),2)) {
var %ping = $calc(%ticks - $($+($,$0),2))
if (!$window($+(@,$cid,.Ping:*),1)) { window -nk0 @ $+ $cid $+ .Ping: $+ %ping }
else { renwin $window($+(@,$cid,.Ping:*),1) @ $+ $cid $+ .Ping: $+ %ping }
echo -t $window($+(@,$cid,.Ping:*),1) %ping
unset %pingResp $+ $cid
haltdef
}
}