Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Sylmannemo
Beginner


Joined: 20 Oct 2006
Posts: 18

PostPosted: 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?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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
_________________
Zmud Support Library
Zmud Knowledge Base

Last edited by nexela on Sat Oct 21, 2006 9:13 pm; edited 1 time in total
Reply with quote
Sylmannemo
Beginner


Joined: 20 Oct 2006
Posts: 18

PostPosted: Fri Oct 20, 2006 11:51 pm   
 
Awesome, the second modification involving the [] worked perfectly. Thanks a million.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net