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
tomcat025
Wanderer


Joined: 30 Dec 2001
Posts: 66
Location: USA

PostPosted: Fri Apr 26, 2002 3:10 am   

Variable and #cw
 
Is there any way to use the #cw command with a variable? as in

#trigger {@critters} {#cw red,bright}

When I do it this way, it insists on matching every value in the variable. I have quite a few critter names in the variable. the match line "for testing" says it must match something like musk hog|gypsy marauder|wood troll where I just want it to match any of the values. I wanted to get away from making one trigger per critter.

Thanks for any help

TC <I'm trying, really I am. :p
Reply with quote
Sildaren
Wanderer


Joined: 19 Jul 2001
Posts: 59
Location: Germany

PostPosted: Fri Apr 26, 2002 8:37 am   
 
Should work with a trigger like
#trigger {{@critters}} {#cw red,bright}

(when the parser processes the #trigger command, it strips one set of braces, so you need a second one to create a {name1|name2|name3} style pattern.

(not tested)
Reply with quote
tomcat025
Wanderer


Joined: 30 Dec 2001
Posts: 66
Location: USA

PostPosted: Fri Apr 26, 2002 10:44 am   
 
I tried that trigger and it froze my Zmud. Had to start the backup.



TC <I'm trying, really I am. :p
Reply with quote
Talanthas
Beginner


Joined: 26 Mar 2001
Posts: 12
Location: earth

PostPosted: Fri Apr 26, 2002 12:47 pm   
 
I don't seem to have the brain power this morning to figure out what pattern you need to match on, but I think I've got a pretty good handle on the response.

If you try something like this:
#if {%ismember( %1, @critters)} {#cw @critters {red,bright}} {#noop}

I think that will work. You'll need to replace %1 with the correct system variable in your pattern, though.

Talanthas
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Apr 26, 2002 12:51 pm   
 
If zMUD freezes when you do what Sildaren suggested, check the @critters to see if it doesn't contain any empty elements. That is, it should be like:
item1|item2|item3|item4

and not:
item1||item2|item3|item4

or:
item1|item2|item3|item4|

or anything like that.

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Apr 27, 2002 5:37 pm   
 
In order to overcome the parser's tendency to strip special characters you need 3 sets of {} for command line entry.

#TR {{{@critters}}} {#CW {red,bright}}

LightBulb
All scripts untested unless otherwise noted
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