|
Sylmannemo Beginner
Joined: 20 Oct 2006 Posts: 18
|
Posted: Fri Oct 20, 2006 11:06 pm
Regex/ Pipeline character | |
Alright, so how to explain this. first off, I'm far from experienced so please don't blow anything here to out of proportion.
I'm trying to design a temp trigger off of the basis of a variable line that I receive.
You lunge towards %w with a strong broadsword, but miss.
With a lightning-quick motion, you slash %w with a strong broadsword.
You swing a strong broadsword at %w with a powerful strike.
You slash viciously into %w with a strong broadsword.
Those are the four lines I can receive and I'm trying to initiate a timer to execute another action based around that...The alias thus far is...
#temp {^You lunge towards %w with a strong broadsword, but miss.$|^With a lightning-quick motion, you slash %w with a strong broadsword.$|^You swing a strong broadsword at %w with a powerful strike.$|^You slash viciously into %w with a strong broadsword.$} {
#alarm +5.4 {
blade spin @t
#temp {You have recovered balance.} {
strike
strike
sdrop
}
}
}
The carots and dollar signs are coming up in blue and the %w in pink as I expected, but I'm not sure if I need to edit something in my character preference or what, but if I'm reading the help file in regards to REGEX correctly, isn't this the character I should be using? |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Oct 20, 2006 11:28 pm |
Just a guess but try doing it with out the ^ and $, I think that may confusing it some how.
|
|
_________________ Asati di tempari! |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Oct 20, 2006 11:35 pm |
Try this (and you are using zscript not regex) First enclose the list in the squiggly brackets {} and then ust use 1 ^ before { and one $ after }
#temp {^{You lunge towards %w with a strong broadsword, but miss.|With a lightning-quick motion, you slash %w with a strong broadsword.|You swing a strong broadsword at %w with a powerful strike.|You slash viciously into %w with a strong broadsword.}$} {
#alarm +5.4 {
blade spin @t
#temp {You have recovered balance.} {
strike
strike
sdrop
}
}
}
edit: fixed trigger to use string range match instead of range match |
|
|
|
Sylmannemo Beginner
Joined: 20 Oct 2006 Posts: 18
|
Posted: Fri Oct 20, 2006 11:51 pm |
Awesome, the second modification involving the [] worked perfectly. Thanks a million.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Oct 21, 2006 5:59 am |
[] actually defines a range of characters, so your pattern would probably fire off of something like the following:
YYYYYYYYYYY
You miss.
{} defines a list of string patterns, rather than characters, and you were missing a pair in your #TEMP trigger pattern. It's possible that the two bracket types would work interchangeably, but I don't believe this to be the case. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Oct 21, 2006 9:11 pm |
Ooops......
Your right Matt thouse []'s should be a set of {}'s
Original post edited to reflect this |
|
|
|
|
|