summaryrefslogtreecommitdiff
path: root/src/host/script.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-25 21:53:00 -0300
committerGabriel Schneider <[email protected]>2026-09-25 21:54:39 -0300
commit2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702 (patch)
tree32a8bbb55226721834fd5675e7bafc163508dd1e /src/host/script.zig
parent50f4ee716aeafa13118cbcfa0f5cb37f7d3940a4 (diff)
downloadsketchbook-2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702.tar.gz
sketchbook-2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702.zip
sketchbook: what the game's review needed
- input.started: true on the first update of a run, never after a reload, for a sketch to stop what should not resume from saved state. - A console line that errors fails its script. Sketch commands answer unknown, done or failed (abi.Outcome) instead of a bool that hid errors. - addScript also takes the hot-reloadable library, run through the generic host, so scripts can reload a real build. - Sounds that do not load are .none, not an empty clip. - sk_tag reads an enum field's tag name from the web build, for tests.
Diffstat (limited to 'src/host/script.zig')
-rw-r--r--src/host/script.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/host/script.zig b/src/host/script.zig
index 4563a47..ec716e9 100644
--- a/src/host/script.zig
+++ b/src/host/script.zig
@@ -73,7 +73,11 @@ fn step(host: *Host, arena: std.mem.Allocator, command: []const u8, rest: []cons
} else if (eq(u8, command, "type")) {
for (rest) |byte| try host.route(.{ .kind = .text, .time = now.*, .value = byte });
} else if (eq(u8, command, "console")) {
- host.runLine(rest, now.*);
+ // A failing console line fails the script, like a failed expect.
+ host.runLine(rest, now.*) catch |err| {
+ std.debug.print(" console {s}: {t}\n", .{ rest, err });
+ return err;
+ };
} else if (eq(u8, command, "frames")) {
const count = try std.fmt.parseInt(usize, rest, 10);
for (0..count) |_| try advance(host, now);