 |
mudman Beginner
Joined: 23 Jun 2002 Posts: 13
|
Posted: Sun Jun 23, 2002 4:55 am
Automapper FIND Feature |
In many MUDs, I know there are some areas that have rooms with identical names and descriptions, although sometimes each separate room has different exits pointing in different directions.
For example. There are three rooms with the name of "The Path". All of them have identical descriptions. BUT, the first of those has exits: N,W,E; the second has exits: N,S,W; and the third has exits: W,E,S.
When using the FIND feature on the mapper to find the character's location, it brings up a list of these three rooms regardless if you are in the room with the W,E,S exits. Is there any way to sort through these possible choices by means of their exits (or any other mean at that)? I want to be able to have my location set to the room with the W,E,S exits without the list popping up. I see the problem that if there were more than one room with the W,E,S exit, but all I care about is that the list was narrowed down. Thanks. |
|
|
|
 |
TonDiening GURU

Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Sun Jun 23, 2002 5:18 am |
Depends on what you are doing to cause the #FIND.
If you get randomly teleported then there are other ways of figuring out where you are.
Interesting ideas are found in the flee scripts that figure out which
room they have fleed into. An example:
vrsoft's automapper and fleeing script
Ton Diening
Providing untested answers that tend to be
more complicated than others.  |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Jun 23, 2002 4:25 pm |
Currently there is no good script solution for your problem. The next public version is slated to have many improvements in script interaction with the mapper and will provide a solution to such a problem. This does not mean it is not doable right now.
I order to do it you must first capture roomname and roomexits to variables, then you must write your own find routine.
In order to speed up searches I would suggest creating a db with all roomnames and roomnumbers as keys. This will let you search that db quickly for given name. If that isn't for you then can search through all possible rooms whenever needed. On my map, 11115 rooms, it took 48 seconds to build the possible match list with this alias.
#ALIAS FindMap {#IF ("%-1"="") { #ECHO Roomname required.} {PossibleRooms="";#ECHO Searching...;#LOOP 1,%numrooms { #IF (%roomname(%mapvnum(%i))="%-1") {#ADDITEM PossibleRooms %mapvnum(%i)}}}}
The next step would be to use the generated list of rooms and narrow the field by either matching descriptions or exits. I find exits easier to capture so I went for that.
Lets see if I can give you an examples of the processing overhead involved for the exits. On my mud the exits are displayed like this:
Obvious exits: north, south, east
And my script to convert them to match the mapper exit data is...alright mine is wierd and can't use that for an example so lets write a new one.
#VAR OddExits {above|below}
#VAR FixedExits {u|d}
#TR {^Obvious exits: (*)$} {ExitLine=""; #FORALL %replace("%1",", ","|") {Exit=%word(%i,%numwords(%i));#IF (%ismember(@Exit,@OddExits)) {#ADDITEM ExitLine %item(@FixedExits,%ismember(@Exit,@OddExits))} {#ADDITEM ExitLine %left(@Exit,1)}};ExitLine=%sort(@ExitLine)}
Now we have exits captured, in a usable fashion, so it is time to add the code to the previous alias to make that list smaller. Here it is with the additions:
#ALIAS FindMap {#IF ("%-1"="") {#ECHO Roomname required.} {PossibleRooms="";#ECHO Searching...;#LOOP 1,%numrooms {#IF (%roomname(%mapvnum(%i))="%-1") {#ADDITEM PossibleRooms %mapvnum(%i)}}};#ECHO Found %numitems(@PossibleRooms) by name.;#FORALL @PossibleRooms {#IF (%sort(%roomexit(%i))!=@ExitLine) {#DELITEM PossibleRooms %i}};#ECHO Rooms matching exits %numitems(@PossibleRooms).}
You can add description matching on your own. You can also add the final check for it getting down to 1 room. If it hasn't after matching everything then your builders need to be more creative, and you can have it start looking at neighboring rooms, that is when the concepts in vrsoft's script wil come in handy. |
|
|
|
 |
|
|
|
|
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
|
|