I've been trying to make a script that, when someone says a word (Say, "pickle"), it will trigger (on 1:TEXT:*pickle*:#:), and then find the word in the post, along with a second word. I'm trying to make it so that this script essentially removes any words between two words. Basically, if you say the sentence, "I have a pickle, a cucumber, two carrots and a handful of greenbeans," it will pick up on Pickle, then figure out what number word it is in the post, and remove everything between "pickle" and "carrots and a," leaving, "I have a handful of greenbeans." Obviously not the actual text, but that's the idea.
Originally, I had a script:
on 1:TEXT:*Pickle*:#: { set %textlength 1 | set %Wordnum 1 | .timertext 0 0 /herewego $1- }
alias HereWeGo {
if ($eval(%Wordnum,2) != Pickle) { inc %Wordnum }
else { msg $active The words after Pickle were: $eval($ $+ $calc(%wordnum + 1) $+ -,2)
Which got the data for the text after Pickle. Using the same thing but replacing "pickle" with "carrots and a" and:
else { msg $active The words before carrots and a were: $eval($ $+ 1- $+ $calc(%wordnum + 1),2)
Made it so I could get the words before carrots and a, as well.
The problem was that I couldn't get both of the two in the same line, much less get them to combine the data.
So, is there an easier way to find out what number a word is? Some simple identifer, or something?
Note: I have an extra variable set in this. I had to rewrite it from memory when I posted it here, so I've forgotten the exact wording, but it used both variables and worked properly.