mIRC Home    About    Download    Register    News    Help

Print Thread
ping reply calculation #50774 22/09/03 07:24 PM
Joined: Sep 2003
Posts: 98
N
neznani Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Sep 2003
Posts: 98
i have this code:

on *:ctcpreply:*: {
/echo -a $form.ctcp_rep($nick, $1, $2-)
halt
}

and it works fine with all ctcp replys exept with ping. on ping reply it echoes me this:

('21:05:14') (somenick) [PING Reply: 1064257513]

i would like to know how to calculate the ping ?


www.stwar.us.to
IRCnet - #stwar
Re: ping reply calculation #50775 22/09/03 07:28 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Try something like:

on *:ctcpreply:*: {
/echo -a $form.ctcp_rep($nick, $1, $duration($calc($ctime - $2)))
halt
}

Re: ping reply calculation #50776 22/09/03 07:38 PM
Joined: Sep 2003
Posts: 98
N
neznani Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Sep 2003
Posts: 98
yep it works smile thx. how about if i would wanted mili seconds ?


www.stwar.us.to
IRCnet - #stwar
Re: ping reply calculation #50777 22/09/03 08:26 PM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Then you'd have to set a variable to the value of $ticks when you send the ctcp ping, and do $calc($ticks - %var) when you get the response.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Re: ping reply calculation #50778 22/09/03 08:27 PM
Joined: Dec 2002
Posts: 774
T
theRat Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
you have to send $ticks in ping and calculate with that instead of $ctime


Code:
//if ( khaled isgod ) echo yes | else echo no
Re: ping reply calculation #50779 22/09/03 08:58 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline
Fjord artisan
Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
alias /ping { .ping $$1 | .set %ping.ticks $ticks }
on *:PONG: {
var %ping.difference = $ticks - %ping.ticks
var %ping.final $calc(%ping.difference / 1000)
echo -a Ping Reply: %ping.final Sec.
unset %ping.*
}

thats what i use really good


Need amazing web design for low price: http://www.matrixn3t.net
Re: ping reply calculation #50780 22/09/03 10:20 PM
Joined: Jun 2003
Posts: 242
R
r0ck0 Offline
Fjord artisan
Offline
Fjord artisan
R
Joined: Jun 2003
Posts: 242
Here's what I use to get server lag
Code:
#getlag on
alias getlag {
  if ($version < 6.0) .raw PING $ticks
  else $iif($1 == -a,scid -at1 .raw PING $!ticks,.raw PING $ticks)
}
on ^*:PONG: {
  if (($1 != $server) || ($2 > $ticks) || ($3)) return
  echo $color(info) -a $+(Lag on $server,:) $calc(($ticks - $2) / 1000) secs
  haltdef
}
#getlag end


then just type /getlag or /getlag -a

Re: ping reply calculation #50781 22/09/03 11:18 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Do you people even read the posts? Neither that nor ATMA's has ANYTHING to do with what he asked.


Code:
alias ping {
  .set $+(%,ping.,$1,.,$cid) $ticks
  ctcp $1 PING
}

on *:ctcpreply:ping *:{
  echo -a $form.ctcp_rep($nick, PING, $calc(($ticks - $eval($+(%,ping.,$nick,.,$cid),2))/1000) seconds)
  unset $+(%,ping.,$nick,.,$cid)
  halt
}


That should work correctly.

Re: ping reply calculation #50782 23/09/03 11:06 AM
Joined: Dec 2002
Posts: 1,527
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,527
Stupid question - wouldn't people need to have the $form.ctcp_rep alias?? I dont see it anywhere in your post and I KNOW that's not a default of mirc's smile


Those who fail history are doomed to repeat it
Re: ping reply calculation #50783 23/09/03 11:37 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
The original poster used $form.ctcp_rep in his code and since it didn't return null he must have it.

Re: ping reply calculation #50784 23/09/03 11:42 AM
Joined: Dec 2002
Posts: 1,527
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,527
1,000,000 cc's of coffee STAT!!! oy, you know I read that and quickly forgot it. I hate when I do crap like that lol Ignore my post


Those who fail history are doomed to repeat it
Re: ping reply calculation #50785 23/09/03 05:05 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
There isn't a need for the variable...
Code:
alias ping { .msg $$1 PING $ticks $+  }
on *:ctcpreply:ping *:{
  echo -a $form.ctcp_rep($nick,PING,$calc(($ticks - $2)*.001) seconds)
  halt
}
: