|This page contains an entry from the official DM Reference.|
This is a text string that controls where an object that is listed in client.screen will appear on the user's screen. The format is:
"x,y" "x1,y1 to x2,y2"
The bottom left corner of the map viewport (southwest) is "1,1". If the view is 11x11, then the top-right corner (northeast) is "11,11". (Changing world.map_format may change the range for screen_loc.)
A range of coordinates (the second format above) causes a square region to be filled with the object at each position. The southwest and northeast corners of the box are indicated in the screen_loc value.
Sections of the map screenEdit
The edges of the map may also be referenced by using directions, such as "3,NORTH". For convenience, the order of coordinates is arbitrary when using directions, so one may specify y before x as in "NORTH,WEST". In expressions such as the latter, you may also leave out the comma.
The CENTER keyword can also be used. This can be used alone to completely center the object, or as either the x or y component. If the map covers an even number of tiles in either direction, pixel offsets will be applied automatically.
In addition to objects inside of the map view, one may create border objects. Borders are automatically created when screen objects are placed at coordinates outside of the inner map view. For example, objects placed at y=0 fall on a border directly below the map and y=-1 is one tile below that. (The CENTER keyword is based on normal viewport bounds and not any extra borders.)
Offsets from edge or centerEdit
Offsets may be applied to screen_loc coordinates. For example, "NORTH+1,WEST" is in a border above the map. "CENTER+2,CENTER-1" will appear 2 units right, 1 unit down from the center of the map.
It is also possible to specify a pixel offset. Screen objects do not use pixel_x and pixel_y for this purpose, because it is intended that an object could exist on the map and in the screen object list simultaneously, so positioning must be independent. Pixel offsets are specified after a colon like this: "1:16,1:16". In this case the object is shifted to the northeast by 16 pixels.
Normal layering rules apply to screen objects when using a default top-down world.map_format (TOPDOWN_MAP or TILED_ICON_MAP), so to color the background of the map (visible at least when regions of the map are blocked from view), one could create an object with a drawing layer below all other map objects and set its screen_loc to cover the whole map (e.g. "1,1 to 11,11"). To achieve this affect in other map modes like isometric, you will have to add BACKGROUND_LAYER to the layer.
Additional map controlsEdit
You can use HUD objects in any additional map controls that might appear in game's skin file. If you have a second map named "map2" for instance, then you can use "map2:1,1" or something similar as a screen_loc. If the map control is set to automatically scale to fit its contents, it will try to show every object you put there. (NOTE: You should not use the full window.control name, just the name of the control itself. Map controls should always have unique names.)