Run a crafting flipper
The hexis/flip libraries are one crafting engine with an objective on top. Hexis ships two
scripts on it: Craft Flipper makes coins, Carpentry XP reaches Carpentry 50. A script of your
own is the same shape: settings, an objective, one call.
local CONFIG = {sell_npc = true, sell_offer = true, sell_instant = true,
buy_order = true, buy_instant = true, supercraft = true, max_items = 12,
tax_percent = 1.25, auction_house = false, auction_slots = 14, stop_loss_millions = 10}
for key, value in pairs(hexis.config.snapshot()) do CONFIG[key] = value end
require("hexis/flip/engine").run({
script = "yourname:coin-crafter",
config = CONFIG,
objective = require("hexis/flip/objectives").coins(),
})
engine.run does not return. It reads the purse, opens the bazaar with /bz (an active Booster
Cookie is needed), prices the market from hexis.price.of, plans, and loops: read your orders,
claim what filled, craft, sell, order ahead, and pick the next job. It rebuilds the plan whenever
fresh prices arrive and nothing is mid batch, and ends the script with the reason it stopped.
Settings the engine reads
| Key | Meaning |
|---|---|
sell_npc, sell_offer, sell_instant, auction_house | Ways to sell. auction_slots caps listings. |
buy_order, buy_instant | Ways to buy. |
supercraft | One click per load in the Craft Item menu. |
max_items | Most items planned at once. |
tax_percent | Bazaar tax; scaled by the mayor. |
coin_limit_percent | The share of the purse that may sit in open orders and stock. |
loss_mode, max_loss_millions | The plan's loss budget: Custom sets a number, Purse uses the coin limit. Absent means 0. |
stop_loss_millions | The account's loss stop, when it differs from the budget. |
The objective
An objective is a table. hexis/flip/objectives has two, and a third is written the same way.
| Field | Meaning |
|---|---|
name, label, unit | The script's name for its summary, the first HUD row's label, and what a trade row calls a goal point ("XP"), or nil for coins alone. |
progress(recipe, npc, mayor) | Goal points one craft pays. Nil means the coins the route earns. |
rates() | Points a second a middle layer must earn to be crafted rather than bought, or nil. |
plan(routes, options) | The plan and its hours from hexis/flip/planner, given the engine's options. |
start(saved_points) | Read where the run begins; return a reason to stop when there is nothing to do. |
goal(context), advance(points), done() | Points still needed, points made, whether the goal is reached. |
observe(crafts) | A look between passes: a line to log, and a record for diagnostics. |
made(), rows(state) | Progress for the summary line, and the first rows of the HUD. |
local objective = require("hexis/flip/objectives").carpentry({target_level = 50})
Capabilities
The engine needs chat.command, checkpoint, diagnostics.write, events.chat.filtered,
gui.interact, gui.read, http.read, inventory, profit, safety.report and
world.entities.read. Put them in requestedCapabilities; a library the bundle has not
declared for refuses to load and says which capability is missing.
The libraries under the engine
| Require path | Owns |
|---|---|
hexis/flip/plan, hexis/flip/planner | Routes from recipes and prices; the plan inside goal, time, loss and market limits. |
hexis/flip/run, hexis/flip/orders, hexis/flip/upkeep, hexis/flip/book | One pass; orders matched to jobs; every buy order looked after; the account's order slots. |
hexis/flip/crafter, hexis/flip/stock, hexis/flip/listings | Crafting a load and selling it; stock already held; auction listings. |
hexis/flip/account, hexis/flip/ledger | Profit against the start and the loss stop; coins committed and stock at cost. |
hexis/flip/recovery, hexis/flip/journal, hexis/flip/panel | The checkpoint across restarts; the diagnostics record; the HUD. |
A Bazaar Manager or Auction Manager script calls these directly: hexis/flip/upkeep for orders
at the top of the book, hexis/flip/listings for auctions that keep selling.