mIRC Home    About    Download    Register    News    Help

Print Thread
#269288 18/08/21 12:06 PM
Joined: Aug 2021
Posts: 7
Q
qr22 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Q
Joined: Aug 2021
Posts: 7
So I need help with a script that triggers only when certain keywords are said (in this case "hello" and "bye). I've put the code in "Script Editor" under "Remote" but nothing happends. I also tried //load -rs $file.mrc
//run $file.mrc, it manages to load the script but nothing happends when I try to run it. All help is appreciated

on *:TEXT:*hello,bye*:#channel: {
; This will watch for the word in all channel messages.
if (word isin $1-) { echo -a $nick used the word }
}

qr22 #269294 21/08/21 02:43 PM
Joined: Feb 2011
Posts: 451
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 451
Your current code can only executing on this:

[10:34:50] <KindOne> hello,bye word
KindOne used the word

[10:34:55] <KindOne> ahello,byeo word
KindOne used the word


Its searching for for the actual text that matches "hello,bye", then its looking for the actual word "word".

You want something like this:

Code
on *:text:*:#channel:{
  ; This will watch for the word in all channel messages.
  if (hello isin $1-) || (bye isin $1-) { echo -a $nick used the word }
}

qr22 #269297 21/08/21 05:07 PM
Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
If I understand your question correctly, then you want to make the script respond to certain words written by users on your channel.

You can try using such an interesting and small script construction:
Code
on *:TEXT:*:#channel:{
  var %words = hello,bye
  var %text $remove($strip($1-),$chr(96),$chr(39),$chr(94),$chr(42),$chr(34),$chr(63),$chr(33),$chr(64),$chr(35),$chr(36),$chr(37),$chr(38),$chr(58),$chr(59),$chr(126),$chr(45),$chr(61),$chr(43),$chr(95),$chr(40),$chr(41),$chr(91),$chr(93),$chr(123),$chr(125),$chr(124),$chr(92),$chr(47),$chr(44),$chr(46))
  var %i 1 | while (%i <= $numtok(%words,44)) { var %s $gettok(%words,%i,44) | if ($istok(%text,%s,32)) { %w = %w %s } | inc %i }
  if (%w) { .echo -a 00,14Words $+(,$nick,) used:04 %w | unset %w }
}

In the variable "%words = hello,bye" you must list, separated by commas, all the words that you want to catch in messages.

The script will collect all the search-flagged words that will be found in the message (separated by a space) and display them in the echo message.

Screenshot:
    [Linked Image from i.ibb.co]



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

Link Copied to Clipboard