mIRC Home    About    Download    Register    News    Help

Print Thread
#202131 15/07/08 11:17 PM
Joined: Jun 2008
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2008
Posts: 17
how do i change the ping reply to milliseconds instead of seconds?

Siefer414 #202132 16/07/08 03:41 AM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
it's not as simple as just checking a box in mIRC - but it could easily be made an mIRC option for future version (hint, hint).

First, you need to send the actual underlying ping message, instead of doing a simplistic "/ping nick". For example, try this:

//raw privmsg $me : $+ $chr(1) $+ PING $calc($ctime -3600) $+ $chr(1)

... and you'll get a ping reply saying you're lagged by 1 hour (3600 seconds).

Now try this:

//echo -a $uptime(system)

This is a value that tells how many milliseconds it's been since you booted your system, which you can slip into your ping message:

//raw privmsg $me : $+ $chr(1) $+ PING $uptime(system) $+ $chr(1)

Now you need to create a ping-reply handler that will calculate what the uptime is NOW against the number returned by the ping. This is the number of milliseconds, so if you want to display it like 1.234 seconds, then divide by 1000:

on *:CTCPREPLY:PING *:{
var %x = $calc($uptime(system) - $2)
echo 4 -s [ $+ $nick PING reply]: $duration($calc(%x /1000) )
halt
}

You'll then need to add some code to examine the number returned, to decide whether the number is so huge that it's an uptime value, or is small enough that it's a normal $ctime value that should be handled the normal way. Whether you want to create an alias to intercept the "ping" command and use the new format, is up to you. However be aware that programs could also be using "/ctcp NICK ping" also. mIRC intercepts both outgoing ping methods and adds the time-value without telling you about it.

alias window:

/ping //raw privmsg $$1 : $+ $chr(1) $+ PING $uptime(system) $+ $chr(1)


Link Copied to Clipboard