Deterministic dialogue scripting, validation and replay saves for MoonBit
story "harbor" "归航"
var accepted = false
:: start
line guide "愿意帮灯塔送一份灯芯吗?"
choice accept "接下委托" -> quest if !accepted
choice leave "离开" -> finish
:: quest
set accepted = true
emit "quest.accepted" "lighthouse"
line guide "请在涨潮前送到。"
jump start
:: finish
end "departed"moon test --target js --deny-warn
npm run build
npm test
npm run demomoon add forey217/moonstory@0.1.1node scripts/cli.mjs check examples/harbor.mstory
node scripts/cli.mjs play examples/harbor.mstory --out progress.json
node scripts/cli.mjs run examples/training.mstory --actions examples/training-pass.actions.json
node scripts/cli.mjs graph examples/harbor.mstorypub(all) suberror StoryError {
Syntax(Int, Int, String)
Type(Int, String)
Runtime(String, String)
Limit(String)
Save(String)
} derive(Debug)pub struct Session {
// private fields
}pub struct Story {
id : String
title : String
// private fields
}fn run_json(request : String) -> StringInstall
Download zipDeterministic dialogue scripting, validation and replay saves for MoonBit