mIRC Homepage
Posted By: TyrantX ctcp help - 28/04/05 04:25 AM
me again, i must get annoying. Alright im trying to make my ctcp's look custom, did that, then i realized that when people would ctcp me, they wouldnt get a reply, so ive been fooling around with it trying to figure it out. here is what i have so far.
Code:
ctcp ^1:*:*:{
  if (PING isin $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick PING $2- | halt }
  if (TIME isin $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick TIME $2- | halt }
  if (VERSION isin $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick VERSION script | halt }
  if (FINGER isin $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick FINGER $2- | halt }
  else { echo -ae [CTCP / $nick $+ ]  $1- | halt }
}

when i first tested the PING thing it worked but then after that it wouldnt work again, the VERSION one works fine. Basically i just want to make my ctcp appear custom on my screen, then to reply to whoever ctcp's me, and if they /ctcp some message, just to echo it in the format i have. Problems, it doesnt reply, it does a ctcpreply but nothing after that it shows up like [nick TIME reply]: NOTHING. also on my side when someone ctcp's me, it echo's it two times. AND i think it messes up when someone tries to dcc send me files. if it wouldnt be too much of a hassle help would be appreciated. thanks
Posted By: MikeChat Re: ctcp help - 28/04/05 06:54 AM
the ctcp events are each unique
PING is the only one that has data sent from the requesting client, and that is sent back so it can be compared at the originators client so a comparison can be made ($time is sent, and compared when the reply comes back to $ctime to see the difference)
you can make your own PING request using $ticks for higher accuracy, but $ctime is the convention.

Code:
  ctcp ^*:PING:{ echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick PING $2 | haltdef }
  ctcp ^*:TIME:{ echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick TIME $asctime(dddd) the $ord($asctime(d)) of $asctime(mmmm h:nnTT) | haltdef }
[color:red]  ctcp *:VERSION:{ echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick VERSION script }[/color]
  ctcp ^*:FINGER:{ echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick FINGER THIS | haltdef }


Note: the default reply for VERSION sent by the client cannot be halted, but you can have your script name send at the same time.

you had an "else" in there, and that is what was stopping your DCC from working.
Posted By: xDaeMoN Re: ctcp help - 28/04/05 07:01 AM
Try this

Code:
 ctcp ^*:*:*: {
  if (PING == $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick PING $2-  }
  elseif (TIME == $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick TIME $fulldate  }
  elseif (VERSION == $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick VERSION script }
  elseif (FINGER == $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick FINGER Finger!  }
  else echo -ae [CTCP / $nick $+ ]  $1- 
  haltdef
} 


VERSION cannot simply be altered unless you use DLL or an addon to change the version.
Posted By: TyrantX Re: ctcp help - 29/04/05 08:08 AM
thanks for the replies fellas, i messed around with it more, came out with this.
Code:
ctcp ^*:*:*: {
  if (PING == $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick PING $ctime | halt }
  elseif (TIME == $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick TIME $fulldate | halt }
  elseif (VERSION == $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick VERSION scriptname | halt }
  elseif (FINGER == $1) { echo -ae [CTCP / $nick $+ ] $1 | .ctcpreply $nick FINGER $name ( $+ $email $+ ) idle $idle seconds | halt }
  elseif ($1 != DCC) { echo -ae [CTCP / $nick $+ ]  $1- | halt }
}

that code seems to work fine.
© mIRC Discussion Forums