mIRC Homepage
Posted By: Cheech $nick (multiples) - 15/12/02 03:57 PM
i have a !pingme script On Text i dont chat in the main stream much and i exclude those rooms so i added a !pingus just for something to do which works fine other than it doesnt send the lag to the users in the channel it only notices them i have $nick in the !pingme script and if you type !pingus it will notice every user in the channel so can you do like $nick(1,100) etc ? or something with a * to send each lag to the channel which flooding isnt an issue as the channel limit is 10 and wont work in the other channels thx in advance

here is the ctcpreply portion
On *:ctcpreply:ping *:{
set %pt $calc($ctime - $2)
if ( $nick == $me ) { /msg $active 12Your lag is04 %pt seconds. 12 $me }
else { /notice $nick 04Your lag is12 $calc($ctime - $2) seconds. | /msg %pchan 12Your Lag is04 %pt seconds.12 %pnick }
smile
Posted By: FunChatter Re: $nick (multiples) - 15/12/02 04:50 PM
I'm not really sure I understand what you want to do, want to ping everyone in the channel? /ctcp #ChanneName ping
If I got it wrong please explain it again.
Posted By: Cheech Re: $nick (multiples) - 15/12/02 06:21 PM
yeah thats correct but i want the reply's to go to the channel in the form i pasted above in my channel if you type !pingme the remote will ping you then it will notice the response to you and it will also send the ping response to the channel in the form 12Your Lag is04 10 seconds.12 Cheech i want the same channel response to return for multiple nicks when !pingus is type and the ping would be /ping #channel if there are 5 users i want it to tell each user thier ping response in the channel the $nick doesnt do that it only sends the first one to the channel however it does notice each user ? does that make sense ? mebbie this will help
on 1:TEXT:!pingus:*: {
set %pchan $chan
set %pnick $nick(%pchan,0,a)
/ping $chan
thats what triggers the even then the ctcpreply portion is as i posted above thx again smile
Posted By: Dana Re: $nick (multiples) - 15/12/02 06:41 PM
We'll need to see the rest of the script. Currently, the reason that it notices the user but doesn't send the result to the channel is because %pchan isn't defined. A ctcp reply is not channel specific so the script doesn't know what channel to send the message to.

Also, you already mentioned that this is only supposed to work for a single channel. Then you can try just setting %pchan to that channel. E.g.:

/set %pchan #whatever-channel-name
Posted By: Cheech Re: $nick (multiples) - 15/12/02 06:56 PM
bah now i am even more confused here is the whole thing

on 1:TEXT:!pingme:*: {
if ( $chan == #whatever ) { goto end }
else {
/ctcp $nick PING
set %pnick $nick
set %pchan $chan
}
:end
}
on 1:TEXT:!pingus:*: {
set %pchan $chan
set %pnick nick(%pchan,0,a)
/ctcp $chan PING
}
On *:ctcpreply:ping *:{
set %pt $calc($ctime - $2)
if ( $nick == $me ) { /msg $active 12Your lag is04 %pt seconds. 12 $me }
else { /notice $nick 04Your lag is12 $calc($ctime - $2) seconds. | /msg %pchan 12Your Lag is04 %pt seconds.12 %pnick }
}
it works fine on the notice end but when it goes to msg the user in the channel it msgs the last call to the variables as set in the !pingme portion and it sends multiple replys to that person in the channel !pingme was typed in so if say an hour ago john typed !pingme in #blah then an hour later bob types !pingus in # test bob would get this response
john your lag is 33 secs
john your lag is 66 secs
etc etc and all of that would go to #blah rather than #test
i hope that makes sense thx smile
Posted By: Dana Re: $nick (multiples) - 15/12/02 09:14 PM
Actually, no, I'm still not sure if I understand correctly .. You *don't* want the script to work in the channel #whatever? Or you do want it to work there? Is this script only intended for one channel?

Anyway, this is what you could try from what I think I grasp. :P

Note: Make sure that you clean out %pchan and %pnick before you start using this script. /unset %pchan,%pnick

Code:
On *:TEXT:!pingme:*:{
  if ($chan == #whatever) { return } 
  var %tok = $calc($numtok(%pnick,46) + 1)
  .ctcp $nick ping
  .set %pnick $instok(%pnick,$nick,%tok,46)
  if (#) { .set %pchan $instok(%pchan,#,%tok,46) }
  else { .set %pchan $instok(%pchan,none,%tok,46) }
}
On *:TEXT:!pingus:#:{
  .ctcp $chan ping
  var %i = 1, %tok = $numtok(%pnick,46)
  while (%i <= $nick(#,0)) { 
    set %pnick $instok(%pnick,$nick(#,%i),$calc(%tok + %i),46)
    set %pchan $instok(%pchan,#,$calc(%tok + %i),46)
    inc %i
  }
}
On *:CTCPREPLY:ping *:{ 
  var %pt = $calc($ctime - $2)
  if ($istok(%pnick,$nick,46)) {
    var %loc = $findtok(%pnick,$nick,1,46)
    var %chan = $gettok(%pchan,%loc,46)
    .notice $nick Your lag is %pt seconds.
    if (%chan != none) { msg %chan Your lag is %pt seconds, $nick }
    set %pnick $deltok(%pnick,%loc,46)
    set %pchan $deltok(%pchan,%loc,46)
  }
}
On *:DISCONNECT: unset %pchan,%pnick

Not sure if this is going to work since I can't test it. However, I hope that you get the general idea.
Posted By: Cheech Re: $nick (multiples) - 15/12/02 09:32 PM
correct i do NOT want the script to work in #whatever if i understand you correctly i need to always unset the 2 variables ? at the end of each calling script ? so if the first script sets %pnick & %pchan when the next script triggers it wont reset them on its own ?
Posted By: Dana Re: $nick (multiples) - 15/12/02 10:12 PM
No, just unset the variables before you ever copy the script into remotes and start using it. After that, it should take care of itself.
© mIRC Discussion Forums