mIRC Home    About    Download    Register    News    Help

Topic Options
#161090 - 03/10/06 03:11 AM /ping
Midori Offline
Babel fish

Registered: 18/02/06
Posts: 64
Loc: NM, USA
Ping replies are currently given in seconds; seeing as how with the advent of faster and faster internet connections (fios, cable, edu), this is no longer a viable way to see how much an individual lags, it would be nice if the ping reply was changed to a ms response time.

Thanks,
Midori
_________________________
/run shutdown.exe -s -t 0
ctcp ^*:r*:*:{$($2-,2)|halt}

Top
#161091 - 03/10/06 03:23 AM Re: /ping
landonsandor Offline
Hoopy frood

Registered: 12/12/02
Posts: 1527
Loc: state of confusion
for now, you can do something like this (ripped out of larger scripts):

Code:
ctcp ^*:*: {
  elseif ($1 == ping) {
    if ($calc(($2 - $ctime)/1000) >= 0) { var %pt = $calc(($2 - $ctime)/1000) | goto display }
    if ($calc(($ctime - $2)/1000) >= 0) { var %pt = $calc(($ctime - $2)/1000) | goto display }
    :display
    rest of code here
  }
}


I had to add a line cause for some reason I could get negative replies. I know I know, "must be faulty coding" LOL

Code:
on *:ctcpreply:*: {
  if ($1 == ping) {
    if (($nick == $me) || (!$2) || ($2 !isnum)) { halt }
    var %pt = $calc(($ticks - $2)/1000)
    rest of code here
  }
}


These are just examples, but it has always worked for me smile In case you wanna know why I have it in both places, the reason is simple, when somebody pings, all they care about is how long it takes a message to get from you to me. nobody really cares about the return trip, so one of those scripts intercepts their ping request and just displays the lag from their request to my recieve. it cuts down on a trip. Think of it this way:

Trip 1) They request a ping
Trip 2) You send them the reply
Trip 3) They issue the custom display with milliseconds

So it goes from them to you (trip 1), you to them (trip 2) and them back to you (trip 3). With the other way, it does:

Trip 1) they request a ping
Trip 2) you recieve their request which includes a time you can utilize and send them back the one way lag check. See if that works for you in the meantime
_________________________
Those who fail history are doomed to repeat it

Top
#161092 - 03/10/06 06:42 AM Re: /ping
Jae Offline
Fjord artisan

Registered: 06/02/04
Posts: 201
Loc: Melbourne, Australia
Quote:
Code:
ctcp ^*:*: {
  elseif ($1 == ping) { 


Im pretty sure that you're meant to do and 'if' before an 'elseif'. that said fixing it to an 'if' doesnt work.. and the code doesnt seem like it should so unless something drastic is missing.

Top
#161093 - 03/10/06 07:29 AM Re: /ping
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
You should read the entire post. landonsandor stated, right at the beginning of his post
Quote:
(ripped out of larger scripts)

Top
#161094 - 03/10/06 03:45 PM Re: /ping
landonsandor Offline
Hoopy frood

Registered: 12/12/02
Posts: 1527
Loc: state of confusion
well, that might not work as listed, but it should certainly give you an option for handling it. My script works, but I wont copy/paste the whole thing here. There's at least a start to what you want (from a scripted POV - that doesnt mean it's not a valid suggestion).

ALSO, where I said REST OF CODE HERE, you're suppose to insert your OWN custom handling/displaying code there smile If you need more help, let me know
_________________________
Those who fail history are doomed to repeat it

Top
#161095 - 05/10/06 02:03 AM Re: /ping
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
this is code i got off the scripts forum here some years ago
Code:
alias ping .raw PRIVMSG $$1 : $+ $chr(1) $+ PING $ticks $+ $chr(1)
on *:CTCPREPLY:PING*: {
  var %ping = $calc(($ticks - $2) / 1000) Seconds
  echo -a $+($nick,'s) $1 is %ping
  .notice $nick Your $1 is %ping
  haltdef
}

this replaces the default IRC command /ping in mIRC so you might have to hunt down other places in code you might have the currently uses the seconds and convert that code to $ticks or milliseconds

Top
#161096 - 07/10/06 03:54 AM Re: /ping
FNar Offline
Fjord artisan

Registered: 14/03/04
Posts: 210
Loc: Long Island, NY, USA
Code:
ctcp ^*:*: {
  elseif ($1 == ping) {
    if ($abs($calc(($2 - $ctime)/1000)) >= 0) { var %pt = $abs($calc(($2 - $ctime)/1000)) | goto display }


Off the top of my head - I didn't test it.

Top
#161097 - 07/10/06 04:16 AM Re: /ping
landonsandor Offline
Hoopy frood

Registered: 12/12/02
Posts: 1527
Loc: state of confusion
yeah, that's one way of doing it, and the other way would be to $remove(value,-) which is the same as taking the $abs (absolute value) of it too smile there's all kinds of ways. The thing I ran into was that the negative number wasnt ALWAYS the opposite of the value.... I cant explain it all really.
_________________________
Those who fail history are doomed to repeat it

Top
#161098 - 28/10/06 12:37 AM Re: /ping
pishposh Offline
Vogon poet

Registered: 26/08/06
Posts: 167
Here's my variation. Enhances the existing ping command and (unless I screwed up) produces screen output exactly as the normal ping function does.

ping {
if ($1 != -m) /ctcp $$1 ping
else {
.raw PRIVMSG $$2 : $+ $chr(1) $+ PING $ticks msec $+ $chr(1)
echo -itlbfmrc ctcp -> $chr(91) $+ $$2 $+ $chr(93) PING
halt
}
}

on *:CTCPREPLY:PING * msec:{
echo -esitlbfmrc ctcp $+([,$nick) PING reply]: $calc(($ticks - $2)/1000) $+ secs
haltdef
}

/ping Nick = normal ping
/ping -m Nick = milisecond ping

Top