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
aslanthekat
Novice


Joined: 17 Sep 2007
Posts: 44
Location: Missouri

PostPosted: Thu Jun 18, 2009 1:54 pm   

Or expression
 
I have a trigger that looks like...
Code:
#TR ^{Bob tells you 'hi'|You dream of Bob telling you 'hi'} {tell Bob hello}


That trigger works just fine, but when I do this.
Code:
#TR ^{%1 tells you 'hi'|You dream of %1 telling you 'hi'} {tell %1 hello}


Nothing happens

I look forward to enlightenment.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Jun 18, 2009 2:19 pm   
 
Firstly, you need another set of {}, so your trigger will be:

#TR ^{{Bob tells you 'hi'|You dream of Bob telling you 'hi'}} {tell Bob hello}

Secondly, %1 isn't a proper wildcard. It'll work in some cases, but it won't always do what you want it to. Use a proper wildcard.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
aslanthekat
Novice


Joined: 17 Sep 2007
Posts: 44
Location: Missouri

PostPosted: Thu Jun 18, 2009 2:38 pm   
 
You're right , I mistyped my trigger I have #TRIGGER {^{%1 telling you 'test'|%1 tells you 'test'}} {#SA worked}

Using %w instead of %1 doesn't work either.


Any more suggestions are appreciated
Reply with quote
Tech
GURU


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

PostPosted: Thu Jun 18, 2009 2:38 pm   
 
You've got two things going on here. First, as proper syntax you shouldn't use %1 in your trigger pattern. What you really want is %w.

Second what's really affecting you is that you can use wild cards in pattern alternations with zMUD.

You have a few options.

First you can create two triggers. I'll assume this is a no-go since you used pattern alternation in the first place.
Second you can rewrite the pattern so the wildcards are outside of the alternation.
Code:
^{You dream of |}(%w) tell{s|ing} you 'hi'

Third you can switch to a #REGEX which are very powerful, but a bit daunting at first.
Code:
(?:You dream of \a+ telling you \'hi\'|\a+ tells you \'hi\')

Just paste the pattern into your trigger and make sure the Perl Regular Expression button is checked.

I hope that helps.
_________________
Asati di tempari!
Reply with quote
aslanthekat
Novice


Joined: 17 Sep 2007
Posts: 44
Location: Missouri

PostPosted: Thu Jun 18, 2009 3:07 pm   
 
You're right I have it in two triggers at the moment. I tried your first code and it worked perfectly. I've never worked with regex but I might have to look into that.

Thanks both of you for the help.
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