mIRC Homepage
Posted By: Ninko Reply in the same way - 11/07/09 11:12 PM
Hi there,
Is there a simple way of replying to someone with the same method they contacted you. For example, if they contacted you via PM, have the script trigger in PM. And if they contacted you in the channel, again have the script trigger in the channel.

I know you could have two scripts for each way eg

Code:
on 1:TEXT:!test:?:{
  msg $nick etc
}
on 1:TEXT:!test:#:{
  msg $chan etc
}


But I wanted to see if there was another way perhaps, so that this script would reply in the way they used...

Code:
on 1:TEXT:!test:*:{
  msg $nick/$chan etc
}


Thanks


Ninko
Posted By: DJ_Sol Re: Reply in the same way - 12/07/09 12:17 AM
Code:
on *:text:*:*:{
if (!$chan) msg $nick etc.
else msg # etc.
}


It's been a long time since I've had to mess with normal IRC queries, but I think this would work.
Posted By: RusselB Re: Reply in the same way - 12/07/09 02:09 AM
Alternatively
Code:
on *:text:*:*:{
.msg $target <message>
}

Posted By: Ninko Re: Reply in the same way - 13/07/09 01:55 AM
Ok, thanks for both your help.

Take care


Ninko
Posted By: Doqnach Re: Reply in the same way - 14/07/09 05:23 AM
isn't $target == $me in the case of a PM?
Posted By: RusselB Re: Reply in the same way - 14/07/09 05:43 AM
Not unless you are pming yourself.
$target is the sender's nick, although you could use $nick for pm's and $chan for channels, as was suggested previously.

Posted By: eXonyte Re: Reply in the same way - 28/07/09 08:58 PM
Actually, $target is the target of the event. In an on TEXT for a channel message, it is $chan. In an on TEXT for a private message, it will be $me because you are the target of the event.

If you want a single identifier that gives you either, use:
Code:
$iif($chan,$chan,$nick)
© mIRC Discussion Forums