Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: 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!
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: 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
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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
Reply with quote
kognesty
Newbie


Joined: 08 Jan 2001
Posts: 8
Location: USA

PostPosted: 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.
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: 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)
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: 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
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: 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...
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: 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?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: 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
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: 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
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: 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!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net