Skip to content

OLC Line Editor

Kit Oliynyk edited this page Nov 2, 2026 · 3 revisions

TL;DR: Multi-line text in OLC (room and object descriptions, helps, extra descriptions) is edited in a line editor modelled on Unix ed, or in a browser editor (webedit) in the web client. The line editor works over telnet and with screen readers and is the only editor those players have. It is not obsolete. Use when: you edit a long text over telnet, you need the ed command reference, or a text you typed vanished. Source of truth: plug-ins/ed/lib/edparse.y++ and edscan.l++ (grammar), plug-ins/ed/lib/ed.cpp (commands), plug-ins/ed/xmlpcstringeditor.cpp (! commands, registers, prompts), plug-ins/olc/sedit.cpp (the in-game hint), plug-ins/olc/webedit.cpp, plug-ins/olc/olcstate.cpp (editor). Verified: 2026-11-02 against dreamland_code 88da8302, dreamland_world 43880467

Two editors, one clipboard

Editor How to open Needs
Line editor A text command with no argument: desc, ed set <keyword>, behavior and so on Any client
Web editor desc web, or the web button next to a field The web client only (webedit refuses other clients)

They share one clipboard, called register 0. copy puts the current text of a field into it, paste writes it back. The web editor opens with the clipboard in a browser editor, and when you save, the client sends the field's paste command for you.

The in-game help line of the line editor points to the old page ED, which does not exist in this wiki, until the editor text is fixed.

Using the line editor

Opening it prints one line that names q (quit) and h (hints). The prompt is : in command mode and + in input mode. The text of the field is loaded into the editor's own line buffer.

Typical session:

desc
: %n
: 3c
+ This line replaces line three.
+ So does this one.
+ .
: %!format 0 75
: q
  1. %n prints every line with its number.
  2. 3c deletes line 3 and starts input at that place.
  3. . alone on a line ends input.
  4. %!format 0 75 re-wraps the whole text to 75 columns without an indent.
  5. q stores the text in the field and leaves.

q always stores the text into the field and there is no "quit without saving" command. In the editors that work on a copy (aedit, medit, oedit, hedit), a following cancel drops the whole edit. In redit the field is live and only a new edit changes it back.

Command form

[address[,address]]command[arguments]

A command without an address works on the current line. The current line is the last line you touched.

Address Means
. The current line.
5 Line 5. Lines are counted from 1.
$ The last line.
'a The line marked with the mark a.
/text/ The next line that matches the text. An empty text repeats the last search.
?text? The previous line that matches.
addr+3, addr-2 The line 3 after or 2 before another address (.+1, $-2).
% Every line (the pair 1,$).
3,7 Lines 3 to 7. The first may not be after the second.

An empty line prints the next line and moves to it. A bare address prints that line and makes it current.

Commands

Command Meaning
p Prints the lines. At most 80 lines at a time.
n Prints the lines with numbers.
a Appends after the line. Enters input mode. $a appends at the end.
i Inserts before the line. Enters input mode.
c Changes: deletes the lines and enters input mode in their place.
d Deletes the lines.
j Joins the lines into one, with single spaces between.
s/old/new/ Substitutes, see below.
m<c> or k<c> Marks the line with the letter c. Use it as the address 'c.
Y Yanks (copies) the lines into a register.
P Puts the register contents after the line.
!command Passes the lines to a text command, see below.
u Undoes the last change. Undo goes back step by step.
h Prints the hint.
q Stores the text and quits.

In input mode every line you type is added. A line that holds only . ends the mode.

d, c, Y and P take an optional register letter right after the command: 5,9dx deletes lines 5 to 9 into register x, .Px puts them back. Without a letter they use register 0, which is the edit buffer shared with copy, paste and the web editor. Deleting lines therefore overwrites what copy stored.

Substitution

s/pattern/replacement/
s/pattern/replacement/g
%s/colour/color/g
s
  • The delimiter is the first punctuation character after s. Use another one when the text holds slashes: s#a/b#c#.
  • The pattern is an extended regular expression.
  • In the replacement, & is the whole match and \1 to \9 are groups. \& and \\ give the plain characters. \r splits the line at that place.
  • Flag g replaces every match in the line instead of the first. Flag p prints each changed line.
  • s with no arguments repeats the last substitution.
  • By default s works on the current line, so put the address first: %s/a/b/g for the whole text.

The ! commands

! hands the addressed lines to a helper.

Command Meaning
!format <indent> <width> Re-wraps the lines to the width with a first-line indent. The defaults are indent 8, width 70. Colour tags do not count towards the width. !justify is a synonym.
!show Prints the lines with colour tags applied, to preview them. !print is a synonym.
any other word Runs it as a game command.

Descriptions of rooms and objects are normally wrapped by the game when shown. Do not put hard line breaks into a description by hand unless the text needs them (a poem, a sign).

Typing text inline

Fields also accept the new text on the command line: name Rusty sword. Be careful when the first word could be a subcommand. See the trap in OLC: the first word is matched against copy, paste, web and help in three languages. copy, paste and help match by prefix, web only in full. A text that starts with c, p, h, ?, с, к, п, в or д as a separate word is taken as a subcommand and can blank the field. Start such a text with {x.

Web editor

webedit sends the buffer to the browser, together with an optional mode (help for help articles, json for data fields). The browser opens a code editor. On save the client stores the text in the buffer and replays the paste command of the field you came from. The field button web in the editors does all of this in one click.

If your client is not the web client, webedit answers "this command works only from the web client".

Extra descriptions and other users

The extra description editors (ed set, uaed set, rued set, see OLC-Rooms) and the behavior and oldbehavior editors use the same line editor. XML editors check that the text is well formed when you quit, and keep the old value if it is not.

Known mismatches

  • The in-game hint lists %a ("append at the end"). The grammar has no such form, use $a. (unverified at runtime)
  • The in-game hint links to a wiki page named ED. This page replaces it.

See also: OLC, OLC-Rooms, Text-Markup, Accessibility.

Clone this wiki locally