#!/usr/bin/env -S jennifer run# Start Lantern, the zmachine deck's test game, and play it from a script.# Needs lantern.z5 in the current directory (see README.md).use io;
import"@skiffyard/zmachine/"as zmachine;
# Start a storydef m aszmachine.Machine initzmachine.open("lantern.z5");
def i aszmachine.Info initzmachine.info($m);
io.printf("version %d, release %d, serial %s\n", $i.version, $i.release,
$i.serial);
$m = zmachine.run(zmachine.setScreen($m, 60, 24));
io.printf("%s", zmachine.output($m));
# Playing from a scriptfor (def line in ["take lamp", "north", "drop lamp", "inventory"]) {
$m = zmachine.send($m, $line);
io.printf("%s\n%s", $line, zmachine.output($m));
}
io.printf("status: %s\n", zmachine.upperWindow($m)[0]);