|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Sun Mar 31, 2002 7:57 am
Opening Doors |
Ok, I'm getting real tired or useing the %lastcom command in raw scripts. Case in point, I have a trigger:
#TR {^* is closed.} {open %lastcom}
now this works fine, unless you have use it inside/along side a script. Or if you have alarm ro wait states. Then it tends to try to return bits and pieces of your scripts.
Now, what makes the most sense to me is to make a rotating stringlist that will look for a direction and return that direction if it has been used in the last 5-8 commands. And of coarse it would have to order the commands in the squence issued, and only return the most recent direction. So, like a command history variable. I believe I've seen this elsewere a while ago. Any ways, unless there is another way of doing this(and I've tried using %lastdir to no avail), please post some suggestion of the best, most effecient way of making this happen
Thanks in advance! |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Sun Mar 31, 2002 9:52 am |
What about
lastdir
Syntax: %lastdir()
Returns the current direction on the mapper command stack
Use that maybe. Looks like it needs the
automapper open to work though.
Ton Diening |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Mar 31, 2002 3:24 pm |
If you don't use the mapper, you could probably catch normal directions with:
#ONINPUT {^(%t)$} {#VAR lastdir %1;~%1}
You'd still have problems if you ran into a door in the middle of a fastwalk path though.
LightBulb
All scripts untested unless otherwise noted |
|
|
|
kognesty Newbie
Joined: 08 Jan 2001 Posts: 8 Location: USA
|
Posted: Mon Apr 01, 2002 7:37 am |
Consider this an idea. Now if your mud has an exit line output something like [Exits: north south east] then it is quiet possible to make a trigger to capture this information into a stringlist. Each time you enter a room this stringlist is made which would give you the directions you can move without opening a door. This would mean any direction travelled that isn't in this list has a door, right? So you use an #oninput trigger to test if what you are sending to the mud is a direction with no door or with a door. Should the direction turn out to be a door your command gets parsed to first open the door in the given direction then go that direction. For specific syntax I always recommend reading the helpfiles pretaining to each item used in the idea. If you need more help with this idea, feel free to ask.
|
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Mon Apr 01, 2002 6:30 pm |
Eeek, you trigger cause some nasty stack overload problems there Lightbulb. I tried it without the tilda, but that was even worse.
I cant use %lastdir, as it does require that you use the mapper, and if I was using the mapper I would have no need for this trigger .
I tried something like this:
#ONINPUT {(north|south|west|east|up|down|n|s|w|e|u|d)} {#VAR curdir %1;%1}
But it wouldnt capture....(sigh) |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Mon Apr 01, 2002 7:00 pm |
Open the mapper and not use it then
%lastdir would work.
#ONINPUT {({north|south|west|east|up|down|n|s|w|e|u|d})} {#VAR curdir %1;~%1}
You want that ~%1 so it doesn't retrigger the
#ONINPUT perhaps.
Ton Diening |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Mon Apr 01, 2002 8:23 pm |
quote:
Open the mapper and not use it then
%lastdir would work.
#ONINPUT {({north|south|west|east|up|down|n|s|w|e|u|d})} {#VAR curdir %1;~%1}
You want that ~%1 so it doesn't retrigger the
#ONINPUT perhaps.
Ton Diening
Still get a parsing error and stack overflow... |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Apr 02, 2002 1:14 am |
quote:
Open the mapper and not use it then
%lastdir would work.
#ONINPUT {({north|south|west|east|up|down|n|s|w|e|u|d})} {#VAR curdir %1;~%1}
You want that ~%1 so it doesn't retrigger the
#ONINPUT perhaps.
Ton Diening
#ONINPUT only fires when stuff is sent from the command-line itself. It shouldn't fire from stuff sent by an alias, trigger (including the now-firing #ONINPUT trigger), button, menu, macro, etc. This is because this stuff does not go through the command buffer before it gets sent to the mud.
li'l shmoe of Dragon's Gate MUD |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Tue Apr 02, 2002 3:27 am |
quote:
#ONINPUT only fires when stuff is sent from the command-line itself. It shouldn't fire from stuff sent by an alias, trigger (including the now-firing #ONINPUT trigger), button, menu, macro, etc. This is because this stuff does not go through the command buffer before it gets sent to the mud.
li'l shmoe of Dragon's Gate MUD
Well, that saves some headache, as I need it to capture directions sent from some scripts as well . This is a very perplexing problem for something that should be so easy...any more suggestions? |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Tue Apr 02, 2002 3:57 am |
How generic are the door closed messages?
#TR {^* is closed.} {open %lastcom}
Can you resolve the * better to figure out
what it is? It will still give you trouble
in a room with multiple doors though.
Ton Diening |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Apr 02, 2002 5:09 am |
quote: Eeek, you trigger cause some nasty stack overload problems there Lightbulb. I tried it without the tilda, but that was even worse.
Sorry about the stack overload. The tilde was intended to get around that, leaving it out would make things worse. It might help to double it instead. But, I'm not willing to test it -- I don't like overloads either! Best to find some other method.
Another suggestion: If you do most of your movement by way of the number pad, try changing your kepad macros to something like this:
#KEY KEY8 {#VAR lastdir s;n}
You'll need to do one for each direction of course. Then you can use @lastdir in your trigger instead of %lastcom.
LightBulb
All scripts untested unless otherwise noted |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Apr 02, 2002 12:15 pm |
How about creating some aliases?:
#ALIAS north {#VAR lastdir north;~north}
#ALIAS south {#VAR lastdir south;~south}
etc.
Kjata |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Tue Apr 02, 2002 6:33 pm |
Ah that works.And rather than change all my numpad keys, I just created aliases for the single letter directions, and that makes it work though the numpad Thanks for the help guys!
|
|
|
|
|
|