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
Balder
Newbie


Joined: 29 Nov 2008
Posts: 3

PostPosted: Sat Nov 29, 2008 5:51 pm   

Trigger question: Brackets issue.
 
Hello.

Im trying to capture available exits, for an autowalk script. After I got thoose I will just code a priorization of the exits in order for the script to choose where to go..maybe by using Ifs...however, im not there yet.

The Exits are presented in the following way:

[Exits: north east south up down]

If I make a trigger like this:

Pattern: Exits: (*)
Command:gt %1

..then I get the following: gt north east south up down]

Notice the bracket at the end. My simple question is: How do I exclude the bracket?

Changing pattern to Exits(*)] does not work, and adding the start bracket really messes things up. Should they be put in some other sings, or something?

Also I think I'd prefer to make it "Exits: (%w)" in a kind of loop till it has gotten all, and then save em as a vector, so I can use %1, %2 etc...but I guess that is something Ill consider after the bracket issue :D
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Sat Nov 29, 2008 6:18 pm   
 
Code:
#TRIGGER {~[Exits: (*)~]} {#VAR ExitList %subchar("%1"," ", "|")}


That will create a list var with that room's exits.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Nov 30, 2008 12:11 am   
 
[] are special characters in patterns, they create a range - so [a-z] will match "and" but not "AND" for example. You can also use an exclusion to tell it what NOT to match - [^a-z] matches "AND" but not "and". So you could do Exits [^~]] as well. But ralgith's method is probably easier.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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