mIRC Home    About    Download    Register    News    Help

Print Thread
#13993 03/03/03 01:29 PM
Joined: Mar 2003
Posts: 2
A
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Mar 2003
Posts: 2
Hi,

I'm writting a little applet to connect to an IRC channel. My problem is that I don't know what a highscan command needs to return to the server, also I don't know how to calculate the ping time.

Thanks in advance
Pieter Pareit

#13994 03/03/03 06:11 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Ping is simple. When you type /ctcp <nick> ping, you actually send:
Code:

PRIVMSG nick :PING 1046714259

Where  equals to $chr(1), which identifies CTCP and /me messages, and 104671425 is the local $ctime value.

When the destination nick receives the Ping, it can decide whether to reply or ignore. In case it replies, it simply sends back the same message but by notice, instead of a privmsg.

Rule: ctcp request = privmsg; ctcp reply = notice.
Code:

NOTICE yournick :PING 1046714259

Now that you receive the reply, you'll have to substract the numeric parameter from the current $ctime, so that you can know how many seconds left since it was sent.

For more info check this page. As for highscan, sorry no idea.

#13995 03/03/03 09:03 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
I think he meant the raw PING from the server (Ping? Pong!) to keep the connection alive.

All you need to do is return the parameter.
on *:PING: .raw PONG $1


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#13996 03/03/03 09:11 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
I also thought he's talking about server pings, but he wrote "calculation" in his post, that usually refers to client-to-client ping.

#13997 04/03/03 02:20 PM
Joined: Mar 2003
Posts: 2
A
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Mar 2003
Posts: 2
No no, it is the time to reach another person. When you right click on a nick name you can ask the version/time and ping. The ping returns in interval in seconds. But the seconds are return like 123025654 and I don't know how to calculate these in for example 3 sec

#13998 04/03/03 07:31 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Then Online was correct. smile

When you CTCP Ping someone, you send them a PRIVMSG nickname : $+ $chr(1) $+ PING $ctime $+ $chr(1) .. the server delivers the message to them and their client will return your $ctime value to you. What you do when you receive it is to subtract that returned value from your current $ctime, giving you a $duration in seconds of the amount of time it took for the round trip. Most scripts do not divide the duration value by 2 to get the one-way duration.

$ctime is the number of seconds since epoch (1970 January 1 00:00:00 GMT). That's 33 years 2 months 3 days 14 hours 30 minutes 07 seconds ago, currently.

on *:CTCPREPLY:PING*: echo $color(notice) -abfirt * Ping reply for $nick $+ : $duration($calc($ctime - $2)) | halt


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard