Hey guys, I've been working on an autoreply function.
I assume you guys are slightly familiar with twitch atleast.
I have this function for commands:
Code:
on *:TEXT:!cmd*:#: {
  if ($nick isop $chan) {
    if ($left($3,1) == !) {
      if ($2 == add) {
        if (($($+(%,command.,$3),2))) { 
          /msg $chan command already exists. | return
        } 
        else { 
          set -n %command. $+ $3 $4- | /msg $chan Command $3 set to: $4- | return 
        }
      } 
      else if ($2 == remove) {
        if (($($+(%,command.,$3),2))) { 
          unset %command. $+ $3 | /msg $chan Command $3 removed. | return 
        } 
        else { 
          /msg $chan command does not exist. | return
        }
      }
      /msg $chan syntax: !cmd (add/remove) !<cmd> <text to type if add> | return
    }
    /msg $chan syntax: !cmd (add/remove) !<cmd> <text to type if add> | return
  }
}



as you can see I'm using variables and not a File.

well I wanted to do the same with Autoreply, as in
!autoreply add WORD woop woop
when someone says
lol lol word lol lol
it should say woop woop.


THIS WORKS because I'm using a while loop going over every word in the list
Code:
var %i = 1
while (%i <= $0) {
if ((($($+(%,autoreply.,$+($,%i)),2)) { msg $chan %autoreply. [ $+ [ $+($,%i)) ] ] }
INC %i
}


but this seems like WAY too much work. I think there's a better way to do this I just don't know how.

I also want it to work differently.
for example if I type:
!autoreply add *where*cookies* HERE THEY ARE

it should work on any sentence containing where and cookies in order, so multiple words in one sentence.
how can I make it so it recognizes the asterisk? ( as in, as if *where*cookies* was in an On *:text:*where*cookies*:#: )

thanks in advance!