QML - Create Your Own Adventure

Chapters

You can break up the story in multiple chapters. All you have to do is create a new QML (XML) file. The same rules apply regarding the syntax. You can use the same station IDs you already used in other files, but again they will have to be unique to the document scope. The transition between two chapters will appear seamless (if you don't add a different style).

To link to this second file, you'd use:

<choice station="quest/my_second_chapter:start">
You enter the castle</choice>

Here, "my_second_chapter" is the name of the XML file. It's inside the "quest" folder (or any path of your choice, relative to the HTML file). Following the colon ":" is the name of the station to start with.

You can also think of a chapter as sub-locations of a bigger world, or sub-quest of a bigger adventure.
To clearly seperate two chapters, you can reset all states. This means that all state flags will be set to false, like in the beginning. (If you do this, it is of course important to not link back to the original chapter.)

To reset all states, write:

<station id="myId" states="reset">

The value "persist" is the default for all stations without an explicit states attribute.

Debugging/ Testing

When you write a bigger adventure, it should become necessary to play through different situations to test if all alternatives work as expected. A certain outcome of a situation can depend on a state, or the combination of several states. Since setting states by playing can be tiresome if you already know the story works so far, you may want to jump right into the new part you wrote, and with a certain set of states.

All you have to do to test this new part right away is to create a single station called "debug" (or any other name of your choice) and link to it from the very beginning. This station "debug" then would set a series of states and link to the station you want to start for debugging/ testing purposes.
When you publish the story, you would simply take out the link to "debug" in the first station.

Continue with QML Chapters Part 2: Bottlenecks