Skip to content

Volt

Need a recipe? Use JEI in game. Need a starting route? Start here

Programs run on the Terminal under Hard Hoof OS.

Volt is Hard Hoof's in-game scripting language. Source compiles once to bytecode (Proto); a VM runs a budget of instructions per tick and can suspend on waits. Everything on /rom — shell, apps, libraries — is readable Volt you can copy and change.

Run a program

Method Action
Shell run /home/hi.volt or run hi if ./hi.volt exists
Path as command Programs in /bin or /rom/bin run by name (greet → /bin/greet.volt)
Editor Open .volt, Ctrl+S save, Ctrl+R save-and-run (opens a Terminal)
REPL volt — enter lines; exit leaves; definitions persist for the session
Boot /startup.volt on flash is launched after init every power-on
API proc.run(path, args) wait; proc.spawn in this TTY; proc.launch as its own app

First-boot flash seeds /home/hello.volt. Guide walkthrough: man guide or Help app.

let name = input("Your name? ")
print("Hello, " + name + "!")

Values and truth

Kind Examples
Null / bool null true false
Number 42 3.5 0xFF
Text "text" or 'text'
List [1, 2, 3]
Map {name: "volt", n: 2}
Function fn(x) { return x * 2 }

Falsey: false, null, 0, "". Everything else is true.

Syntax sketch

let speed = 4
speed += 1

if x > 3 { print("big") } else if x > 1 { print("mid") } else { }

while x < 10 { x += 1 }
for i in range(5) { }
for item in list { }
for key, value in map { }
break  continue

fn add(a, b) { return a + b }

try { risky() } catch e { print(e) }
throw "something went wrong"

Operators: + - * / %, comparisons, and/or/not (also && || !). "volt" + 1 joins text; "-" * 10 repeats.

Collections and text (methods)

Lists Maps Text
push pop insert remove keys values has remove get upper lower trim split lines
sort reverse slice join m.name / m["name"] find sub replace contains
contains index copy len missing key → null starts ends pad num len

Built-ins (core)

print write input sleep time str num int type len range list abs floor ceil round min max clamp sqrt random math.* keys values has chr ord error assert eval import exit args

input(prompt, {text, cursor, complete, live}) supports completion; easiest path is import("complete").read(finder) — used by the shell.

Libraries

Top-level let / fn in a .volt file are what import("name") returns (_-prefixed stay private). Search order: /rom/lib, then /lib, then the current folder.

Shipped ROM libs: shell, ui, complete, storage, craft, accounts, rpc, weather and web (web is new in the development build: it finds an Internet Dish and fetches pages; see The web & remote access).

System calls (overview)

Full list: man api → /rom/doc/api.txt. Modules:

Module Role
fs Files, cwd, drives, labels
proc run / spawn / launch / wait / kill / list
win / draw / event / timer Desktop windows
term Attached terminal I/O
sys Power, CPU, clock, reboot, apps, bus ABI
clip Clipboard
dev Device bus — controllers, Assembler, steam machines; dev.watch(h) wakes a program when a device changes
net Network cards and frames between computers
remote This computer's Inter-Dimensional Address, pairing and remote channels (development build)
chip Read and burn microcontroller chips
sound Notes on the computer's speaker

Since 0.6.0 sys also reads the world around the computer: sys.weather, sys.radar, sys.lightning, sys.sky, sys.env (air and water) and sys.survey. A program can sleep until a machine changes, and runs the same way every time. While its chunk is unloaded, a computer's calls to unloaded devices fail with offline: <label> is not loaded.

VM limits (enforced): lists/maps ≤ 16,384 items; text ≤ 65,536 chars; 256 call frames; 16,384 stack slots.

CPU and power

The Terminal shares 500,000 Volt steps/second among programs (~25k/tick). Waiting on event.wait, sleep, or input uses no budget. Busy CPU raises watts — see Terminal.

Make it yours

Idea How
Custom command Save /bin/greet.volt; type greet
Desktop app /apps/foo.volt with first line // @app Greeter | app
Auto-start Write /startup.volt on flash
Learn from ROM cp /rom/apps/files.volt /apps/myfiles.volt then edit
Write on your desktop Hard Hoof Studio (development build): live errors from the real compiler, a simulator, and deploy to a computer by its address

Planned (not shipped here)

Higher lore clocks (1–100 MHz tiers), compile-to-JVM, and a Volt-written kernel are Planned in the hardware contract — not current play. Documented only as direction; today's interpreter is what you get.

↑↓ move↵ openesc close