mIRC Home    About    Download    Register    News    Help

Print Thread
Help with code #269288 18/08/21 12:06 PM
Joined: Aug 2021
Posts: 1
Q
qr22 Offline OP
Mostly harmless
OP Offline
Mostly harmless
Q
Joined: Aug 2021
Posts: 1
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 }
}

Re: Help with code [Re: qr22] #269294 21/08/21 02:43 PM
Joined: Feb 2011
Posts: 386
K
KindOne Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 386
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 }
}


irc.swiftirc.net #msl (mIRC Scripting Language)
Re: Help with code [Re: qr22] #269297 21/08/21 05:07 PM
Joined: Jan 2012
Posts: 174
Epic Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2012
Posts: 174
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]



🅸🆁🅲 - 𝔦'𝔱𝔰 𝔸 𝕂𝖎ɴ𝙙 ᴏ𝙛 𝕄𝙖𝖌𝙞𝙘