Skip to content

Structure & branching

Branching in Patter comes from a handful of building blocks, and Patterpad shapes them without ever asking you to wire up a flow chart. You change the structure through the action menu; the details on each piece live in the inspector.

Every bubble and group has a quiet button at its top-right, and right-clicking anywhere on it opens the same menu. It holds the structural moves:

  • Follow with ▸: add something after this piece, a Snippet, a Branch, a Choice, or a Sequence in one of its three ready-made shapes (Once each, Cycle, or Shuffle).
  • Wrap in ▸: wrap this piece (or several you’ve selected) in a Branch, a Choice, or a Sequence (Once each, Cycle, or Shuffle).
  • Add option: on a choice (the same as the inline ”+ option” control).
  • Ungroup: undo a group, so its contents move up a level.
  • Split here / Join with previous / Join with next: for snippets, shown only when they make sense.
  • Delete: remove the piece (with a quick confirm unless it’s already empty).

All of it is undoable.

A choice offers the player options. Each option holds:

  • a prompt: the line the player reads, handed to your game exactly as you wrote it;
  • optional content: anything from a single line to a whole branch of its own, played when the option is taken;
  • a few per-option flags (below).

Edit all of a choice’s options together in one inspector panel: prompt, condition, and flags side by side, with reorder, delete, and add.

A choice branches into options, each with its own content, then rejoins at a gather and carries on. Separately: a jump leaves for another scene or block and does not return; a call runs a shared piece of story and then returns to where it left off. A choice branches, then rejoins Choice option A content option B content option C content Gather rejoin here carry on Two ways a snippet diverts ↪ jump leaves for another scene or block, and never comes back ⤳ call runs a shared piece of story, then returns to carry on here
FlagMeaning
StickyRepeatable. Left off (the default), an option is once-only: once the player takes it, it’s gone from the choice.
FallbackTaken automatically the moment it’s the last option standing. One per choice at most, and its prompt is never shown.
SecretCompletely hidden from your game while its condition is unmet, so it can’t leak through the choice or a saved game.

An option is available only when its condition is met. Options carry conditions just like snippets do (a required item, a story flag, a visit count), and that condition is what decides whether the player can take it. By default an option whose condition fails is still shown, not removed: your game receives it flagged as unavailable, along with the reason, and decides how to present it (dimmed, locked, struck through, or hidden, that part is up to your UI). It lets you show “the path you couldn’t take.” Reach for Secret only when an option must stay invisible until it’s unlocked.

Any group has a selector (set in the inspector) that decides which of the things inside it play:

  • Run (the default): play everything eligible, in order.
  • Branch: play only the first eligible item. This is your if / else-if / else, just conditions on an ordered list.
  • Sequence: a picker with a memory and two dials:
    • Order: In order or Shuffle (shuffle never repeats a line right after itself, and works through them all before reshuffling);
    • Exhaust: Play once, Repeat, or Stick on last.
  • Choice: offer everything inside as options and wait for the player.

Those two Sequence dials cover the everyday patterns: “say each line once”, “cycle forever”, “random with no instant repeat”, “stop on the last line”. You can also share a Sequence’s memory (an inspector toggle) so two characters never draw the same shuffled line.

The action menu’s Once each, Cycle, and Shuffle aren’t separate things. They’re all the same Sequence, pre-set for the three most common setups:

PresetOrderExhaust
Once eachIn orderPlay once
CycleIn orderRepeat
ShuffleShuffleRepeat

Drop one in, then nudge the Order and Exhaust dials in the inspector to reach any combination you like. The preset is just a starting point.

A snippet can end with a jump to a scene, a block, or END. Open the jump row in the inspector and type to find any scene or block in the project (plus END). Once it’s set, a small jump / call toggle sits beside it, so you choose how it behaves:

  • ↪ jump: head there and don’t come back (the default);
  • ⤳ call: head there, and when it finishes, come back and carry on where you left off. Handy for a bit of story you want to reuse from several places (a shared aside, a recurring bit of business), without copying it.

The chip on the page shows the mode too, so you can tell a one-way from a returning at a glance. Renaming a scene or block never breaks a jump that points at it. A snippet that’s just a jump, with no lines of its own, is a neat way to route the story around. (⌘/Ctrl-click a jump chip to follow it to its target.)

Wherever a snippet or group has a condition, the script shows it as a quiet if … tag, and you edit it visually in the inspector. See Conditions, effects & data.

The right pane (⌘2) stacks up everything around your cursor, innermost first: the line, text, or game event, its snippet, any groups around it, and the block and scene. Click a level’s header to jump to it. The title bar shows the <scene>.<block> address (click to copy), and a line shows its #id (also copyable, so you can hand it to a developer for translation or audio). The full tour of the inspector’s editors is on the next page.

MIT-licensed open source · Made by · patterkit.com