|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Tue Nov 10, 2009 3:09 pm
is there an easy way too backup one direction? |
This is what i am thinking.
In my mud there is a roaming evil called Muck Monster, he will come into the room you are in and eat your players maybe one at a time maybe not at all and randomly spit you out somewhere else in the game. uggghhh!!!
so what i want to do is write a trig that will move me out of the room when he comes in and then when he moves into the room that i moved to i want to go back to the orginal room i was in.
i was wondering if there is a predefined varible that keeps the last direction you moved? |
|
|
|
Tarken Aurelius Apprentice
Joined: 23 Oct 2008 Posts: 120 Location: Cincinnati, Ohio
|
Posted: Tue Nov 10, 2009 4:20 pm |
Normally, not as far as I know...unless you're using the mapper you could probably work something with it. Otherwise, you'd have to trigger off your input and store your last movement into a variable and use variable pair if statements to coordinate your movement.
|
|
_________________ Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org) |
|
|
|
hadar Apprentice
Joined: 30 Aug 2009 Posts: 198 Location: my apt, in california
|
Posted: Tue Nov 10, 2009 5:02 pm |
i was thinking the same thing tarken, should not be to hard to make a working example of this ... in theory
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Nov 10, 2009 5:19 pm |
Very simple, honestly.
Using an OnRoomEnter event, you can do the following:
last_room=@current_room
current_room=%roomvnum
Then in the trigger, you can do:
#WALK @last_room
That is, if you use the mapper for this.
Alternatively, if you don't, you can do something like this:
If you use the numpad to move around... go to the English Keypad package (you'll have to do Show Default packages under View) and customize those keys. You can do something as simple as changing Key2 from just south to 'south;reverse_direction="north"' and then make a trigger to walk @reverse_direction when the Muck Monster walks into the room.
Another option would be dependent upon the entry message. If it says something like:
Muck monster arrives from the east.
then you can make a trigger that just goes east.
Many options. Just up to you which one you want to use.
Charneus |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Tue Nov 10, 2009 5:50 pm |
What you could do if you're not using the mapper, is to make aliases for all of your directions, in which you also store a variable called last_back_direction e.g. Then when the monster comes in, you trigger it to send you in the last_back_direction.
An example of a "west" alias is:
#ALIAS w {last_back_direction=e;~w}
the ~w makes you send "w" to the mud, while you use the "w" alias.
Hope it helps
//DanteX |
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Tue Nov 10, 2009 6:14 pm |
When i type #path
it shows a list of all my paths but its also got the last direction i traveled there too at the bottom.
is there away to access that? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Nov 10, 2009 6:29 pm |
That's overcomplicated. Just make one variable (to store the previous direction) and one trigger (for capturing your movement commands).
#oninput {something at the end of your prompt({n|s|e|w|u|d})$} {Return_to_ Last_Moved = %reversepath(%1)}
It will be there for anything else you might need to reference the last direction. Of course, it won't work in places where the pairings are not simple reverses (ie, mazes and double-backs) and won't handle non-standard exits (go door, enter, in, out, etc). |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|