mIRC Home    About    Download    Register    News    Help

Print Thread
Specifics #263312 07/07/18 01:53 PM
Joined: Oct 2017
Posts: 14
K
Kex Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Oct 2017
Posts: 14
Good afternoon, I have an example of a bot command, User write this command in chat !codeword, and bot do some stuff
Code:
on *:TEXT:*!codeword*:#: {msg $chan  $nick says hello %nick1  $+
} 


Is it possible to make the bot keep track target (@TargetNickName for to say hello.

To get the following: user write !codeword @NicknameWhomHeWant say something, and bot will do this command, but instead %nick1 he take @NickNameWhomHeWant which user writing.

Have a nice day to all \o/

Re: Specifics [Re: Kex] #263314 07/07/18 03:24 PM
Joined: Jan 2004
Posts: 1,187
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,187
:*!codeword*:

by having the asterisks like this, it responds to test!codeword and to !codewordy and when !codeword is not followed by anything. You can make it respond only if it begins with codeword and has at least 3 words like:

Code:
on *:TEXT:!codeword & *:#: {msg $chan  $nick says hello %nick1  $+
}


You can change :#: to :#channelname: to prevent it from responding in other channels.

If the channel message is:

!codeword @targetnick message

then the 1st word is $1 and the 2nd word is $2, so you would use $2 instead of $nick

Re: Specifics [Re: Kex] #263315 07/07/18 06:00 PM
Joined: Oct 2017
Posts: 14
K
Kex Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Oct 2017
Posts: 14
But "%nick1" is it random user from userlist.
I just want the bot to do this, user tell !codeword Say hello @specificsUserName and bot do this to @specificsUserName instead
%nick1.For this code is impossible?

Re: Specifics [Re: Kex] #263316 07/07/18 06:49 PM
Joined: Jan 2004
Posts: 1,187
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,187
1. I forgot to mention that the curly-brace can touch the event's colon preceding it, but should should not be touching the characters following it.

2. I don't understand from your example what you're wanting. I thought you were saying that if someone says "!codeword @nickname" that the bot should say "$nick says hello to @nickname", where @nickname being the 2nd word would be represented by $2.

If you're wanting a random nick from a channel which is not either the bot nor the nick using !codeword, perhaps something like:

Code:
//var %randnick | while (1) { var %randnick $nick($chan,$rand(1,$nick($chan,0))) | if ($istok($me $nick,%randnick,32)) var %randnick | else break } | echo -a %randnick


Re: Specifics [Re: maroon] #263321 08/07/18 11:36 AM
Joined: Oct 2017
Posts: 14
K
Kex Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Oct 2017
Posts: 14
Huge thanks to you for clarification, all works fine. Solved

Last edited by Kex; 08/07/18 11:36 AM.