The result
dt::unitdharmatiles version="1.0.0"
// A bare number is not a length: the wobble needs a unit, so this tile does not build.
tile size="1x1" seed=4 {
line stream wobble=5 { through "(0sq, 0.5sq)" "(1sq, 0.5sq)" }
stack {
base
dirt
}
}
5dmm or 5mm.Say it plainly
A control wants a kind of value, and a formula has the kind its parts give it. A length plus a length is a length; a length times a plain number is a length; a length plus a plain number is refused.
Because nothing is guessed, a mistake of kind is found at the line it is written on, with what to write instead.
The rules
Lengths, angles and plain numbers are checked apart
Lengths, angles and plain numbers are checked apart, before anything is built. A control wants a kind, and a formula has the kind its parts give it:
| Written | Kind | Why |
|---|---|---|
$bottom + 2layer | length | length + length |
1 - $d * $d | plain | $d is a fraction |
$bottom + 30dmm * (1 - $d * $d) | length | length + length × plain |
$groundHeight + 20% | error | a length plus a plain fraction; write $groundHeight + 20% * 10dmm |
$groundHeight + $x | error | squares counted are plain; write $groundHeight + 4dmm * $x |
2dmm * 3dmm | error | no area exists in this language |
size=5 | error | a size is a length: dt::unit says to write 5dmm or 5mm |
sin(360 * $x) | error | sin takes an angle: write sin(360deg * $x) |
$region + 1 | error | a region is not a number |
A mismatch is dt::type, a number missing its unit dt::unit; both point at the value and say what to write. A let holds whatever its formula is, so let reach "3dmm" is a length wherever it is read and let n 3 a plain number. A param takes its kind from the control it fills (parts).
The editor shows a length as written and as printed
The editor's property sheet shows a length as you wrote it, with its unit (7 dmm), and never changes one unit into another on its own. Hover a unit for what it is, in the program's own words (dmm: design millimetre, 1/35 of a square; 1 mm on DungeonBlocks, 0.73 mm on OpenLOCK). Beside the written value, quieter, it shows what the length prints on the current build target, the system and printer in the title bar: 7 dmm · prints 5.08 mm on OpenLOCK, 3.5–6.5 dmm · prints 2.54–4.72 mm for a range. The printed size shows only where it differs from the number written: never for mm, never for dmm on DungeonBlocks, for every dmm length on OpenLOCK, and always for sq, in and layer. A formula ($groundHeight + 4dmm) shows the printed size it works out to, the $ heights read from the tile as a build reads them. The program works every printed size out, with the same reader and evaluator as a build; the page does no unit arithmetic.
Typing is literal: what you type into a value is written exactly, so 7dmm edited to 7mm is 7mm. A printed number of a plain number or range is typed too: the program writes it back in the value's own unit, so the intent is kept (typing 5 against 7dmm on OpenLOCK writes 6.89dmm; on DungeonBlocks, 5dmm). A printed size reads to 0.01 mm, and the value is written with the fewest decimals that print exactly the size you typed to 0.01 mm. Each end of a range is typed separately and the other end is kept as written. A formula, or a value with odds written on it (low(3dmm .. 6dmm, 2)), only shows its printed size: edit it as written.
Errors this page explains
Next
Next: names, for reusing a number or a height.