mIRC Home    About    Download    Register    News    Help

Print Thread
#213922 11/07/09 11:12 PM
Joined: Jun 2004
Posts: 139
N
Ninko Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: Jun 2004
Posts: 139
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

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
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.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Alternatively
Code:
on *:text:*:*:{
.msg $target <message>
}


Joined: Jun 2004
Posts: 139
N
Ninko Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: Jun 2004
Posts: 139
Ok, thanks for both your help.

Take care


Ninko

Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
isn't $target == $me in the case of a PM?


If it ain't broken, don't fix it!
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.


Joined: Aug 2007
Posts: 12
E
Pikka bird
Offline
Pikka bird
E
Joined: Aug 2007
Posts: 12
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)


Link Copied to Clipboard