Tempus Script Guide
A cookbook for the Tempus scripting language. Where the tutorial teaches the language one concept at a time and the reference answers "what does this one built-in do?", this guide is organized around what you want the script to accomplish. Each chapter is a set of recipes for a kind of behavior — making an NPC talk, searching a room, remembering a visitor, spawning an item, surviving combat — with the built-ins and language features woven in where the behavior needs them.
If you are brand new, start with the tutorial. If you want the exact rules, the language specification is authoritative on correctness. Read this guide when you know what you want to do and want the idiomatic how.
How to read a recipe
Most examples are handler fragments — a before/handle/after block
bound to an event — that you can paste into a mob, object, or room script
with OLC. Read a bare statement as if it sat inside an enclosing handler
body. A line beginning with # is a comment and does nothing.
# greet the first player to speak nearby
after command (say) {
require [isplayer $actor]
echo $actor "The old man nods at you."
}
Every built-in and language construct appears in at least one worked example somewhere in these chapters; the final Coverage index maps each one to where it is shown.
Chapters
- Reacting to events — choosing the right
event and phase, filters, bound variables,
require/unlessguards, and intercepting the default action. - Talking, emoting, and messaging —
do,echo,emit,force,silently, pronouns, string interpolation, and varying responses withrandomly. - Finding things in the world — producing and consuming iterables: looping, filtering, counting, picking, and testing membership.
- Inspecting entities — reading an entity's attributes, telling players from mobs, locating objects, and guarding against null or stale references.
- Numbers, text, and logic — arithmetic,
comparison, the logic operators, random rolls, conversions, and
ifas an expression. - Variables, scope, and memory —
let,set,const, lexical scope, the counter idiom, persistentstore/recall/forget, and player tags. - Changing the world — spawning and purging, teleporting, doors and exits, prototypes, behavior flags, and making a mob travel.
- Combat, damage, and death — reacting to combat, dealing and healing damage, casting, rewarding kills, and intercepting death.
- Structuring larger scripts —
def, top-levelconst, blocks as values,&references, rest parameters, the/>threading operator, control flow,pause, andnuke. - Coverage index — every built-in and feature, mapped to the chapter that demonstrates it.
A note on owners
A script's owner ($self) is the mob, object, or room it is attached
to. Some recipes only make sense for a particular owner: do, silently,
walkto, selfpurge, and mobflag need a mobile owner; ldesc
works on a mob or object; object handlers like get/wear live on the
object being acted on. Each recipe notes when the owner matters.