Reference
The command language
Eight little commands build any block world. The world is a grid: every spot is three numbers — across, forward, up — from 0 to 31. Programs run top to bottom, one line at a time. Back to the labs anytime: Open the console →
- set
set <block> <x y z>Place one block at a spot. The three numbers are across, forward, and up.
set lantern 3 3 0 - ~ (relative)
set <block> ~0 ~0 ~1~ means “relative to the cursor”. ~0 ~0 ~1 is “same across, same forward, one up” — so you never have to know the cursor’s number.
set lantern ~0 ~0 ~1 - move
move <dx dy dz>Slide the cursor. move ~1 ~0 ~0 steps one block east; move 6 2 0 jumps to an exact spot.
move ~0 ~0 ~1 - repeat
repeat <n> { … }Run the block inside the braces n times — the loop does the copy-paste for you.
repeat 4 { set stone ~0 ~0 ~0 move ~0 ~0 ~1 } - define
define <name> { … }Teach the console a brand-new word. Afterwards you can say that word as many times as you like.
define pillar { repeat 3 { set stone ~0 ~0 ~0 move ~0 ~0 ~1 } } move 2 2 0 pillar - define(…) with a number
define <name>(h) { … }A word that takes a number. Use h inside wherever the number goes, then call it with a value.
define tower(h) { repeat h { set stone ~0 ~0 ~0 move ~0 ~0 ~1 } } tower(5) - paint + @query
paint <block> @<kind>[within=<n>]Ask the world for every block of a kind within n of the cursor, and recolour them all at once. Anything farther is skipped.
paint lantern_lit @lantern[within=3] - when … do
when <condition> do <command>Run the command only if the condition is true (like night). The same program does nothing when it is false.
when night do paint lantern_lit @lantern[within=5]
Where this idea comes from
Where is (3, 3)?
There are two ways to say where something is. You can count from a fixed corner (across 3, forward 3), or you can count from where you stand (one step ahead, one to the left). CommandForge has both: plain numbers count from the corner, and ~ counts from the cursor.
One thing to hold: A chess game written down. Philipp Stamma’s book of 1737 named each square with a letter and a number, like e4, the way players write games today, so a game can be replayed from paper hundreds of years later.
Why it matters: Numbers for places let you say exactly where without pointing. Mathematicians use them to draw shapes from equations, chess players to record games, and programs to tell a machine where to put something.
What we don’t know: Grids of x and y are called "Cartesian" after René Descartes, but his 1637 book did not draw two crossing axes the way we do now. Pierre de Fermat had the same idea at the same time, and later mathematicians built the grid we use. Who should get the credit is still argued.
Dates:
- 1637 Descartes describes points and curves with numbers.
- 1737 Stamma names chess squares with a letter and a number.
- 1970 About now, Logo’s turtle moves from where it stands: FORWARD 50, RIGHT 90.
Tip: a wrong run is the fastest way to learn — the console tells you the exact line and what to fix. Try a lab →