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
Tech
GURU


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

PostPosted: Sun Jun 23, 2002 3:46 pm   

Trigger Problem
 
I have the following trigger pattern which works perfectly when I run it as just a trigger.

Pattern: %d%s&%dItem.Price%s&%dItem.AC%s%d%s&%wItem.Type%s(%w)%s&Item.Auto%s({ |*})%s(%w*)

However when I put the same trigger in a Trigger class, I get a syntax error here.

Pattern: %d%s&%dItem.Price%s&%dItem.AC%s%d%s&%wItem.Type%s(%w)%s&Item.Auto%s({ |*})%s(%w*)

However my original version, which doesn't quite do what I want it do doesn't throw a syntax error.

Pattern: %d%s&%dItem.Price%s&%dItem.AC%s%d%s&%wItem.Type%s(%w)%s&Item.Auto%s(?)%s(%w*)

Any suggestions as to what the problem is?

The pattern should match either of the following.

Text1:
 9     7800    7  3   Shield    Mithril      Yes   *  Exotek riot shield

Text2:
 13    190     2  3   Pants     Coretex      Yes      Protex leggings 


Asati di tempari!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Jun 23, 2002 4:05 pm   
 
I tried pasting this pattern into a new trigger and had no problem doing so. I didn't get a syntax error either at the root level or in a subclass. However, you should note that * is a wildcard (you even use it yourself elsewhere in the pattern). Since you are attempting to actually match the * character, as opposed to any character, you should precede it with a ~.

Since this is clearly a fixed width pattern, you might be better served to use the &nn pattern, where nn is a number specifying how many characters to capture.

LightBulb
Senior Member
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jun 23, 2002 4:49 pm   
 
This is the way to go:
Pattern: %d%s&%dItem.Price%s&%dItem.AC%s%d%s&%wItem.Type%s(%w)%s&%wItem.Auto%s(?)%s(*)

Matching the * with { |*} works as well since anything in the braces is treated literally. The main change was to the capture of Item.Auto, I set that to %w. I am assuming it displays Yes or No and they are only 1 word. The default when using the direct variable capture is * which was picking up more then was wanted.
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