mIRC Home    About    Download    Register    News    Help

Print Thread
/ping #161090 03/10/06 02:11 AM
Joined: Feb 2006
Posts: 64
M
Midori Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Feb 2006
Posts: 64
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}
Re: /ping #161091 03/10/06 02:23 AM
Joined: Dec 2002
Posts: 1,527
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,527
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
Re: /ping #161092 03/10/06 05:42 AM
Joined: Feb 2004
Posts: 201
J
Jae Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2004
Posts: 201
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.

Re: /ping #161093 03/10/06 06:29 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You should read the entire post. landonsandor stated, right at the beginning of his post
Quote:
(ripped out of larger scripts)

Re: /ping #161094 03/10/06 02:45 PM
Joined: Dec 2002
Posts: 1,527
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,527
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
Re: /ping #161095 05/10/06 01:03 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
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

Re: /ping #161096 07/10/06 02:54 AM
Joined: Mar 2004
Posts: 210
F
FNar Offline
Fjord artisan
Offline
Fjord artisan
F
Joined: Mar 2004
Posts: 210
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.

Re: /ping #161097 07/10/06 03:16 AM
Joined: Dec 2002
Posts: 1,527
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,527
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
Re: /ping #161098 27/10/06 11:37 PM
Joined: Aug 2006
Posts: 167
P
pishposh Offline
Vogon poet
Offline
Vogon poet
P
Joined: Aug 2006
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