|
Balder Newbie
Joined: 29 Nov 2008 Posts: 3
|
Posted: 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 |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: 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 |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
|
|