mIRC Home    About    Download    Register    News    Help

Print Thread
#268199 10/12/20 03:20 PM
Joined: Dec 2016
Posts: 18
A
apoio82 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2016
Posts: 18
Good Morning
I have a doubt:
As I do for the first time that I see a person's message on the channel I send an automatic message.
I just want to send her the first time she talks on the chat.
Can someone help me?

apoio82 #268201 10/12/20 05:15 PM
Joined: Jan 2012
Posts: 299
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2012
Posts: 299
Good evening. Could you describe your question or problem in more detail, what exactly do you want so that the people helping you can find a suitable solution to help you.
Do you want to be taught how to do this using a script? Or do you want a completely new scenario to be created for you, according to your idea?


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Epic #268202 10/12/20 05:31 PM
Joined: Dec 2016
Posts: 18
A
apoio82 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2016
Posts: 18
Ex: The person arrived on the channel and said hi or hello ... no matter the first word or phrase she writes, the bot sends a reply. but only the first time she writes.

apoio82 #268203 10/12/20 06:47 PM
Joined: Jan 2012
Posts: 299
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2012
Posts: 299
The simplest solution would be to create such a small script. This code must be inserted into the scripts editor. To do this, press the key combination "ALT+R":

Code
on *:TEXT:*:#: if (!$hget(onegreet,$nick)) { .hadd -mu3600 onegreet $nick 1 | /msg $chan $nick $onegreet }
alias -l onegreet {
  var %og_rand $rand(1,3)
  if (%og_rand == 1) var %og_mess = Hello!
  if (%og_rand == 2) var %og_mess = Hi my friend!
  if (%og_rand == 3) var %og_mess = Nice to see you here!
  return %og_mess
}

Explanation:

The bot will check in the hash table for each user who writes any a message on the channel with help "if (!$hget(onegreet,$nick))".
If the user nickname there is not, then he will enter this nickname in the hash table ".hadd -mu3600 onegreet $nick 1". (If you disable the bot, then all hash tables will be erased).
Where the value "3600" will be the number of seconds for how long necessary to remember and keep the nickname of this user and not reply to him. After the expiration of time, table is deleted. (You can change this number).
The bot responds with the command "/msg $chan $nick $onegreet". The identifier "$onegreet" works through alias of the same name "onegreet", where you can create any number of random messages.
In this example, there are only 3 messages and, accordingly, the identifier "$rand(1,3)" randomly selects one of them in the range 1-3. If you add more messages, do not forget to change the value "$rand(1,?)".
If the random number is 1 "if (%og_rand == 1)" then, accordingly, the first sentence is entered into the value of the variable "%og_mess". And so on.
And at the end the "return" command returns a variable "%og_mess" with a message in for identifier "$onegreet".

I think everything is simple here and I hope it is clear.



🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Epic #268204 10/12/20 09:55 PM
Joined: Dec 2016
Posts: 18
A
apoio82 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2016
Posts: 18
Thank you.
How to put a specific list of people?
I don't need anyone to be added if I have this specific list. Other than that the rest is perfect.

apoio82 #268205 10/12/20 10:39 PM
Joined: Jan 2012
Posts: 299
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2012
Posts: 299
Then most likely you need to do it like this:

Code
on *:TEXT:*:#:{
  if ($onenicks($nick)) {
    if (!$hget(onegreet,$nick)) {
      .hadd -mu120 onegreet $nick 1
      /msg $chan $nick $onegreet
    }
  }
}
alias -l onenicks {
  %og_nicks = Epic,apoio82,Nick1,Nick2,Nick3
  if ($istok(%og_nicks,$1,44)) return $1
}
alias -l onegreet {
  var %og_rand $rand(1,3)
  if (%og_rand == 1) var %og_mess = Hello!
  if (%og_rand == 2) var %og_mess = Hi my friend!
  if (%og_rand == 3) var %og_mess = Nice to see you here!
  return %og_mess
}

In the alias "onenicks" in the "%og_nicks" variable value, specify all the necessary nicknames, with which this script should interact, separated by commas. All other nicknames will be ignored.

If you want to remove the time limit for a new answer and stop writing nicknames to the hash table, then delete unnecessary lines so that part of the code looks like this:

Code
on *:TEXT:*:#:{
  if ($onenicks($nick)) {
    /msg $chan $nick $onegreet
  }
}




🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples

Link Copied to Clipboard