Bash.tv → GitHub → itch.io

Branching conversations and narrative choices. Dialogue as data (nodes, speakers, lines, choices), conditions and effects with variables and flags, conditional branches, text interpolation, events that start quests or give items, seen-tracking, a runner for the UI, typewriter text with skip, a validator for broken links, unreachable nodes and dead ends, dialogue box UI for every device, and wri...

Download skill (.zip) Files on GitHub

Dialogue system

Drop-in: assets/dialogue.js (tests: interpolation, hidden conditional choices, effects and events, conditional branch fallback, costs applied, validator finds an orphan node, typewriter and skip).

import { runDialogue, validateDialogue, Typewriter } from "./core/dialogue.js";
const BAKER = {
  start:  { speaker: "Baker", text: "Morning, {name}! Seen any rats?", choices: [
            { text: "I'll handle them.", effects: { set: { ratQuest: true } }, event: "acceptRats", next: "thanks" },
            { text: "Bread, please ({gold} gold)", if: (v) => v.gold >= 5, effects: { add: { gold: -5 } }, next: "bread" },
            { text: "Bye.", next: null } ] },
  thanks: { speaker: "Baker", text: "Bless you.", next: "check" },
  check:  { branch: [{ if: (v) => v.metMayor, next: "mayor" }, { next: null }] },        // invisible branch node
  mayor:  { speaker: "Baker", text: "Tell the mayor I said hi." },
  bread:  { speaker: "Baker", text: "Fresh from the oven." },
};
console.assert(validateDialogue(BAKER).length === 0, validateDialogue(BAKER));       // run in tests
const talk = runDialogue(BAKER, "start", game.vars, { onEvent: (e) => game.events.emit(e) });
// UI: talk.current → { speaker, text, choices: [{ index, text }] };  talk.choose(i) or talk.next();  talk.done

Data and tools

Dialogue box UI

Writing

Short lines, one idea each, the character’s voice. Choices should differ in meaning, not just wording. Show consequences (a reaction, a changed variable). Let players skip text they’ve seen (seen).