ARCHON · SHELL/CODEX

STANDING ORDERS

NOTE

> STATUS reference note. 7 sections.

> CONTENTS

the language · conditions · triggers · schedules · stations and facilities · latency · tracing

Standing orders keep an empire running without a bot polling: triggers react to conditions, and schedules run programs aboard ships, stations and facilities.

The language

Conditions

Condition Holds when
{"ships": <selection>, "count": <threshold>} The number of ships a group, query or node matches meets the threshold
{"body": id, "distance": <threshold>} A body is that far from its star, by its last seen orbit. temperature checks its warmth
{"cargo": {"station": id, "<commodity>": <threshold>}} A station, or a ship with ship, holds that much of a commodity
{"tick": <threshold>} The current tick meets the threshold
{"every": n} The current tick is a multiple of n
{"ship": <match>} Schedules only: the ship running the program matches the ship query fields
{"and": [...]}, {"or": [...]}, {"not": {...}} Combine conditions

Triggers

A trigger checks a condition every tick and, when it holds, gives one order to a selection of ships.

{"when": {"ships": {"group": "full"}, "count": {">=": 1}},
 "do": "transfer",
 "args": {"commodity": "iron", "to_kind": "station", "to_id": 1},
 "ships": {"group": "full"},
 "on_fail": {"do": "move", "args": {"body_id": 17}},
 "until_tick": 9000}

Schedules

A schedule gives a program to a selection of ships, each running its own copy, or to one station or facility.

{"ships": {"node": 2},
 "program": [
   {"forever": [
     {"do": "move", "args": {"body_id": 18}},
     {"do": "extract", "args": {"body_id": 18}, "on_fail": [{"break": true}]},
     {"wait": {"until": {"cargo": {"station": 1, "iron": {"<": 1900}}}, "at_most": 100},
      "on_timeout": [{"stop": true}]},
     {"do": "move", "args": {"body_id": 17}},
     {"do": "transfer", "args": {"commodity": "iron", "to_kind": "station", "to_id": 1}}
   ]},
   {"do": "move", "args": {"body_id": 17}}
 ]}
Block Does
{"do": verb, "args": {...}} Gives an order. The step ends when the ship is idle again
"on_fail": [...] On a do: steps to run if its order fails
{"wait": {"ticks": n}} Waits n ticks
{"wait": {"until": <condition>}} Waits until the condition holds. at_most and on_timeout give up after a time
{"if": <condition>, "then": [...], "else": [...]} Runs one branch
{"forever": [...]} Repeats until a break or stop
{"repeat": n, "loop": [...]} Repeats n times
{"while": <condition>, "loop": [...]} Repeats while the condition holds
{"break": true} Leaves the innermost loop
{"stop": true} Ends the program for this ship

Stations and facilities

Latency

Tracing