- Knownframe
- battlemap-mcp
- Docs
- v1.2.0
- Objects, prefabs and text
Objects, prefabs and text
Generated from battlemap-mcp v1.2.0. Your assistant gets these same names, descriptions and parameters from the server when it connects; the server is named battlemap, so a client may show a tool as battlemap:ping or similar.
place_object
Place an object (prop) on the current map. Returns the new element id.
If you place a colourable asset WITHOUT a colour, the response comes back with colorable: true and mask_fraction, and its note says whether the object is a flat red shape or just has red accents. Colour is baked at placement, so the fix is to delete it and place it again with color.
x, y: woxel coordinates; defaults to map center. rotation: degrees.
Two different tints, do not confuse them: color or modulate.
| Parameter | Type | Default | Description |
|---|---|---|---|
asset required | string | an Objects asset path from list_assets(category='Objects'). | |
x | number | null | null | |
y | number | null | null | |
scale | number | 1 | |
rotation | number | 0 | |
sorting | integer | 0 | 0=over, 1=under. |
layer | integer | 100 | which layer the object is drawn on — a VALUE, a multiple of 100 from -500 to 900 (also 1100, Above Lights, when get_status.unofficial_patch is loaded), not a menu index. 100 is the default and where most objects belong. Raise it to put something ON a surface: a floor pattern sits on 100, so a mug placed on 100 can be buried by it, while 200 puts the mug above. sorting only reorders siblings within one layer and cannot do this. The response reports the layer the object actually landed on. |
color | string | "" | '#rrggbb', Dungeondraft's own colourable-asset colour — the same thing the app's colour picker sets. Only assets carrying the colourable attribute respond to it (including colorable carpets and crystals). On any other asset it is stored and never renders. |
modulate | string | "" | retained for compatibility, but nonempty values are refused because Dungeondraft does not preserve this tint when saving and reopening. |
block_light | boolean | null | null | |
snap | string | "" | 'none', 'grid' or 'auto'; see get_snap_settings. |
place_objects
Place many objects at chosen positions in ONE call and ONE undo step.
Use it whenever you know where several things go: a row of tables, the dressing on a bar, eight trees ringing a clearing. Each entry takes the same arguments as place_object and behaves identically.
scatter_objects is for RANDOM arrangement over an area; this is for deliberate positions.
Up to 100 entries in objects. Every asset is checked before anything is placed, and if one entry fails the whole batch is rolled back, so the map never holds a half-finished batch whose ids you were not told.
Returns objects: one {id, position, layer} per entry, in the order you passed them, plus ids. Entries placed from a colourable asset with no color are listed in the note: those are flat red, and colour cannot be added afterwards.
One undo() reverses the whole batch while it is the latest operation. snap applies to every entry with an x and y; see get_snap_settings.
A batch placed entirely at scale 1.0 on quarter turns comes back with an arrangement_note: most placements read better with slight variation.
| Parameter | Type | Default | Description |
|---|---|---|---|
objects | PlacedObject[] | null | null | |
file | string | "" | an absolute path to a JSON file of the same entries (a list, or {"objects": [...]}), up to 1000. Use it when a script computed the positions: write the file and pass its path instead of copying hundreds of entries into the call. The reply is compact: placed, id_ranges ([first, last] runs of ids) and colorable_without_color. |
snap | string | "" |
scatter_objects
Scatter objects randomly over a rectangular area, with jittered scale and rotation.
This is the tool to reach for when a space should look furnished or lived-in rather than placed-at-coordinates: foliage, rubble, crates, clutter, debris. Placing twenty objects individually reads as a grid; this does not.
scale_min / scale_max: random scale range per object. rotation_min / rotation_max: random rotation range in degrees.
Returns the ids placed, how many attempts it took, and a note if it could not fit the requested count.
| Parameter | Type | Default | Description |
|---|---|---|---|
assets required | string[] | one or more Objects asset paths from list_assets(category='Objects'). Each placement picks one at random, so pass a few related assets for variety. | |
rect required | number[] | [x, y, w, h] in woxels. 256 woxels = 1 tile. | |
count | integer | 12 | how many to place (1-500). |
scale_min | number | 0.9 | |
scale_max | number | 1.1 | |
rotation_min | number | 0 | |
rotation_max | number | 360 | |
min_gap | number | 0 | minimum woxel distance between placements. Use it to stop clumping; too large for the area and you get fewer than count (the response says so). |
color | string | "" | optional '#rrggbb' applied to every placement, baked at placement and never changeable afterwards. Only colourable assets respond — see place_object. |
sorting | integer | 0 | |
layer | integer | 100 | layer VALUE for every placement (multiple of 100, -500..900, or 1100 with the Unofficial Patch). Same meaning as in place_object; 100 is the default. |
seed | integer | null | null | fixes the arrangement so a run is reproducible. Pass one when you want to adjust a single parameter and compare, rather than reshuffling everything. |
place_prefab
Place one of Dungeondraft's pre-composed prefabs by name.
Call list_prefabs first to see what exists — names must match exactly.
Reach for this before hand-composing a common furnished unit. A tavern's tables, a market stall, a smithing setup or a well already exist as prefabs and will look better assembled than placed piece by piece.
ALWAYS pass x and y. A prefab otherwise lands wherever its author saved it, usually near the map's top-left corner. With x and y the prefab's centre lands there, and placement in the response reports what moved. If it still lands wrong, undo() removes the whole prefab in one step while it is the latest operation.
x, y: woxel point to centre the prefab on. Pass both or neither.
Placement transforms walls with their mounted portals, paths, roofs, patterns, objects, lights, freestanding portals, and text anchors (labels stay upright). Cave-generated walls and unsupported elements are listed in placement.skipped with reasons in placement.unsupported. Inspect those and the footprint before repeating. To shift or rotate the group afterwards, use move_elements with the returned ids — one call, one undo step.
| Parameter | Type | Default | Description |
|---|---|---|---|
name required | string | exact prefab name from list_prefabs. | |
set | string | "" | optionally switch set first. |
x | number | null | null | |
y | number | null | null | |
rotation | number | 0 | degrees to turn the whole prefab about its centre. |
snap | string | "" | snaps the centre x, y; see get_snap_settings. |
modify_object
Modify an existing object's scale, rotation (degrees), color, shadow and/or light-blocking by id.
color is REFUSED: colour is baked at placement and cannot be changed afterwards, here or in Dungeondraft's own UI. Set it in place_object.
Unlike colour this IS changeable after placement, and it is how a map built before layers were assigned correctly gets repaired.
| Parameter | Type | Default | Description |
|---|---|---|---|
id required | integer | ||
scale | number | null | null | |
rotation | number | null | null | |
color | string | "" | |
modulate | string | "" | nonempty values are refused because the tint does not survive saving and reopening. |
shadow | boolean | null | null | |
layer | integer | null | null | move an existing object to a layer VALUE (multiple of 100, -500..900, or 1100 with the Unofficial Patch). |
block_light | boolean | null | null | whether this object STOPS light passing through it. A drawn shadow and a light block are different things — a crate stack with a shadow but no block still lets a lantern light the room through it. Set it on anything solid enough to stand behind: crates, bookcases, screens, a wagon. get_element reports it back. |
duplicate_object
Duplicate an object by id, offset by (dx, dy) woxels. Returns the new element id.
| Parameter | Type | Default | Description |
|---|---|---|---|
id required | integer | ||
dx | number | 64 | |
dy | number | 0 | |
snap | string | "" | rounds dx, dy to the nearest whole grid steps; see get_snap_settings. |
add_text
Add a text label at a woxel position. Returns the new element id and size.
| Parameter | Type | Default | Description |
|---|---|---|---|
text required | string | ||
x | number | null | null | |
y | number | null | null | |
size | integer | null | null | font size in points (default ~32). |
color | string | "" | '#rrggbb' (default black). |
font | string | "" | a DD font name; omit to keep the default font. |