mIRC Home    About    Download    Register    News    Help

Print Thread
#121243 25/05/05 10:56 AM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Hi, I need some help with this ping script...I have two questions for it. First, I have it halting the default ping reply that I send so I can do my own. I want to use $ctime and add the seconds in a day (86400) so it looks like your ping time is actual ping time + 1 day, and also say I'm just joking and give the real ping time on the same line. I'm new to scripting and I can't figure out how to get it to add the value of $ctime + 86400 and assign it to a variable. It also wont let me use the variable in the ping, which could be because I'm doing it wrong. Also, how do you refer to the data sent in an actual ping reply so I can give the real ping time in the same line? Would something like below work if I could get the value assigned right? Thanks.

ctcp *:ping:*:{ ctcpreply $ctime(%pingplusday) | haltdef }

#121244 25/05/05 01:29 PM
Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
Code:
on *:ctcpreply:PING*: {
  if ($2 == $null) || ($2 !isnum) halt
  notice $nick You are lagged one day, $duration($calc($ctime - $2)) from $server 
}
 

Last edited by CtrlAltDel; 25/05/05 01:31 PM.

I refuse to engage in a battle of wits with an unarmed person. wink
#121245 25/05/05 06:45 PM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Thanks, for the script, but if I understand that right, that's doing things based on the person getting a ctcp reply from me. I want my script to halt the standard ctcp reply and give them one that does this (here it is in pseudocode):

on ping, add seconds in a day to normal ping reply time, give ping reply " PING REPLY 1 day 1 second....just kidding, your ping reply time is 1 second (or whatever it really is)".

Thanks

#121246 25/05/05 08:57 PM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
here's what I have so far. I tried to use $ctime(%pingday) and that didn't work. How do I get it to say "[Blake PING reply]: 1 day 1 sec" or whatever it is? Ideally, I want the final output to be: "[Blake PING reply]: 1 day 1 sec....just kidding, your ping reply is 1 sec"

ctcp *:ping:*:{ var %pingday = $ctime + 86400 | raw -q notice $nick : $+ $chr(1) $+ PING %pingday | echo 5 -a hello %pingday | haltdef }

Thanks. (BTW, the echo is just something i did to test that it calculated %pingday correctly)

Last edited by bwr30060; 25/05/05 09:00 PM.
#121247 26/05/05 12:02 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
havent read if thsi was finished and just saw u asking how to add a value, you did do it correctly for a var, ie VAR %x = %y + 1234, but you can also do it inline of the code using $calc(%y + 1234), as in...

ctcp *:ping:*:{ raw -q notice $nick : $+ $chr(1) $+ PING $calc($ctime + 86400) | haltdef }

hope i helped in some way.

#121248 26/05/05 01:34 AM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
I think I've identified what I need to change to get what I want. If I hard code $ctime(January 1 1970 00:00:00) as the ping time, it returns [Blake PING reply]: 310292hrs 33mins 32secs like it's the person's lag time, so I just need a way to make a variable that equals yesterday's date so I can basically write (and excuse if I get the identifier names wrong):

ctcp *:ping:*: { ctcpreply $nick ping $ctime($month %olddate $year $time) | haltdef }

Thanks.

#121249 26/05/05 03:19 AM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Just to let you know, I got my ping script figured out, except for the part about giving you the real ping time, which isn't a big deal. Here's what I ended up using:

ctcp *:ping:*: { set %day $calc($date(dd) - 1) | ctcpreply $nick ping $ctime($date(mmmm) %day $date(yyyy) $date(HH:nn:ss)) | haltdef }

Thanks for your help

By the way, I know it's using yesterday's date. I wanted to make a fun ping that gave a ping reply of about 24 hours 1 sec. If anyone knows how to include a part in that line to give the real ping reply time, I'd appreciate it.


Link Copied to Clipboard