Lich mapping reference: Difference between revisions

From Elanthipedia
Jump to navigation Jump to search
(Adding identical room mapping instructions)
Line 259: Line 259:


</pre>
</pre>
=== Adding identical rooms ===
Taken from [http://forum.gsplayers.com/showthread.php?57828-lrn2map&p=1826134#post1826134]

Fixing this sort of thing requires more knowledge of how the map database works than your standard mapping procedure. If it wasn't in River's Rest, I could run over to the room and give it a look and either fix it or give you some useful pointers, but since it's in River's Rest and I'm lazy, you're screwed.

My assumption is that there are two rooms that are in different places but have the same room title/description/paths. There are several ways to deal with this, and they are mostly terrible.

First, go to each of the identical rooms and type:

<pre>
;e echo Room.current_or_new
</pre>

If one of them shows up with a new room number, everything is good and right in the world (this isn't going to happen).

Second, perhaps someone used ";mapmap fix" incorrectly (they didn't, because no one uses that, even though it's in the instructions). To check if this is the case, go to each of the identical rooms and type:

<pre>
;e echo Room.current.desc.length
</pre>

In the map database, rooms can have more than one description. This is mostly to deal with different night/day descriptions for the same room, but it can rarely have other uses. When using ";mapmap fix", the script tests existing paths to see if you end up in the expected room. If you don't, it'll ask you if the rooms are the same. If you tell it they're the same, it'll combine them so they both have the same room number. If not, it will delete the path and create a new one to the different room. Someone may have said yes when they shouldn't have, which would add two unrelated room descriptions (and/or titles/paths) to the same room id. If the above command says "1", then this is not the case. If it's more than one, then it might be the case, but I won't go into it further because it's too unlikely.

So now we need to differentiate between the two horrible rooms. The best way to do this is with the room_objects tag. If there's something that shows up in the "You also see" line that is permanent, such as an arch or a door or something, and it's in one room but not the other, then all is good and right in the world (unlikely). Type:

<pre>
;e echo DRRoom.room_objs
</pre>

to see the exact object name, and then type:

<pre>
;e Room.current.room_objects = [ 'whatever' ]
</pre>

replacing whatever with the object name. Now, the room that has that object should keep the room number, and the room without the object should either be unknown, or might still tell you it knows the room id because of fuzzy room lookups. Either way, go to the other room and do a:

<pre>
;e echo Room.current_or_new
</pre>

and there should be two room ids. Then you can go over the whole area with a ";mapmap map" and a ";mapmap fix" and it should be good.

If room_objects isn't an option, you can use a peer tag, which causes Lich to peer into the next room in order to discriminate between two rooms. This is nice because it lets you use either room as a target for go2, but it's terrible because it has to peer if you walk through the room with narost running.

If the title/description/paths of each adjacent room is identical in each identical room (unlikely but actually has happened more than once), then you're stuck with treating the two rooms as one. You would need to create some creative StringProcs paths from each room to each adjacent room that will be sucessful regardless of which of identical room it's started in.

I left out the location verb property because it sounds like these rooms are in the same location.


=== Adding a new map image ===
=== Adding a new map image ===

Revision as of 11:04, 23 July 2019

Introduction to Mapping

This guide is inspired by Tillmens posts on lrn2map: http://forum.gsplayers.com/showthread.php?57828-lrn2map (Note: ignore any mentions of mapmap, this script does not apply to Dragonrealms)

The map is a database that is downloaded to your lich directory each time you login to the game. The database consists of rooms. All rooms need to have a wayto and a timeto. A wayto describes the movement to get to the room. The timeto describes how long it takes to get there (0.2 seconds is the default). ;automap handles adding this data automatically in most cases. If you map a room manually without ;automap then you need to be sure that you include both the timeto and the wayto, forgetting one will break ;go2's ability to navigate to that room.

Updating Your Database

To fetch the latest version of the map database run these commands:

;repository download-mapdb
;e Map.reload

Checking out the Database

Check out the map database. This will replace your current map database with the remote. This means that any changes you have made will be erased! This does not include anything like ;go2 saved rooms.

You need to have a password on file to check out the mapdb. This password is stored in plain text locally, so don't make it anything important.

When you checkout the map db, you own the database for 24 hours. This means that no one else can check it out until you upload or release it. Please, for the love of god, don't forget this.

> ;repository checkout-mapdb
[repository: success;  running download-mapdb now...]                                       
[repository: map database is up-to-date]                                                    
[repository: done]                                                                          
[repository: edit your map database and     ;repository upload-mapdb     within 24 hours.]  
--- Lich: repository has exited.                                                            

I Screwed Up

If you don't have the map db checked out, but want to erase some local changes you made:

;repository download-mapdb

All changes are local until you upload the database. If you checked it out but didn't upload it, you can RELEASE it which will erase your changes since your checkout and allow others to check out the mapdb again.

;repository release-mapdb

Referencing Rooms

Rooms can be referenced in two ways: Map.list[room_id] or Room[room_id]. There are some idiosyncrasies between the two, but in most cases either will work fine.

Room.current refers to your current room.

Map.list[room_id] or Room[room_id] refers to any room with the given id

Re-routing a path by changing timeto

You can change a path if there is an obstacle that you want to avoid, like a wall that might be too difficult to climb for younger adventurers!

 ;e Room.current.timeto["5665"] = 10.0

Useful Aliases

If you are using the Dependency suite of scripts, please run ;setupaliases to install these some of these useful mapping aliases. It will not install all of them, currently.

 ;alias add lr = ;e echo Room[Room.current.id].inspect
 ;alias add lfr = ;e echo Room[\?].inspect
 ;alias add ad = ;e Room[\?].description.push(XMLData.room_description) # Usage: ad roomnumber
 ;alias add snip = ;e Room.current.timeto.delete("\?")\r;e Room.current.wayto.delete("\?"); # Usage: snip roomnumber
 ;alias add ids = ;e echo "#{Room.current.id}:#{Room.current.wayto}"
 ;alias add tag = ;e Room.current.tags.push("\?") # Add tag to current room, Usage: tag cleric
 ;alias add pop = ;e echo Room.current.tags.pop  #deletes the last tag from the room you are in and displays it to you!

Note: Genie users must use slight variations for these commands. For instance, a comma instead of a semicolon, and double backward slashes where there is a backward slash. For example: ,alias add lfr = ,e echo Room[\\?\].inspect

Useful commands

;e echo Room.current.inspect # This is the lr alias
;e echo Room.current.wayto

When You Are Done

Run this command to merge your database with the server. Players that are logged in will not receive this update, they will have to execute the commands given above, or re-login to the game.

;repository upload-mapdb

Common Mapping Techniques

Adding New Rooms

Example

In this room there's an archway that is unmapped. Using the ids alias, its shown as unmapped.

[Inner Hibarnhvidar, Upper Cavern]
The generations of skilled Dwarven craftsmen that cleaved this cavern out of the living rock of the mountain let their imaginations run free in the carvings surrounding the arches leading to the shops and work-caverns.  One is surrounded by flowing rock-hewn ribbons pleated in an intricate pattern, others are studded with cabochon gems or tiny carvings in minute detail.  You also see a stone arch inscribed with the MAMAS Company logo.
Obvious exits: north, northeast, east, southeast.
Room Number: 3812
>ids
--- Lich: exec1 active.
[exec1: 3812:{"3815"=>"northeast", "3811"=>"north", "3813"=>"southeast", "3814"=>"east"}]
--- Lich: exec1 has exited.

Walk through the arch to check the movement command and see if the room has an id (it doesn't).

>go arch
[MAMAS Hibarnhvidar, Main Office]
Several small work stations ring the large cavern of the Merchant Adventurers' Mapping, Assay, and Survey Company's primary office in Forfedhdar.  Tools and survey instruments lie stacked at the various stations, soon to be available for purchase by adventurers needing the latest in mining equipment.  At the end of the cavern, a lone clerk stands by a counter with a set of small scales used to weigh individual items and stones of valuable minerals.  You also see a sign.
Obvious exits: out.
>out
You stroll out.
[Inner Hibarnhvidar, Upper Cavern]
The generations of skilled Dwarven craftsmen that cleaved this cavern out of the living rock of the mountain let their imaginations run free in the carvings surrounding the arches leading to the shops and work-caverns.  One is surrounded by flowing rock-hewn ribbons pleated in an intricate pattern, others are studded with cabochon gems or tiny carvings in minute detail.  You also see a stone arch inscribed with the MAMAS Company logo.
Obvious exits: north, northeast, east, southeast.
Room Number: 3812

Check out the map database

>;repository checkout-mapdb
--- Lich: repository active.
[repository: success;  running download-mapdb now...]
[repository: downloading map database...]
[repository: deleting old map databases...]
[repository: loading map database...]
[repository: done]
[repository: edit your map database and     ;repository upload-mapdb     within 12 hours.]
--- Lich: repository has exited.

Run automap

>;automap
--- Lich: automap active.
Starting
**Mapping (abort to cancel, stop to finish)**
Your feet are still soaked.

Move through the path to be mapped and map the path back. Moving a direction does not map the reverse direction, you need to do the reverse direction as well. This means a room with 8 exits will need 16 steps, one forward, one backward. Wait for the "**Mapping" text before moving again. Using a typeahead line will not map the direction correctly.

>go stone arch
[MAMAS Hibarnhvidar, Main Office]
Several small work stations ring the large cavern of the Merchant Adventurers' Mapping, Assay, and Survey Company's primary office in Forfedhdar.  Tools and survey instruments lie stacked at the various stations, soon to be available for purchase by adventurers needing the latest in mining equipment.  At the end of the cavern, a lone clerk stands by a counter with a set of small scales used to weigh individual items and stones of valuable minerals.  You also see a sign.
Obvious exits: out.
**Mapping (abort to cancel, stop to finish)**
>out
You stroll out.
[Inner Hibarnhvidar, Upper Cavern]
The generations of skilled Dwarven craftsmen that cleaved this cavern out of the living rock of the mountain let their imaginations run free in the carvings surrounding the arches leading to the shops and work-caverns.  One is surrounded by flowing rock-hewn ribbons pleated in an intricate pattern, others are studded with cabochon gems or tiny carvings in minute detail.  You also see a stone arch inscribed with the MAMAS Company logo.
Obvious exits: north, northeast, east, southeast.
Room Number: 3812
**Mapping (abort to cancel, stop to finish)**

Done mapping. Double check with the ids alias.

>ids
--- Lich: exec1 active.
[exec1: 3812:{"3815"=>"northeast", "3811"=>"north", "3813"=>"southeast", "3814"=>"east", "12182"=>"go stone arch"}]
--- Lich: exec1 has exited.

Kill automap

>;k automap
--- Lich: automap has exited.
>go arch
[MAMAS Hibarnhvidar, Main Office]
Several small work stations ring the large cavern of the Merchant Adventurers' Mapping, Assay, and Survey Company's primary office in Forfedhdar.  Tools and survey instruments lie stacked at the various stations, soon to be available for purchase by adventurers needing the latest in mining equipment.  At the end of the cavern, a lone clerk stands by a counter with a set of small scales used to weigh individual items and stones of valuable minerals.  You also see a sign.
Obvious exits: out.
Room Number: 12182

Upload the map database with ;repository upload-mapdb

Delete a room

Go to each surrounding room and perform the following, where "roomid" is the id of the room you are going to delete. It must be enclosed in quotation marks. This is the same as the 'snip' alias above.

;e Room.current.wayto.delete("roomid")
;e Room.current.timeto.delete("roomid")

Finally, remove the room. Roomid is NOT quoted here. Enter it as a number.

;e Map.list[roomid] = nil

Advanced Movements with StringProcs

Complicated actions ones which require multiple movements to get to the target room. A complex action is not just go, move, climb, etc... but involving searching to discover the path, or pushing an object to open a door. Use a stringproc to add these. Note: these actions require approval from the mapdb admin, and will lock the mapdatabase until they are approved/rejected. Do not add them without testing them.

;e Room.current.wayto['1220'] = StringProc.new(“fput 'search'; move 'go path'”)

Calling Bescort with StringProcs

Certain actions like navigating mazes and ferry crossings are more smoothly handled by a separate script. Rather than create a complicated StringProc, its preferred to use bescort. Modify bescort.lic to handle the navigation and then start it in the desired room using a StringProc.

Here is an example of a StringProc to call bescort to take the sea mammoth from Ratha to Fang Cove.

StringProc.new("start_script('bescort', ['mammoth', 'fang']);wait_while{running?('bescort')};")

It is also suggested that you get some sort of accurate estimate of the crossing time! Don't use the default 0.2 seconds for the timeto if it takes minutes. Timing impacts the route go2 decides to take.

Update Rooms with multiple descriptions

Go2 uses room descriptions part of determining what room you're in. If the room has multiple descriptions, the room you are in may appear to be unmapped during some seasonal/time change. To correct this, add the room description to the correct room. Do not remap the room.

This assumes you are standing in the target room with its new description and you know the roomid. You can find the roomid by going to a connecting room and looking at the room number for the direction of the room without a number.

If you have not already, you need to run

;alias add ad = ;e Room[\?].description.push(XMLData.room_description)

then

;repository checkout-mapdb
ad roomnumber-it-should-be
;repository upload-mapdb

Example

The first room in the log below doesn't have a room ID. This could either be unmapped or missing a description. To find out, we'll visit a neighboring room and check its exits using the 'ids' alias. If the exits point to the missing room then we know its room ID and just have to update the description. When we know the room ID we walk back and use the 'ad ####' alias to update the given roomid with the description of the room we are standing in. To verify it was updated, we re-enter the room and see that it now has a room id.

[Boar Clan, Split-Log Path]
The sounds of the forest permeate the palisade wall and wash over the sleeping village.  Each breath of wind rustles the trees that stir the night air and conduct the arboreal symphony.  Chirping insects and the deep throaty calls of frogs keep the rhythm while high-pitched animal cries weave a soprano's song with a melody only nature could compose.
Obvious paths: northeast, west.
>ne
You stroll northeast.                                                                                                                                                                                             
[Boar Clan, Split-Log Path]                                                                                                                                                                                       
A tall palisade wall of thick iron-banded tree trunks embraces the small village of thatched longhouses and bark-covered huts.  Split log walkways snake between the structures.  One rutted dirt path leads from the gate to a squarish building with deep eaves that shelters stacks of crates and barrels piled outside the door.  You also see a palisade gate, the stable doors and a long log nestled underneath a nearby tree.                                                                                                                                                                                                           
Obvious paths: northeast, southwest.                                                                                                                                                                              
Room Number: 4106                                                                                                                                                                                                 
>;repo checkout-mapdb                                                                                                                                                                                             
--- Lich: repository active.                                                                                                                                                                                      
[repository: success;  running download-mapdb now...]                                                                                                                                                             
[repository: map database is up-to-date]                                                                                                                                                                          
[repository: done]                                                                                                                                                                                                
[repository: edit your map database and     ;repository upload-mapdb     within 24 hours.]                                                                                                                        
--- Lich: repository has exited.                                                                                                                                                                                  
>ids                                                                                                                                                                                                              
--- Lich: exec1 active.                                                                                                                                                                                           
[exec1: 4106:{"4105"=>"go gate", "4107"=>"southwest", "4109"=>"northeast"}]                                                                                                                                       
--- Lich: exec1 has exited.                                                                                                                                                                                       
>sw                                                                                                                                                                                                               
You stroll southwest.                                                                                                                                                                                             
[Boar Clan, Split-Log Path]                                                                                                                                                                                       
The sounds of the forest permeate the palisade wall and wash over the sleeping village.  Each breath of wind rustles the trees that stir the night air and conduct the arboreal symphony.  Chirping insects and the deep throaty calls of frogs keep the rhythm while high-pitched animal cries weave a soprano's song with a melody only nature could compose.                                                                 
Obvious paths: northeast, west.                                                                                                                                                                                   
>                                                                                                                                                                                                                 
Your body below the waist is dripping with water.  Pools of it are forming all around you.                                                                                                                        
>                                                                                                                                                                                                                 
You've gained a new rank in your knowledge of sorcery.                                                                                                                                                            
>ad 4107                                                                                                                                                                                                          
--- Lich: exec1 active.                                                                                                                                                                                           
--- Lich: exec1 has exited.                                                                                                                                                                                       
>ne                                                                                                                                                                                                               
>sw                                                                                                                                                                                                               
You stroll northeast.                                                                                                                                                                                             
[Boar Clan, Split-Log Path]                                                                                                                                                                                       
A tall palisade wall of thick iron-banded tree trunks embraces the small village of thatched longhouses and bark-covered huts.  Split log walkways snake between the structures.  One rutted dirt path leads from the gate to a squarish building with deep eaves that shelters stacks of crates and barrels piled outside the door.  You also see a palisade gate, the stable doors and a long log nestled underneath a nearby tree.                                                                                                                                                                                                           
Obvious paths: northeast, southwest.                                                                                                                                                                              
Room Number: 4106                                                                                                                                                                                                 
>                                                                                                                                                                                                                 
You stroll southwest.                                                                                                                                                                                             
[Boar Clan, Split-Log Path]                                                                                                                                                                                       
The sounds of the forest permeate the palisade wall and wash over the sleeping village.  Each breath of wind rustles the trees that stir the night air and conduct the arboreal symphony.  Chirping insects and the deep throaty calls of frogs keep the rhythm while high-pitched animal cries weave a soprano's song with a melody only nature could compose.                                                                 
Obvious paths: northeast, west.                                                                                                                                                                                   
Room Number: 4107                                                                                                                                                                                                 

Adding identical rooms

Taken from [1]

Fixing this sort of thing requires more knowledge of how the map database works than your standard mapping procedure. If it wasn't in River's Rest, I could run over to the room and give it a look and either fix it or give you some useful pointers, but since it's in River's Rest and I'm lazy, you're screwed.

My assumption is that there are two rooms that are in different places but have the same room title/description/paths. There are several ways to deal with this, and they are mostly terrible.

First, go to each of the identical rooms and type:

;e echo Room.current_or_new

If one of them shows up with a new room number, everything is good and right in the world (this isn't going to happen).

Second, perhaps someone used ";mapmap fix" incorrectly (they didn't, because no one uses that, even though it's in the instructions). To check if this is the case, go to each of the identical rooms and type:

;e echo Room.current.desc.length

In the map database, rooms can have more than one description. This is mostly to deal with different night/day descriptions for the same room, but it can rarely have other uses. When using ";mapmap fix", the script tests existing paths to see if you end up in the expected room. If you don't, it'll ask you if the rooms are the same. If you tell it they're the same, it'll combine them so they both have the same room number. If not, it will delete the path and create a new one to the different room. Someone may have said yes when they shouldn't have, which would add two unrelated room descriptions (and/or titles/paths) to the same room id. If the above command says "1", then this is not the case. If it's more than one, then it might be the case, but I won't go into it further because it's too unlikely.

So now we need to differentiate between the two horrible rooms. The best way to do this is with the room_objects tag. If there's something that shows up in the "You also see" line that is permanent, such as an arch or a door or something, and it's in one room but not the other, then all is good and right in the world (unlikely). Type:

;e echo DRRoom.room_objs

to see the exact object name, and then type:

;e Room.current.room_objects = [ 'whatever' ]

replacing whatever with the object name. Now, the room that has that object should keep the room number, and the room without the object should either be unknown, or might still tell you it knows the room id because of fuzzy room lookups. Either way, go to the other room and do a:

;e echo Room.current_or_new

and there should be two room ids. Then you can go over the whole area with a ";mapmap map" and a ";mapmap fix" and it should be good.

If room_objects isn't an option, you can use a peer tag, which causes Lich to peer into the next room in order to discriminate between two rooms. This is nice because it lets you use either room as a target for go2, but it's terrible because it has to peer if you walk through the room with narost running.

If the title/description/paths of each adjacent room is identical in each identical room (unlikely but actually has happened more than once), then you're stuck with treating the two rooms as one. You would need to create some creative StringProcs paths from each room to each adjacent room that will be sucessful regardless of which of identical room it's started in.

I left out the location verb property because it sounds like these rooms are in the same location.

Adding a new map image

Lets add a new map image!

Copied from lrn2map:

Step 6: Add to narost (if needed or wanted)

6a. Add the image to the map database. Narost will only display images that are already in the map database. If the image is already in the map database because it's used by other rooms, move on to 6b. If not, save the image in the lich\maps directory, go to a room that will use the image, and type ;e Room.current.image = 'filename' # substitute the actual filename of the image, including the file extension, but without the path. Name the file is all lowercase with the formatting province-mapnumber-name-timestamp.whatever. You can get the timestamp by typing date +%s in a linux environment. If you leave a timestamp off there is no way to overwrite the map with a newer version without uploading a new file name. Make absolutely sure not to include apostrophes in the name.

6b. Start narost in fix mode (;type ;narost fix)

6c. Bring up the image in narost. Right-click in the narost window, click on “view map” in the popup menu, and click on the image name that you'll be adding to.

6d. Move the image around to find where your current room goes.

6e. Hold down the Shift and Ctrl keys, click on the top left and bottom right corners of the room on the image, let go of Shift and Ctrl.

6f. If there are more rooms to add, move to the next room in game, go to step 6d.

6g. Save the map database (type ;e Map.save). While the mapmap script saves the map database every time it closes, narost does not. You can save the map database as often as you like if you are worried about losing your progress.