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
BartzS
Beginner


Joined: 30 Aug 2004
Posts: 11

PostPosted: Wed Sep 01, 2004 5:10 am   

Variables within Triggers
 
Sorry to post another topic on this but when I went to reply it kept sending be back to the main menu for some reason Confused.

Anyways, what I wanted to know was how to make one trigger work for several different strings that were similar.

Take these for example:

You find a white zircon.
You find a blue zircon.
You find a yellow zircon.
x 100 or whatever

How do I make a variable that would make it so I don't have to set up 100 different triggers for all of these similar strings?

In another scripting language I used it was simple because it had text extraction so I'd make the program pick up a zircon and put it in my container whenever it was triggered by this: You find a [color] zircon. This made it possible to use one trigger that would work for any color zircon. Does Zmud have text extraction?

Hope this was clear enough.

Thanks
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Wed Sep 01, 2004 6:39 am   
 
Paste into the command line and press <Enter>

#TR {You find a %w zircon.} {put zircon in container}

%w is a wildcard that matches any number of alpha characters (a word). That'll match any one word description for your zircons. Replace the Command section with your MUD's proper command.

The Help files in the Library have good info on the subjects of Pattern Matching and Wildcards.
_________________
zMUD 7.05a
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Sep 01, 2004 1:06 pm   
 
If you want to reference the color to use in the command, then put parenthesis around the wildcard char.

#TR {^You find a (%w) zircon.$} {put %1 zircon in container}

In this case, %1 is a temporary variable containing the string which is the color.
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