Replies and errors
The shape of a reply
A run reply starts with how the wait ended, then what changed, then the events, then the state line:
> run code="must(gather(\"stone\", 2))\nmust(stash(\"stone\"))"
woke done 0m15s
+1 Ether
Energy +4, Mining +18
A thread of Ether comes loose and settles in your pack. Every kind of work shakes a little free.
stashed 2 stone (locker now 2)
done
@d1 00:00 Locker Row 168,234 | energy 18/18 | pack 2/30 | 12m | idle
woke <reason> <time>: whyrunreturned, and the game time it waited.- The digest: items gained and lost, motes, practice. Never a wake by itself.
- Events:
printlines,failandneed:lines, levels, quest steps, what people say. At most 5 event lines, thenN earlier lines in journal op=log. The lines that end a script or alert, with thefailandneed:lines just before them, always show; the rest are the latest ones, so what a script printed last is there. - The state line, last.
Waking
| Class | Reasons | The script |
|---|---|---|
| Wakes, and the script has ended | done, stopped, error | Ended |
| Wakes, and the script carries on | owner (an owner message), dm, decision, alert, quest_done | Running: run with nothing keeps it going |
| Back to the script, no wake | every why word | The script decides |
| Heartbeat | max_wait | Running |
| Replaced | superseded | A newer run took over |
The state line
@d1 00:00 Murmur Cut 145,233 | energy 18/18 | pack 2/30 | 12m | running ore (gathering stone)
Time, place and tile, energy, pack, motes, and what the character is doing: running <script> (<action>) or idle.
Errors before running
run with code or a script, and scripts op=save or check, check the text first. Lua's own syntax check comes first, then the mistakes models make most. Markdown fences around the code are taken off silently.
gahter("stone")
-- => error run line 1: 'gahter' is not a verb or variable; did you mean gather?
local x = 1
heal()
function heal() end
-- => error run line 2: heal is defined below, on line 3; define it above the line that uses it
buy(3, "charcoal")
-- => error run line 1: buy takes the item first: buy("charcoal", 3)
gather("stone", "until full")
-- => error run line 1: gather's second argument is a count: a number or "all".
-- => To stop on a condition, loop: while not me.full do must(gather("stone")) end
go("Wakinhall")
-- => error run line 1: no place you know called 'Wakinhall'; did you mean wakinghall?
give("stone", 1)
-- => error run line 1: give isn't something you can do; trade with the say tool
must(gather("stone"))
Wait, I should stash it first.
-- => error run line 2: this looks like prose after the program; send only Lua
for i = 1, 3 do
gather("stone")
-- => error run line 3: 'end' expected (to close 'for' at line 1) near <eof>
A name close to nothing known passes with a note, because the script may learn it first.
Errors while running
Lua's own messages, in the house format error <script> line N: ..., with plainer words for the common ones.
print(me.stones)
-- => error run line 1: me has no field 'stones'; see the card
local p = patches("nothing")
print(p.left)
-- => error run line 2: attempt to index a nil value (local 'p')
local t = { 3, 1, 2 }
table.sort(t, function(a, b) wait(1) return a < b end)
-- => error run line 2: actions can't run inside table.sort or a metamethod; call them outside it
must(stash("stonesickle", 1))
-- => error run line 1: none
must turns a failed action into an error at your line, with the why word; the fail line above it in the reply has the detail.