Skip to main content

Observe, act, await

Most Hexis scripts repeat one simple pattern:

  1. Observe current evidence without taking control.
  2. Act by giving Hexis one bounded goal.
  3. Await the action's terminal result before deciding what comes next.

Observe

Observations return immutable Lua tables. Examples include:

  • hexis.gui.snapshot({})
  • hexis.world.crosshair.observe({})
  • hexis.world.blocks.find(request)
  • hexis.world.entities.find(request)
  • hexis.routes.seeds(request)

Evidence can become stale. Keep the generation, revision, position, or entity reference returned by the observation and submit it only to the action that expects it.

Act

Actions return immediately with an opaque handle:

local handle = hexis.navigate.to({
destination = {x = 12, y = 70, z = -8},
})

An action acquires its required movement, camera, attack/use, hotbar, or screen resources atomically. If another action owns one, the result can be busy.

Await

hexis.await suspends Lua without blocking the Minecraft client:

local result = hexis.await(handle, {timeout = 60})

Use hexis.cancel(handle) when a competing event makes the goal irrelevant. Use hexis.select to wait for the first action or subscription from a bounded list.

Every run has one Lua owner lane. When the run stops, Hexis cancels owned work, releases controls, clears subscriptions, and removes run-owned presentation.