mIRC Homepage
Posted By: Kex Specifics - 07/07/18 01:53 PM
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/
Posted By: maroon Re: Specifics - 07/07/18 03:24 PM
:*!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
Posted By: Kex Re: Specifics - 07/07/18 06:00 PM
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?
Posted By: maroon Re: Specifics - 07/07/18 06:49 PM
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

Posted By: Kex Re: Specifics - 08/07/18 11:36 AM
Huge thanks to you for clarification, all works fine. Solved
© mIRC Discussion Forums