Block reference

Computer

The computer block is the runtime anchor of XL Logic. It owns the script, the session state, the discovery result, the synchronized output snapshot, and the server-side GraalPy execution context.

Core block Server-authoritative Partially implemented
Back to block overview

Role

Owns the active script, runtime state, editor lease, recovery draft handling, and endpoint discovery for one local cable segment.

Python access

The computer is not fetched as a normal device. Instead it exposes globals such as computer, computer_api, world, screen, output, devices, and network.

Network rule

One local discovery segment may only contain one computer unless segments are separated by XLAPI blocks.

In game

What right click does.

  • Right click opens the bound computer screen with the current script, output history, and runtime snapshot.
  • Shift-right-click refreshes discovery and prints a debug summary for the local segment.
  • The discovery summary includes script length, network summary, runtime guardrails, cooldown state, editor lock state, boundary hints, linked screens, and discovered endpoints.
  • If the segment contains multiple computers, discovery reports the conflict and tells you to split segments with XLAPI blocks.
Python globals

The computer block defines the main scripting surface.

  • computer: dictionary with name, position, and endpoint_count.
  • computer_api: helper object with available(), name(), position(), endpoint_count(), network_summary(), list_devices(), and get_device(name).
  • world: world-time and weather API.
  • screen and output: write structured output to the computer and linked screens.
  • devices and network: live registry of discovered device endpoints on the local segment and across allowed bridges.
  • endpoints, peripherals, endpoint_names, and device_names: low-level endpoint metadata and stable lookup keys.
Helpers

Convenience functions you get automatically.

  • list_endpoints() and get_endpoint(name) access raw endpoint bindings.
  • list_devices(), get_device(name), device(name), require_device(name), find_device(type), list_device_names(type=None), and devices_by_type(type) work on the higher-level device registry.
  • say(text), show(title, fields), show_kv(...), show_table(...), and show_plan_card(...) write structured output.
  • pause(ticks), repeat(step, every_ticks), sleep_ticks(ticks), and run_loop(step, delay_ticks) are the cooperative timing helpers.