|
GRAFFiX Newbie
Joined: 30 May 2004 Posts: 3 Location: USA
|
Posted: Sun May 30, 2004 6:00 pm
2 questions |
Wondering how to make a trigger where a variable is part of the trigger.
like if I wanted to make a script to follow someone(basically same as the 'follow <target>' mud command) target trigger with say @leader as the variable.
like if it was:
Trigger: @leader leaves %t.
Action: %1
So if @leader = Joe and i get "Joe leaves west." it will make me go west is the basic idea.
How do you patern match a variable in a trigger?
other question is in a variable is there anything you need to do if it has spaces in it?
like with this: #VAR evil ( Red Aura )
do you need quotes?: #VAR evil "( Red Aura )"
or any thing similar? |
|
|
|
Firey Wanderer
Joined: 30 Dec 2003 Posts: 61 Location: Norway
|
Posted: Sun May 30, 2004 6:06 pm |
well, you can make a variable like this:
Name: leader
Value:
Then make an alias:
Name: setleader
Value: #var leader %1
Then you can do this: setleader Joe
And the leader will be joe, and you will walk after him automatically.
I'm not sure on your second question tho... |
|
|
|
GRAFFiX Newbie
Joined: 30 May 2004 Posts: 3 Location: USA
|
Posted: Sun May 30, 2004 7:16 pm |
yeah the problem is trying to embed the variable into the patern. Not sure the formatting for a variable is in the patern.
tried @leader and &leader as well just messing around... still follows anyone that leaves the room.
Pattern: @leader leaves (%t)
I want it to follow only the value of @leader. Cant figure out what it replace @leader with in the patter part. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun May 30, 2004 7:30 pm |
quote: How do you patern match a variable in a trigger?
PATTERN: ^@leader leaves (%t)
VALUE: #EXEC %1
WHAT_IT_DO: ^matches begining of line, @leader gets replaced with whats in @leader, (%t) matches a direction and stores it to %1
Firey's alias will work for setting the leader alternativly you could use this in the command line
leader=joe
quote: other question is in a variable is there anything you need to do if it has spaces in it?
Yes it needs to be quoted with {}'s
#VAR varname {var value with spaces}
I believe you also need to quote the ()'s if you are using it in a trigger
#VAR evil {~(red aura~)} |
|
|
|
GRAFFiX Newbie
Joined: 30 May 2004 Posts: 3 Location: USA
|
Posted: Sun May 30, 2004 8:03 pm |
found out what the problem was.
I had parseing off so my variables were all blank doh! [:p]
Thanks for the help |
|
|
|
|
|