 |
Bromax Wanderer
Joined: 03 Jan 2002 Posts: 66
|
Posted: Thu Mar 25, 2004 7:46 pm
%lastdir? |
I have been trying (unsuccesfully) to set up a trigger that knocks on a closed door then moves the last direction that i entered. For example:
I type W and get "The door is locked"
I need to send the command "knock" to the mud then move w again.
the knock part is easy but as for the move last direction entered thing.....I can't get it to work. I tried just about every command with %lastdir but can't get it to work...any help? |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Fri Mar 26, 2004 1:37 am |
First off the contents of the %lastdir function depend on whether you are in map mode and the tested state of the link you are traversing. When mapping an untested link it contains a list of commands for the direction, like "w|west". In all other cases it will contain what the mapper has interpretted the command to, generally a single character like "w".
The best way to repreform the direction command is with the #SEND command. #SEND directly sends its arguement data to the mud bypassing both the mapper and the display window. Since the direction is still in the queue and does not need to be requeued this is the best method.
If you have already established a #NODIR in your "The door is locked" trigger then you should use #EXEC to preform full processing of the contents of %lastdir.
If you are working with a situation that will cause %lastdir to contain a list then use %item(%lastdir,1). You may wish to do this as a covering manuever since when %lastdir contains only 1 item the result will be the same and the other case will be covered. |
|
|
|
 |
Bromax Wanderer
Joined: 03 Jan 2002 Posts: 66
|
Posted: Sat Mar 27, 2004 4:49 pm |
Hmmmm...tried:
#exec %item( %lastdir, 1)
#exec %lastdir
What did I screw up? |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sat Mar 27, 2004 10:55 pm |
I should apologize for answering the first time after a very long work day. I wasn't thinking right and have awarded myself 2 idiot points.
Since it seems your using a #NODIR, that is clearing %lastdir to nul before you get to use it. You must first store it into a variable. |
|
|
|
 |
Bromax Wanderer
Joined: 03 Jan 2002 Posts: 66
|
Posted: Sat Mar 27, 2004 11:03 pm |
Its O.K. I am the current idiot point leader....would putting the trigger to move in order before the nodir trigger work? (Im not on my Zmud comp to test it)
|
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sat Mar 27, 2004 11:32 pm |
Only if you eliminate the #NODIR. It is kind of like a chicken and egg problem. If you resend the direction with #EXEC then the mapper will base its queue on the original move occurring successfully at some point. If you try to use %lastdir after #NODIR you don't have the correct information; either because another command is already queued (remember slow mode speedwalking prequeues direction commands) or because is nothing in the mapper queue anymore.
For those reasons I have actually reworked all my mapper scripts to use #SEND and the only time #NODIR is used is when I am mapping and can ensure the queue will contain only what I want. I find #SEND to be the best method and generally use it with an #ECHO because #SEND also bypasses the output window. |
|
|
|
 |
Bromax Wanderer
Joined: 03 Jan 2002 Posts: 66
|
Posted: Sun Mar 28, 2004 2:16 am |
Worked great...thanks again
|
|
|
|
 |
|
|
|