|
bajella2 Newbie
Joined: 20 Mar 2005 Posts: 4
|
Posted: Sun Mar 20, 2005 11:24 pm
Trouble with variable |
I'm trying to create a simple script that enables my map to move when I follow someone on the mud. What I have is a set of two triggers and for some reason it doesn't work.
#TRIGGER {You now follow %w.} {#VAR leader %1} {leader}
#TRIGGER {^@leader leaves %w.} {#MOVE %1} {leader}
Anyone know why this doesn't work or can give me a script that does work? |
|
|
|
Aarlot Adept
Joined: 30 Dec 2003 Posts: 226
|
Posted: Sun Mar 20, 2005 11:50 pm |
You need parenthesis around the %w's. Also, brackets around the variable are good.
#TRIGGER {You now follow (%w).} {#VAR leader %1} {leader}
#TRIGGER {^{@leader} leaves (%w).} {#MOVE %1} {leader} |
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
|
bajella2 Newbie
Joined: 20 Mar 2005 Posts: 4
|
Posted: Mon Mar 21, 2005 12:09 am |
Awesome now it works perfectly! Thanks!
|
|
|
|
Spartacus Wanderer
Joined: 23 Apr 2001 Posts: 53 Location: USA
|
Posted: Mon Mar 21, 2005 5:27 pm |
A quick recommendation: Most muds send a line that matches something like "You follow (%w) ({north|south|east|west}) to (*)" after they send the line that said the leader left. If there's any possibility of the leader going and you not going (your leg is broken, you're stuck, you're in combat, etc..) then you should use that second message as the trigger pattern for moving your map pointer.
Achaea is a lot like this, though I think you don't see that your leader left if you actually follow them. Here is the trigger that I use to make my maps follow me on Achaea:
Code: |
#TRIGGER {you follow * ({@refDirections}) to (*)} {
#move %1
#if (%left( %roomname( ), %len( %2)) != %2) {#echo ~<color red~>~<bold~>MAP IS OUT OF SYNC~</bold~>~</color~>}
}
#VAR refDirections {north|northeast|east|southeast|south|southwest|west|northwest|up|down|in|out} {north|northeast|east|southeast|south|southwest|west|northwest|up|down|in|out} |
I don't restrict the pattern match on who I'm following for a couple reasons:
sometimes Achaea gives titles plus names, which we all know messes things up.
It's possible to get forced to follow someone in Achaea and I want my map in sync so that I can run away quickly.
There is a deficiency in this trigger that I will fix someday (or I'll post it here and let Vij or Dhark fix it for me): If the mud output spills onto the next line, it doesn't get captured and only the first bit of the room name is used for the match. |
|
_________________ Spartacus
rm -rf .* |
|
|
|
|
|