inkle / inkle/ink

How to gather after a divert?

Open
#682 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.9k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

### In Ink, how can I gather after a divert?

I am writing a quiz that is comprised of the following two ink files.

The problem is that I cannot work out how to get Ink to allow me to _choose another round_ after completing the first one.

**quiz-main.ink**
```
INCLUDE quiz-rounds.ink

Welcome to the quiz!
-> ChooseRound

=== ChooseRound ===
Please choose a round!
* Round 1
-> Round1
* Round 2
-> Round2
* Round 3
-> Round3

- Bye now. // The ink never flows here :(
-> END
```

**quiz-rounds.ink**
```
=== Round1===
Welcome to Round 1. Which do you prefer: Puppies or Kittens?
* Puppies
~correct()
-> Won
* Kittens
-> Lost

=== function correct() ===
{~Correct|Well done|Go you}!

=== Won ===
Well done, you completed this round!
-> ChooseRound // Ink cannot find this knot :(
// And if I remove the divert instead, it complains about the loose end

=== Lost ===
Wrong, try again next time!
-> ChooseRound // Ink cannot find this knot :(
// And if I remove the divert instead, it complains about the loose end
```

Of course the problem is that in quiz-rounds.ink, Ink does not know what `ChooseRound` refers to. I tried including quiz-main.ink into quiz-rounds.ink, but that of course leads to a circular dependency, which Ink does not like either.

Separating content across files seems like a pretty standard thing to want to do, so how can this be solved, please?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.