About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Fri Jul 01, 2005 9:28 pm   

Sting list in a {val1|val2|val3} pattern
 
I have an alias which turns on a trigger that supposed to match one of several possible outcomes. I'm trying to use a string list as part of my trigger pattern, can't seem to get it to match correctly.

So far I have something like (I apologize for the obsuure code, but I don't have the actual tirgger in front of me right now):

#VAR test {A|B|C|D}
#TRIGGER "trgTest" {^{@test blah blah blah|I can't find that|You don't have that|etc etc etc}.$} {do some stuff;#T- trgTest}

I'm trying to get the trigger to fire on any of the follwoing lines:
A blah blach blah.
B blah blach blah.
C blah blach blah.
D blah blach blah.
I can't find that.
You don't have that.
etc etc etc.

It won't match the @test correctly and I'm not sure why or how to fix it.

I have also tried:

#TRIGGER "trgTest" {^{{@test} blah blah blah|I can't find that|You don't have that|etc etc etc}.$} {do some stuff;#T- trgTest}

But that didn't match either.

Is it possible to use a string list in a pattern like this or do I need to find an alternative solution, such as creating several different triggers?
_________________
Erasmus
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4717
Location: Pensacola, FL, USA

PostPosted: Fri Jul 01, 2005 11:01 pm   
 
you can't use nested variable arrays, which is what this is:

{{@test} blah blah blah|I can't find that|You don't have that|etc etc etc}

the internal one is taken verbatim instead of expanded into the additional possibilities

try just

#TR {{@test} blah blah blah} {do your thing}


You dont really wanna do the same stuff if the item is missing anyway, do you?
_________________
Discord: Shalimarwildcat
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Fri Jul 01, 2005 11:09 pm   
 
I couldn't get it to work with a normal trigger, but I pieced together a regex for you

#VAR testVar {ABC123|DEF456|GHI789}
#REGEX {(?:Test123|Test456)|(?:(?:@testVar) blah blah blah)} {do whatever;and whatever else}

Will match:
Test123
Test456
ABC123 blah blah blah
DEF456 blah blah blah
GHI789 blah blah blah
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Jul 02, 2005 12:56 am   
 
You have to turn on 'Allow wildcards within {} triggers' in the Preferences. Next you have to surround your @Test with braces, as Shalimar described.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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