Hello all... i've searched the forums for the answer and didnt find anything so forgive me if its out there and i just didnt find it.
What i'm trying to do is have an character follow mine around and attack whatever i attack... basically it would look for something like "Rodrick moves to attack <monster>" ... i have no idea how to pull the monster name in and have it spit out 'attack zombie' or 'attack wolf'
Thanks in advance for any help or pointers.
-Rod
Help with triggers
Re: Help with triggers
This is what i am trying... from what i understand it should be working, but it never fires
^Bob moves to attack (\w+)$ -- perl regex
Send("attack " .. matches[2])
^Bob moves to attack (\w+)$ -- perl regex
Send("attack " .. matches[2])
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Help with triggers
Is there any punctuation at the end of the sentence? "(\w+)" catches word characters but I suspect that does not include a terminating period/full-stop '.' and the '$' is a meta-character meaning "end-of-line" so the trigger will not fire if there is that character ('.') on the end!
Re: Help with triggers
Yep... the line actually looks like:
Bob moves to attack nasty giant rat.
so looks like what i have will not work at all.
Also tried using:
Bob moves to attack (\w[\w ]*\w).$
thinking that would catch the spaces, and multiple words.. still no good.. I am regex handicapped.
Bob moves to attack nasty giant rat.
so looks like what i have will not work at all.
Also tried using:
Bob moves to attack (\w[\w ]*\w).$
thinking that would catch the spaces, and multiple words.. still no good.. I am regex handicapped.
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Help with triggers
Humm, what about:
For "Bob moves to attack the hairy-legged, blue spider."
matches[2] will contain "the hairy-legged, blue spider"...
Try https://regex101.com/ perhaps that can help you deal with your condition?
Code: Select all
^Bob moves to attack (.*).$
matches[2] will contain "the hairy-legged, blue spider"...
Try https://regex101.com/ perhaps that can help you deal with your condition?