Basic trigger script

Post Reply
jds760
Posts: 2
Joined: Mon Nov 15, 2010 5:28 am

Basic trigger script

Post by jds760 »

Ok so I am pretty new at this stuff and need a wee bit of help getting myself sorted out. What I am trying to do is see if my target gets up and only my target.

so my trigger reads thusly: ^(\w+) stands up and stretches (his|her) arms out wide\.$

and my script is:
if matches[2] == target then
echo("TARGET IS UP")
end

If you can help it would be greatly appreciated

Glass
Posts: 16
Joined: Mon Jun 28, 2010 10:00 pm

Re: Basic trigger script

Post by Glass »

Help with what? What's it doing wrong?

jds760
Posts: 2
Joined: Mon Nov 15, 2010 5:28 am

Re: Basic trigger script

Post by jds760 »

It's not echoing the target is up, my target stands up and nothing happens and I am not quite sure why

Glass
Posts: 16
Joined: Mon Jun 28, 2010 10:00 pm

Re: Basic trigger script

Post by Glass »

It can be a number of factors; I'm afraid the information you've provided is a little sparse. I'm willing to bet, though, that your targets are input lowercase, and the trigger is, of course, checking for a proper-cased name. Try string.lower(matches[2]).

Lucky24
Posts: 52
Joined: Sun Sep 12, 2010 1:50 am

Re: Basic trigger script

Post by Lucky24 »

Also, I usually go for a "try to find the target string anywhere in matches[2]", with a string.find(matches[2],target). Putting it together would look like:
string.find(string.lower(matches[2]),target)

This returns true (actually the start and end position) if the target string can be found anywhere in the matches[2] string.

Post Reply