mIRC Home    About    Download    Register    News    Help

Print Thread
#52035 30/09/03 06:59 PM
D
DbzDP
DbzDP
D
on *:TEXT:!Ping:#: { ctcp $nick ping | set %pingchan $chan }

on *:CTCPREPLY:ping*: { if ($2 isnum) { msg %pingchan 4 $+ $nick your ping reply was:[12 $+ $duration($calc($ctime / $2 )) $+ 4] I am on server:[12 $+ $server $+ 4] } }

This works but I want it to reply in MILLISECONDS. Can anyone tell me how it is done please?

#52036 30/09/03 07:19 PM
Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
There are two ways to do this, see some examples in the posts made by codemastr and Iori.

#52037 30/09/03 10:43 PM
R
RedAlert
RedAlert
R
Neither of those two examples do what the OP asked for, though... Here's one way to do it:

on *:TEXT:!Ping:#: { .msg $nick $chr(1) $+ ping $ticks ticks $+ $chr(1) | set %pingchan $chan }

on *:CTCPREPLY:ping & ticks:{ if ($2 isnum) { var %d = $calc($ticks - $2) | msg %pingchan 4 $+ $nick your ping reply was:[12 $+ $iif(%d > 999,$duration($calc(%d / 1000)) 12) $+ $calc(%d % 1000) $+ ms $+ 4] I am on server:[12 $+ $server $+ 4] } }

#52038 30/09/03 11:01 PM
D
DbzDP
DbzDP
D
The code below works but this is how it comes out "LT-Serve your ping reply was:[2secs 383ms] I am on server:[irc.mircx.com]" I want it to say 0.383seconds.


on *:TEXT:!Ping:#: { .msg $nick $chr(1) $+ ping $ticks ticks $+ $chr(1) | set %pingchan $chan }
on *:CTCPREPLY:ping & ticks:{ if ($2 isnum) { var %d = $calc($ticks - $2) | msg %pingchan 4 $+ $nick your ping reply was:[12 $+ $iif(%d > 999,$duration($calc(%d / 1000)) 12) $+ $calc(%d % 1000) $+ ms $+ 4] I am on server:[12 $+ $server $+ 4] } }

#52039 30/09/03 11:06 PM
D
DbzDP
DbzDP
D
SORRY I EDITED TO SAY WHAT I WANT, THANKS FOR THE HELP RedAlert.

#52040 01/10/03 06:50 AM
I
Iori
Iori
I
Code:
alias ping .msg $1- PING $ticks $+ 
on *:TEXT:!Ping:#:ping $nick | set -u120 %pingchan. $+ $nick #
on *:CTCPREPLY:ping *:{
  var %a = $calc(($ticks - $2)*.001) seconds
  if $eval($+(%,pingchan.,$nick),2) {
    msg $ifmatch $+(04,$nick your ping reply was:[12,%a,04] I am on server:[12,$server,04])
    unset %pingchan. $+ $nick
  }
  else echo $color(ctcp) -seti $+([,$nick PING Reply]:) %a
  halt
} 
%pingchan.nick is set for 120 seconds, this should be more than enough as with any greater lag they (or you) would probably be reconnecting by then, and enables the var to never be kept on close/exit.

This also allows ms ping times for "normal" /ping <nick> commands.


Link Copied to Clipboard