multi board

This commit is contained in:
2026-06-13 01:25:58 -05:00
parent e5c6affc41
commit 73c8a9bd3e
13 changed files with 456 additions and 445 deletions
+88 -86
View File
@@ -2,6 +2,94 @@
name = "Kiln Demo"
start = "start"
# Named Rhai scripts shared across all boards in this world.
# Objects reference a script by name via `script_name`.
[scripts]
greeter = """
fn init() {
log(`hello from object — player at ${Board.player_x}, ${Board.player_y}`);
set_tile(2); // change my glyph to ☻ — proves the write path
say("Hello there,\\ntraveller!");
}
fn tick(dt) {
//log(`x: ${Me.x} ${Board.player_x} y: ${Me.y} ${Board.player_y} q: ${Queue.length()}`);
if Board.player_x == Me.x && Board.player_y == Me.y && Queue.length() == 0 {
say("Hey! Get offa me!");
delay(5.0);
}
}
"""
mover = """
// move() costs 250 ms, so the object steps ~4 cells/sec no matter how often
// tick() runs. Queue.length() avoids piling up moves; blocked() avoids walking
// into a wall (or another object's already-queued move this tick).
fn tick(dt) {
if Queue.length() == 0 {
move(East);
}
}
// Fires when something steps into this object; id is the bumper's object id,
// or -1 for the player.
fn bump(id) {
log(`mover bumped by ${id}`);
say("Ow!");
}
"""
muffin = """
fn bump(id) {
scroll([
"You find a small muffin on the ground, your favorite kind.",
"It smells of cinnamon and warm mornings.",
["eat", "Pick up the muffin and eat it."],
["ignore", "This is obviously a trap ignore it."]
]);
}
fn eat() {
log("You ate the muffin. Delicious.");
say("Mmm!");
}
fn ignore() {
log("You walk away from the muffin. Wise.");
say("Suspicious...");
}
"""
noticeboard = """
fn bump(id) {
scroll([
" TOWN NOTICE BOARD",
" ",
"ROAD CLOSURE The eastern road through Miller's Crossing remains closed",
"following flood damage to the main bridge. Repairs are underway but travellers",
"should expect delays of at least three weeks. The north fork via Ashwell is",
"passable, though it adds half a day to the journey.",
" ",
"LOST ANIMAL — One grey mule, answers to the name Pepper. Last seen grazing",
"near the old mill on the morning of the 14th. The animal has a notched left",
"ear and wears a blue rope halter. Any information to the innkeeper; a reward",
"of two silver pieces is offered for her safe return.",
" ",
"POSITION AVAILABLE — Captain Aldric of the town garrison seeks an experienced",
"wilderness guide for an expedition into the Darkwood. Duration: ten to fourteen",
"days. Pay is good and provisions will be supplied. Candidates must present",
"themselves at the barracks before the evening bell. Some risk is involved and",
"the captain asks that only those in sound health and good standing apply.",
" ",
"HARVEST FESTIVAL — The annual Harvest Festival will be held on the last",
"Saturday of the month. The market square will be closed to carts from dawn.",
"Stall permits must be obtained from the clerk's office no later than Thursday.",
"There will be music, a pie competition, and the traditional lantern parade at",
"dusk. All residents are warmly encouraged to attend.",
" ",
" Posted by order of the Town Council.",
" Unauthorised notices will be removed.",
]);
}
"""
[boards.start.map]
name = "Starting Room"
width = 60
@@ -124,89 +212,3 @@ bg = "#000000"
solid = true
name = "noticeboard"
script_name = "noticeboard"
[boards.start.scripts]
greeter = """
fn init() {
log(`hello from object — player at ${Board.player_x}, ${Board.player_y}`);
set_tile(2); // change my glyph to ☻ — proves the write path
say("Hello there,\\ntraveller!");
}
fn tick(dt) {
//log(`x: ${Me.x} ${Board.player_x} y: ${Me.y} ${Board.player_y} q: ${Queue.length()}`);
if Board.player_x == Me.x && Board.player_y == Me.y && Queue.length() == 0 {
say("Hey! Get offa me!");
delay(5.0);
}
}
"""
mover = """
// move() costs 250 ms, so the object steps ~4 cells/sec no matter how often
// tick() runs. Queue.length() avoids piling up moves; blocked() avoids walking
// into a wall (or another object's already-queued move this tick).
fn tick(dt) {
if Queue.length() == 0 {
move(East);
}
}
// Fires when something steps into this object; id is the bumper's object id,
// or -1 for the player.
fn bump(id) {
log(`mover bumped by ${id}`);
say("Ow!");
}
"""
muffin = """
fn bump(id) {
scroll([
"You find a small muffin on the ground, your favorite kind.",
"It smells of cinnamon and warm mornings.",
["eat", "Pick up the muffin and eat it."],
["ignore", "This is obviously a trap ignore it."]
]);
}
fn eat() {
log("You ate the muffin. Delicious.");
say("Mmm!");
}
fn ignore() {
log("You walk away from the muffin. Wise.");
say("Suspicious...");
}
"""
noticeboard = """
fn bump(id) {
scroll([
" TOWN NOTICE BOARD",
" ",
"ROAD CLOSURE The eastern road through Miller's Crossing remains closed",
"following flood damage to the main bridge. Repairs are underway but travellers",
"should expect delays of at least three weeks. The north fork via Ashwell is",
"passable, though it adds half a day to the journey.",
" ",
"LOST ANIMAL — One grey mule, answers to the name Pepper. Last seen grazing",
"near the old mill on the morning of the 14th. The animal has a notched left",
"ear and wears a blue rope halter. Any information to the innkeeper; a reward",
"of two silver pieces is offered for her safe return.",
" ",
"POSITION AVAILABLE — Captain Aldric of the town garrison seeks an experienced",
"wilderness guide for an expedition into the Darkwood. Duration: ten to fourteen",
"days. Pay is good and provisions will be supplied. Candidates must present",
"themselves at the barracks before the evening bell. Some risk is involved and",
"the captain asks that only those in sound health and good standing apply.",
" ",
"HARVEST FESTIVAL — The annual Harvest Festival will be held on the last",
"Saturday of the month. The market square will be closed to carts from dawn.",
"Stall permits must be obtained from the clerk's office no later than Thursday.",
"There will be music, a pie competition, and the traditional lantern parade at",
"dusk. All residents are warmly encouraged to attend.",
" ",
" Posted by order of the Town Council.",
" Unauthorised notices will be removed.",
]);
}
"""