|
diff Newbie
Joined: 30 Nov 2007 Posts: 9
|
Posted: Fri Apr 18, 2008 7:35 pm
Help with Mapper Exits & Doors |
One can use the %roomexit() function to get the string list of exits from the current room. One can also use %doorname(direction) to return the name of the door in the given direction.. although none of my doors have names.
Is there a function to check that an exit is a door? Something to the effect of %isdoor(vNum,direction)? When looking at the spreadsheet view of my map, I can see that the field name of the information I need is "ExitKindID". How can I get at this information via script? Possibly mapquery() but I can't seem to find a solution.
Edit: Maybe it is possible to directly access the mapper database tables using the database functions? I can't figure out how to load it.
Any help out there? |
|
Last edited by diff on Sat Apr 19, 2008 1:31 am; edited 2 times in total |
|
|
|
meyn Beginner
Joined: 06 Mar 2008 Posts: 27
|
Posted: Fri Apr 18, 2008 8:31 pm |
EDIT:opps
misread your post
EDIT:
dont know if this will help you
Code: |
#AL checkroute {
#VAR isdoor {}
#VAR blank {}
#VAR revisedroute {}
#PR desttgt "Enter roomnumber to walk to"
#VAR startroomonmap %roomname( )
#VAR speedroute %walk( @desttgt, -1)
#VAR fullroute %pathexpand( @speedroute)
#FORALL @fullroute {
#VAR isdoor %doorname( %i)
#IF (@isdoor!=@blank) {
#SHOW %i doorname is @isdoor
#VAR revisedroute %addItem( @isdoor, @revisedroute)
#VAR revisedroute %addItem( %i, @revisedroute)
} {
#SHOW the room has no %i door
#VAR revisedroute %addItem( %i, @revisedroute)
}
#MO %i
}
#TE @startroomonmap
#SHOW @revisedroute
} |
When you use %pathexpand i think it should all ready have the doors listed in it, so this script shouldn't really be needed.
This script moves you along set route, checks each room for door, then adds door name and direction to leave room to @revisedroute, then teleports you back to where you started on map
Hope it helps
EDIT: Mapper->Config->Configuration Settings->Speedwalking->Check the box "Add door commands to Saved Paths"
This will insert the door commands into the %walk function.
Mapper->Config->Configuration Settings->Doors and string-> open %2 in firstbox
this might solve problem
shouldnt need the script then! |
|
|
|
diff Newbie
Joined: 30 Nov 2007 Posts: 9
|
Posted: Mon Apr 21, 2008 2:47 pm |
I had previously added door parsing to my room exit triggers, and have been using an onroomcreate alias and #DOOR to create doors as I explore. What I’m trying to do is to update the doors on my map automatically as I reload a room’s information via the button on the mapper.
This is a very clever idea to solve my problem. Get the path from the current room to a room 1 step away, and then expand the first step of the path which should be an open door command… even when the door has no name.
Of course there is no #un-door command that corresponds to #door, so I'll have to resort to saving the link’s information, deleting it, and recreating it doorless when a door needs to be removed.
Thanks a bunch! I'll let you know how it goes. |
|
|
|
diff Newbie
Joined: 30 Nov 2007 Posts: 9
|
Posted: Thu May 01, 2008 2:30 pm |
Been a while, but getting back to this problem now... which leads me to my next hurdle. How do I find the room key of all adjacent rooms?
Take a room with the following exits as an example:
Quote: |
You see exits leading north (open door), east, south (open door), and southwest (open door). |
Run the following code on said room:
Code: |
#forall %roomexit( ) {
#echo Exit: %i -> %roomlink( %roomkey, %i)
#echo Path: %i -> %pathexpand( %pathfrom( %roomkey, %roomlink( ,%i)))
#if ( %begins( %pathexpand( %pathfrom( %roomkey, %roomlink( ,%i))), "open door")) {#echo It's a door!}
}
|
Now you see the dilemma. %roomexit() returns "speedwalk characters" and not actual "mud directions", and these "speedwalk characters" cannot be used with %roomlink().
Quote: |
Exit: n -> 243
Path: n -> open door north;n
It's a door!
Exit: e -> 234
Path: e -> e
Exit: s -> 235
Path: s -> open door south;s
It's a door!
Exit: k ->
Path: k ->
|
Is there a better, or should I say "working", way to do this?
Edit:
I had considered just simply using a database variable and storing the directions with their appropriate %roomlink() counterparts, however this will not work with special exits. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu May 01, 2008 3:21 pm |
That's very interesting; I was under the impression that %roomexit returned proper directions. You could perhaps try fooling it by passing the character through one of the path functions first so that it's converted from the path character to the real direction.
|
|
|
|
diff Newbie
Joined: 30 Nov 2007 Posts: 9
|
Posted: Thu May 01, 2008 3:36 pm |
I've had similar thoughts. However, they annoyingly echo text to the screen… and also spit back the speedwalk characters and not the directions.
Code: |
#pa adjacent k
#echo Path: %pathexpand(3nkw) |
Quote: |
k assigned to adjacentRoom
Path: n|n|n|k|w |
Now I'm thinking I can somehow use directions, #DIR. However, I know little of them and am investigating now. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu May 01, 2008 5:39 pm |
#DIRECTION is only for creating speedwalk letters. It's like how you can't use #KEY to simulate a keypress, as it's only for creating macros.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
diff Newbie
Joined: 30 Nov 2007 Posts: 9
|
Posted: Thu May 01, 2008 7:36 pm |
This is overly complex for what I am attempting to do. Really what I need is direct access to the exits table in the mapper database. I think I'm just going to cross my fingers, and wait for a more advanced cmud mapper module that will allow me to query it for things like FromID, ToID & ExitKindID.. or at least have a more complete set of exit, door & room functions. Things like #undoor and %isdoor() would really make my zmud to cmud upgrade much more probable.
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Thu May 01, 2008 9:45 pm |
you could likely do:
#MOVE j |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu May 01, 2008 10:37 pm |
Gives you.
n|n|n|sw|w |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
diff Newbie
Joined: 30 Nov 2007 Posts: 9
|
Posted: Fri May 02, 2008 1:29 pm |
Wow, thanks Arminas! That's exactly what I was looking for!
After playing around for a little bit, I also figured out that by adding directions for each of my custom exits %exec() would expand them correctly too.
For example, take the "in" exit, or a swim exit:
Quote: |
You see exits leading north, northeast (open door), east, southeast (open door), south (open door), southwest, west, northwest, and in (open door). |
Code: |
#echo Exit: %i -> %roomlink( %roomkey, %exec(.%i)) |
Quote: |
Exit: in ->
Exit: swim w -> |
Now add the custom directions:
Code: |
#DIR zx {in} other
#DIR rt {swim w} other |
Quote: |
Exit: in -> 24
Exit: swim w -> 25 |
I only throw this information out so that possibly somebody else will benefit from it. Thanks for the responses guys, they are greatly appreciated. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri May 02, 2008 2:26 pm |
Were it me, I'd've called my in and out exits i and o, for ease of readability's sake.
As for swim exits, if your MUD allows rooms to be turned into water (and to be made passable on foot - one mud I played had a levitation spell that, if you had it on, let you walk across water) then hard-coding exits as swim exits is a bad idea. If it were me, I'd have a trigger "You need to swim in that direction" or whatver that'd do swim %lastcom or something, and then add "swim x" to each direction's list of possible commands. |
|
|
|
diff Newbie
Joined: 30 Nov 2007 Posts: 9
|
Posted: Sat May 03, 2008 1:08 am |
I had originally used i and o for my in and out exits, but was encountering problems (with the code from this post even) so switched to something obscure which seemed to have solved it. As for hard coding swims into exits, I agree with you 100%. I only use it as an example. The point I was attempting to express is that you can match any "other" exit text to a #DIR so that it can be expanded properly by the %exec().
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sat May 03, 2008 2:17 am |
Be warned that if you start putting aliases or commands in your other exits the %exec can make them do strange things. So always test things before you put them into production.
I actually created a more complex system for CMUD using the new user defined functions.
For most things so long as you don't get outlandish, like me, and you test things; the %exec function is good enough. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
|
|