Help with certain Triggers.

by Lysandus

Back to Mechanic's Corner.

Lysandus2007-01-29 17:41:46
I'm using MUSH and we were on an aethertrip today, however I got a slight problem with this:

(Ship): (.*?) says, "TARGET: (.*?)."

In the SEND box:
send "turret target creature %2"
setvariable "target", "%2"

Then Send to: Script

then tick enabled, regular expressions and ignore case.

However, whenever our combatteer leader mentioned the target, it never nappend.

help.gif
Unknown2007-01-29 18:11:04
QUOTE(Lysandus @ Jan 29 2007, 06:41 PM) 378458
(Ship): (.*?) says, "TARGET: (.*?)."

I don't have time to test this, but I think this is what's going on: Parentheses in a regular expression mean "capture this pattern as a wildcard variable". Consequently "(Ship)" matches on "Ship" and stores it to wildcard %1. Try escaping the parentheses: ^\\(Ship\\): (.*?) says, "TARGET: (.*?)."
Razenth2007-01-29 18:33:52
The "Convert to Regular Expression" button works wonders.
Theomar2007-01-29 20:10:37
Put into the "Trigger" box:
CODE
(Ship): * says, "TARGET: *."


and click "Convert to Regular Expression."

Use that whenever you need a regex.

Likewise:
CODE
\\(Ship\\)\\: (.*) says\\, "TARGET\\: (.*)\\."

will work.