Skip to content

Folding: Then also

A change is a node that alters something, such as Set Variable, Succeed Scheme or Show Announcement. Folding shows a change as one short line under the output that leads to it, instead of as a card of its own. This lesson shows how to fold and unfold, how the lines are ordered, and how to link from a folded output.

  • You see short lines under an output and want to know what they are.
  • A scheme has many small cards and you want it to read shorter.
  • You want a folded node back as a card.
  • You need the lines under an output to run in another order.
  1. The card. The node that owns the output. Its summary line is the first line of text.
  2. The output and its port. True. Its colour is the rail’s colour.
  3. The rail. Comes down from the port and reaches each line with a short arm.
  4. The lines. One line per folded node, in the order the flow runs them. The small bar is the folded node’s own colour.
  5. An output with no lines. False. Its wire starts at the port as usual.
A Check Opinion card with two folded changes under True. The summary line and the two lines are sample text.

A line is the folded node’s first summary line, with a bar on the left in the node’s own colour. Succeed Scheme reads ■ The scheme succeeds and Fail Scheme reads ■ The scheme fails. A Show Announcement reads Announcement “title”, or Announcement (no title). A title longer than 40 characters is cut and ends with …. A node with several changes shows its first change, then + N more.

An output shows its first three lines. If it has more, a row reads + N more. Click it to show them all, and click Show fewer to close it again.

The rail and the port take one colour. A pair of outputs such as True and False, or Success and Failure, gets green and orange. Other outputs take two calm colours in turn.

In the Studio, folding and unfolding change the picture at once, with no movement. A fold is one undo step, named Fold Change. The slides below are this site’s own illustration of the two states.

Cards. Each change is its own card again, with its own wire.

Check Opinion
Conspirator's opinion of Target ≥ 20
True
False
Set Variable
Gold − 50
Set Variable
Fame + 5
  • Check Opinion, output True, goes to Set Variable.
  • Set Variable goes to Set Variable.

Folded. The two changes are now lines under True; the flow runs them top to bottom.

Check Opinion
Conspirator's opinion of Target ≥ 20
True
Gold − 50
Fame + 5
False

    The setting Fold changes decides which of the two you see. The Studio switches between them at once, with no movement; the slide here is only this page showing where each card went.

    38 kinds of node can be shown as a line. Among them are Set Variable, Store Actor, Send Signal, Succeed Scheme, Fail Scheme, Show Announcement, Add Trait, Add Memory, Set Objective, Play Music and Log. Play Sound folds only while its Wait Until Finished is off. Dropping a card and folding a new change work in schemes.

    A node that was folded but now breaks one of these rules is drawn as a card. It carries a note that starts with Shown unfolded: and gives the reason. It is information, never a problem. The Notes counter in the toolbar counts it. The reasons are written as:

    • this kind of node, as it is set, stays a card
    • nothing links here
    • another link leads here
    • the output that leads here also leads elsewhere
    • its outputs lead to different places
    • it follows a Random Branch, whose odds name it
    • it is a step of a Sequencer
    • no card leads here

    Fold a change by dropping its card on an output

    Section titled “Fold a change by dropping its card on an output”

    Drag the card of a change and drop it on an output row of another card, on its port, on the lines under it, or on a wire that leaves that output. While you hover, the target is marked.

    The card becomes the last line under that output, and the flow runs the same way as before. If the output already led somewhere, the flow now goes on after the new line.

    To undo, choose Undo in Unity’s Edit menu (Unity’s undo key works too). The step is named Fold Change.

    The Studio refuses a drop when it would change what runs. It then says Not folded: and the reason. See the table at the end of this lesson.

    Drag a wire from an output into empty space and pick a change node in the search window. With Fold changes and Fold new changes on, the new node is a line under that output. If the output already leads somewhere, the new line comes before those nodes. From the Steps of a Sequencer you get a new step instead, and the Studio says Added as a new step: a wire from a Sequencer’s Steps is a step.

    Another way: select a card and use the Then also section of the Element Inspector. Under each output it has + Add a change (+ Add when the output already has lines, and + Add a step for the Steps of a Sequencer). Hover text of the first: Add a change that happens when the flow leaves through this output. The search lists changes only.

    To undo, choose Undo in Unity’s Edit menu (Unity’s undo key works too). The step is named Add Change, or Add Step.

    Click a line. The Element Inspector shows that node. Above its settings, a path such as Chance ▸ Success ▸ Set Variable names where it sits, with ‹ Back to return to the card. Hover text of ‹ Back: Back to the card that shows this change.

    The Then also section of the card’s inspector lists the same lines, one block per output. Under each block it says Goes to: and the next nodes, or Then the flow ends here. A line’s row has a handle, ≡, and a menu with Open, Unfold, Move Up, Move Down, Duplicate and Delete.

    Press Escape to deselect, or Delete or Backspace to delete the selected line.

    Drag the line out of its card and let go on empty canvas, and the node comes back as a card where you let go.

    Or right-click the line and choose Unfold. The card comes up next to the card that showed it. Both are one undo step, named Unfold.

    If you let go over the same card, or outside the canvas, nothing happens.

    The flow runs the lines under an output from top to bottom, then goes on to what follows them.

    Drag a line up or down among the lines of its output. A mark shows where it will go. Or right-click a line and choose Move Up or Move Down. An entry is grey when there is no place to move to. Press Escape while you drag to let go of the line: nothing moves.

    Moving a line is one undo step, named Reorder Changes.

    Step 1 of 4. Gold − 50 is first, Fame + 5 second.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Gold − 50
    Fame + 5
    False
    Wait
    3 sec
    • Check Opinion, output True, goes to Wait.

    Step 2 of 4. Gold − 50 runs first.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Gold − 50
    Fame + 5
    False
    Wait
    3 sec
    • Check Opinion, output True, goes to Wait.

    Step 3 of 4. Then Fame + 5.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Gold − 50
    Fame + 5
    False
    Wait
    3 sec
    • Check Opinion, output True, goes to Wait.

    Step 4 of 4. After the last line, the flow goes on along the wire.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Gold − 50
    Fame + 5
    False
    Wait
    3 sec
    • Check Opinion, output True, goes to Wait.

    After Move Up. Move Up: Fame + 5 is now above Gold − 50, so Fame + 5 runs first.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Fame + 5
    Gold − 50
    False
    Wait
    3 sec
    • Check Opinion, output True, goes to Wait.

    After Move Up, step 2 of 4. Fame + 5 runs first.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Fame + 5
    Gold − 50
    False
    Wait
    3 sec
    • Check Opinion, output True, goes to Wait.

    After Move Up, step 3 of 4. Then Gold − 50.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Fame + 5
    Gold − 50
    False
    Wait
    3 sec
    • Check Opinion, output True, goes to Wait.

    After Move Up, step 4 of 4. After the last line, the flow goes on along the wire.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Fame + 5
    Gold − 50
    False
    Wait
    3 sec
    • Check Opinion, output True, goes to Wait.

    The outline shows the order the flow takes under True; it is this page’s marker, not something the Studio draws. Move Up is the line menu’s own item; the lines swap in one step in the Studio, and the slide is only an illustration.

    The outline in the figure is this site’s marker for the order. The Studio does not draw this outline. When the pointer is on a wire that goes through lines, the Studio marks those lines.

    Drag a line onto the row, the port or the lines of another output, of the same card or of another one. The line goes there. It carries a note until your next change: Moved here from another output: and the output’s name, and the card’s title when the output belongs to another card.

    If the move is not allowed, the Studio says Not moved: and the reason. A move is one undo step, named Move Change.

    Right-click a line and choose Duplicate, Copy or Delete. Duplicate puts a copy right after the line. It is one undo step, named Duplicate Change. Copy puts the line on the clipboard so you can paste it. See Copy, paste, duplicate and undo. Delete removes the node, and what led to it leads to where it went on. The undo step is named Delete Node.

    A wire that leaves an output with lines starts after the last line, or at the + N more row while lines are hidden, never at the port. Only a wire you are still dragging starts at the port. On a card that shows lines, a wire from an output without lines starts in the output’s colour and fades into the usual one.

    Step 1 of 3. True has two lines and nothing after them.

    Check Opinion
    Conspirator's opinion of Target ≥ 20
    True
    Gold − 50
    Fame + 5
    False

      Step 2 of 3. A wire dragged from True starts at its port. Once it is linked, the link is drawn after the last line.

      Check Opinion
      Conspirator's opinion of Target ≥ 20
      True
      Gold − 50
      Fame + 5
      False
      • A wire from Check Opinion, output True, is being dragged to an empty spot.

      Step 3 of 3. The new node runs after both lines; the wire from False, which has no lines, starts in its colour and fades.

      Check Opinion
      Conspirator's opinion of Target ≥ 20
      True
      Gold − 50
      Fame + 5
      False
      Wait
      3 sec
      Fail Scheme
      Result: Failure (ends when its flows end)
      • Check Opinion, output True, goes to Wait.
      • Check Opinion, output False, goes to Fail Scheme.

      A link from an output with lines starts after the last line, never at the port; only the wire still being dragged starts at the port. The wire from False, which has no lines, starts in its colour and fades into the usual one.

      If the last line ends the flow, nothing can come after it. The Studio then says These changes end the flow, so nothing comes after them: the new wire leaves the port beside them, and they are cards now.

      You can also drop a wire on a line. Drawn from an output, it goes to that node, which now has two ways in and is a card. Drawn back from an input, it comes from that line’s own output. If that node has several outputs, a menu asks which one, with entries Connect from “name”. A wire cannot lead from a change straight back into itself.

      Open the Settings page and switch Fold changes off. Every node is a card with its own wires, and nothing is folded. Your graphs are not changed: switch it on again and the lines come back. A game and a test run are the same either way.

      You come from Add and connect nodes and The Element Inspector. The next lesson is Copy, paste, duplicate and undo. A card carries its lines when you copy it. See also Node groups.

      A problem in a folded node shows on its line. See Problems, notes and validation. To run the scheme and watch it, see Test run: play a scheme in the Studio.

      Setting What it does Default When to change it
      Fold changes Shows folded changes as short lines under their cards, and folds a change card you drop on an output or its wire. Off: every node is a card with its own wires and nothing is folded. Your graphs are not changed, so switching it on again brings the lines back. A game and a test run are the same either way. On Turn it off when you want to see every node as a card.
      Fold new changes While Fold changes is on: a change created by dragging a wire from an output into empty space is shown as a line under that output instead of a card. If the output already leads somewhere, the change comes before those nodes. From a Sequencer’s Steps you get a new step instead. Nodes already in a graph are not touched. On Turn it off when you want every new node to start as a card.

      Both are rows in the Editing section of the Studio’s Settings page. They are kept per user, in the Editor’s preferences.

      I dropped a card on an output and nothing folded. The Studio said why in a notice in its window. Read the reason in the table.

      The lines are cards again. Fold changes is off, or the node stays a card for one of the reasons above.

      My line is not where I dragged it. Dragging a line over its own card changes the order. Only a drop away from the card unfolds it.

      A refusal appears as a notice in the Studio window for a few seconds. The same text goes to the Console, after Intrigues:.

      Message What it means
      Not folded: a node cannot be folded into itself. You dropped a card on its own output.
      Not folded: this kind of node, as it is set, stays a card. The node cannot fold, or not with its settings.
      Not folded: nothing is folded after a Random Branch, whose odds name its nodes. The card is a Random Branch.
      Not folded: this card has no output. The card you dropped on has nothing to fold under.
      Not folded: this card has no such output. The output you dropped on does not exist.
      Not folded: a wire from a Sequencer’s Steps is a step, so nothing is folded there. Every wire from Steps is a step.
      Not folded: it is a line already. The node, or the card you dropped on, is already a line.
      Not folded: its outputs lead to different places. The node’s outputs do not go on together.
      Not folded: the output also leads elsewhere. The output you dropped on goes to more than this node.
      Not folded: another link leads to it. The node has more than one way in.
      Not folded: its wire goes somewhere else than this output. The node’s own wire and the output lead to different places.
      Not folded: it ends the flow, so it can only go where the flow ends. The node has no output, and the output goes on.
      Not folded: nothing comes after a line that ends the flow. The last line under that output ends the flow.
      Not moved: and a reason, ending with a period A line could not go to that output. The reasons are listed below the table.
      Shown unfolded: and a reason A note on a card that was folded. It is counted by Notes, not by Problems.
      Not connected: a change cannot lead straight into itself. You linked a change to itself.
      Not connected: this change ends the flow, so nothing comes after it. You drew a wire from a change that has no output.
      Stop the run to edit. A test run plays this scheme and locks it.

      The reasons after Not moved: are:

      • a change cannot be moved into itself
      • it is not a line
      • it is under this output already
      • this kind of node, as it is set, stays a card
      • nothing is folded after a Random Branch, whose odds name its nodes
      • this card has no output
      • this card has no such output
      • a wire from a Sequencer’s Steps is a step, so nothing is folded there
      • that node is a line itself
      • the flow goes from it back to its card, and that loop would be lost
      • nothing comes after a line that ends the flow
      • it ends the flow, so it can only go where the flow ends
      • another line would have to become a card
      • it could not be a line at that place