wyOOtdocs

Memory: variables

Hiding choices and forking

Make the story react to what the reader did earlier.

On this page
Already know this?Forks

You now have values that change. There are two ways to make the story react to them. You can hide a choice unless something is true, or you can send the reader somewhere different without asking them.

Hide a choice until something is true#

Under a choice, click Only show this if…. It appears once your story has at least one value. Pick a value, pick how to compare it, and give it something to compare with.

A choice with the check 'bag does not contain brass key' and the effect 'bag, Add an item: brass key'.
A choice with the check 'bag does not contain brass key' and the effect 'bag, Add an item: brass key'.

The comparisons depend on the type:

  • Yes/no values: is yes, is no.
  • Numbers: is at least, is at most, is exactly, is more than, is less than.

Add more checks with another check. A choice with several checks shows only when every one of them is true. If a check fails, the reader never sees that choice at all, and the letters of the others close up.

Fix the fountain#

The fountain from the last page let you toss coins you did not have. Give "Toss in a coin" the check "coins is at least 1". Now the choice disappears when you run out.

Try it

The fountain

A stone fountain with clear water. Coins shine on the bottom.
  • coins3
Same fountain, with one check on the toss choice. Toss until you are out of coins, and the choice goes away.

Take care that a reader can never end up with no choices at all. If every choice in a scene can be hidden at the same time, a reader could get stuck there. Keep at least one choice that always shows.

Forks#

A fork is a step the reader never sees. When a reader arrives at one, the story checks its rules from top to bottom, takes the first rule that is true, and carries on to that scene. The reader just sees the next scene appear.

Add one with Add a fork above the list. It appears in the list like a scene, but it has no text and no choices. It has a title that only you see, some rules, and a default.

A fork titled 'Does the knocking start?' with one rule made of two checks, and an Otherwise.
A fork titled 'Does the knocking start?' with one rule made of two checks, and an Otherwise.
  • Each rule is a list of checks, headed "All of these must be true", followed by "→ send to" and a scene. The checks work exactly like the ones on a choice. Add another rule with Add a rule.
  • Below the rules is Otherwise → send to. This is where the reader goes when no rule is true. It is required, so every fork always leads somewhere.
  • A choice can point at a fork the same way it points at a scene. Pick the fork in the destination dropdown.

Fork or hidden choice?#

Use a hidden choice when you are offering the reader something, and the option should only exist under some conditions. "Unlock the door" only makes sense if you have the key.

Use a fork when the story itself should decide. The reader picked "Try the door", and what happens depends on what they are carrying. The choice is the same either way. Where it leads is not.

Order matters#

A fork stops at the first rule that is true. Put the most specific rule first. If one rule says "coins is at least 1" and another says "coins is at least 10", the first will always win, and the second will never be reached.

Getting "or"#

Checks on a single rule all have to be true. To get "either of these", write two rules that send to the same scene. If either rule is true, the reader goes there.

Common mistakes#

  • Leaving out the Otherwise. Every fork needs one, and the editor flags a fork that does not have it.
  • A fork that leads to another fork that leads back to the first. The editor flags this, because a reader would never reach a scene.
  • Checking a value that nothing ever changes. It will always have its starting value, so the check is always the same.

Next#

You have now seen all the pieces in miniature. The locked door puts a yes/no value, a hidden choice and a fork together in one small story you can play and take apart.