Search found 4 matches

by CRCfail
Tue Jun 10, 2014 5:23 am
Forum: Help Forum
Topic: How do I get a certain number of characters in a variable?
Replies: 9
Views: 8078

Re: How do I get a certain number of characters in a variabl

I have run across "Cyclopes", which is suprisingly the correct plural form.
by CRCfail
Sat Jun 07, 2014 1:44 pm
Forum: Help Forum
Topic: How do I get a certain number of characters in a variable?
Replies: 9
Views: 8078

Re: How do I get a certain number of characters in a variabl

I fixed it by having both these lines:

There (is|are) (a|an|two|three|four|five|six|seven|eight) (\w+)
There (is|are) (a|an|two|three|four|five|six|seven|eight) (\w+)s

So now it trigger on "There are two orcs" for attack orc, and "There are two stone giants" for attack stone.

Thanks for your help!
by CRCfail
Sat Jun 07, 2014 1:26 pm
Forum: Help Forum
Topic: How do I get a certain number of characters in a variable?
Replies: 9
Views: 8078

Re: How do I get a certain number of characters in a variabl

Okay the (w+)s works to grab "troll" out of "trolls" but when a phrase like "two stone giants" comes up, it won't grab "stone" because there's no S.

I'm having a difficult time understanding lua characters of ^ , ? , * , \ , etc.

I can't seem to find these in the manual either.
by CRCfail
Fri Jun 06, 2014 9:39 am
Forum: Help Forum
Topic: How do I get a certain number of characters in a variable?
Replies: 9
Views: 8078

How do I get a certain number of characters in a variable?

For example, if there is one troll:

Window:
There is a troll here.

Trigger:
There is a (\w+) here.
Action:
send("attack " .. matches[2])

Works just fine to kill one troll. But where there are two, three, four, etc:

Window:
There are two trolls here.
Trigger:
There are two (\w+) here.
Action ...