Skip to content

Engraved stones

A player buys a stone from an architect for 10000 gold, puts it on the ground and writes a title and a short text on it. Everyone who passes can read it with a double click; only its owner can lift it again.

  1. Buy an engraved stone from an architect. The buyer becomes its owner.
  2. Drop it on the ground where you want it. Nobody else can lift it: the owner, and the staff, can.
  3. Type .write and target the stone. A gump opens with a field for the title (40 characters) and six lines of text (60 characters each), already filled with what is written. Save keeps the answer, Cancel closes the gump.
  4. Anyone double clicks the stone to read it in a gump of its own. A stone nobody wrote on says so.

The title becomes the name of the stone, so the client shows it on a mouse over; an empty title gives the stone its own name back. Control characters are removed and texts longer than the limits are cut. The texts are shown as plain text: nothing a player types is read as HTML.

The tag owner_on_buy = "true" on an item template makes the vendor stamp the prop owner (the serial of the buyer) on every item it makes for a purchase. It is generic: any template can use it, the engraved stone is the first. A stone made with .add engraved_stone has no owner, so only the staff can lift it or write on it.

The prop stays with the stone. The script of the stone refuses every lift but the owner’s and the staff’s (can_pick_up), and every drop into a container that is not the owner’s own (can_drop, which is told the serial the drop names): a stone can go on the ground, onto its owner, or into a bag or the bank the owner carries, and a bag lying on the ground, a bag of another player or another character refuses it, so nobody can carry it away inside a bag. Dropping it onto any item lying on the ground is refused as well: drop it on an empty tile. The staff can put it anywhere. The template is blessed, so a dead owner keeps the stone out of the corpse, and it never decays on the ground. What the script cannot see is a move made by the staff or by another script, which it is not asked about.

Texts: the title cannot hold <, > or a leading # (the title is the name of the item, which tooltips show), and what is written is kept as typed, so ${name} in a line is a line and not a placeholder.

File What it is
templates/items/misc/engraved-stones.toml the template engraved_stone: a headstone (0x1165), not stackable, movable (its graphic has the tiledata weight 255, which would count as fixed), never decaying, blessed, script_id = "engraved_stone", the tag owner_on_buy
templates/shops/architect.toml the buy line: 10000 gold, five pieces in stock
scripts/items/engraved_stone.lua on_use opens the read gump, can_pick_up lets the owner and the staff lift it
scripts/common/engraved_stone.lua the limits, and the rules shared by the script and the gumps
templates/gumps/stone_read.xml the read only gump
templates/gumps/stone_write.xml and scripts/gumps/stone_write.lua the gump to write; the script builds the fields and saves

The text lives in the props stone.title and stone.text (the lines joined by a line break), saved with the item. The limits are the constants TITLE_MAX, LINES and LINE_MAX in scripts/common/engraved_stone.lua: change them there and the fields follow.

The save does not trust the answer of the client: it checks again that the stone is an engraved stone and that the player owns it, or is staff, and it cleans and cuts every text before it keeps it.

Made with ❤️ by Tom

Buy me a coffee