mIRC Home    About    Download    Register    News    Help

Print Thread
/ping accurate to milliseconds #67842 14/01/04 08:23 PM
Joined: Jan 2004
Posts: 1
bendelo Offline OP
Mostly harmless
OP Offline
Mostly harmless
Joined: Jan 2004
Posts: 1
The current implementation of CTCP PING uses the $ctime variable which results in a ping reply accurate to the second. However given that a high number of users are on fast digital connections, having a ping of 0sec when < 1000ms is not very useful.

I propose that CTCP PINGs be more accurate, perhaps to the millisecond by using a modified timestamp. I have implemented with mIRC script a new /ping command with the $ticks variable. This gives a less 'blunt' ping reply.

Aliases: (aliases.ini)
/ping raw -q PRIVMSG $$1 $+(:,$chr(1),PING $ticks,$chr(1))

Remote: (scripts.ini)
on 1:CTCPREPLY:PING*:{
echo 4 -a $+([,$nick PING reply]: $calc($ticks - $2),ms)
halt
}

This could of course be refined to use $asctime to format ping replies > 1000ms like mIRC's native implementation.

Hopefully this feature will be useful to people, and possibly included in future versions of mIRC.

Re: /ping accurate to milliseconds #67843 14/01/04 11:08 PM
Joined: Feb 2003
Posts: 2,661
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,661
Indeed, many of us write our own PING methods using "$ctime $ticks" like yours. Though, I'm happy with it the way it is, personally. Gives people something to do. And besides, $ticks is only accurate to about 100ms.

Btw, you may want to check if $2 exists, if not, then use $1. Some clients will only reply with your first parameter.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: /ping accurate to milliseconds #67844 15/01/04 01:33 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
$2 IS the 1st paramter smile $1 is "PING"

Re: /ping accurate to milliseconds #67845 15/01/04 01:38 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Just a little shorter code:
Code:
alias ping { .msg $$1 PING $ticks $+  }

Re: /ping accurate to milliseconds #67846 15/01/04 02:41 PM
Joined: Feb 2003
Posts: 2,661
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,661
Ah, DOH! smirk

And for some reason I read $ctime $ticks in his example, when $ctime isn't even there. crazy

* Raccoon goes to have his eyes checked.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: /ping accurate to milliseconds #67847 15/01/04 02:44 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Quote:
* Raccoon goes to have his eyes checked.
There are optometrists for raccoons? laugh

Re: /ping accurate to milliseconds #67848 16/01/04 01:25 AM
Joined: Dec 2002
Posts: 1,527
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,527
A simple new option could allow for us to designate this; giving the default in black text near the checkbox for customizing etc and an editbox to enter in the mirc $identifyer to use for it (only allowing time identifyers and nothing else so it couldnt be used to attack)


Those who fail history are doomed to repeat it