StoryCounts.h header

#include <ew/app/branching/StoryCounts.h>

Namespace ew::app::branching

StoryCounts struct

struct ew::app::branching::StoryCounts

What a run has done so far, in the terms a condition can ask about: how often each node and scene has been reached, how many steps have been taken, and how many of those were choices.

This is state of the RUN, not of the story. "The second time you say this" is a property of the reader's path, so it cannot live on the node – which is why the counts travel beside the variables rather than inside them.

It closes ink's READ_COUNT, TURNS, TURNS_SINCE and CHOICE_COUNT, whose everyday use is a knot name read as a number ({ forest_path > 2: You know this path well. }). Ordfoss spells them as names a condition resolves rather than as functions, because the expression engine's functions take numbers and a count is asked about by NAME. The ink spelling is an export mapping, not a second model.

Members

std::map<ew::core::foundation::BranchNodeId, std::size_t> ew::app::branching::StoryCounts::nodeVisits

How many times the reader has arrived at each node, by id. A node absent from the map has not been reached, which reads as zero rather than as an error.

std::map<ew::core::foundation::ContentId, std::size_t> ew::app::branching::StoryCounts::sceneVisits

How many times the reader has entered each scene, by id.

Counted on ENTERING, so a scene walked through twice counts twice and moving between nodes inside one scene does not. That is what makes "the second time you come to the market" work where a per-node count would not.

std::size_t ew::app::branching::StoryCounts::turns = 0

How many nodes the reader has arrived at in this run, counting the one they stand on.

ink's TURNS. Every step, not only the ones the reader chose – a story that continues through five lines has taken five turns.

std::size_t ew::app::branching::StoryCounts::choices = 0

How many of those steps were the reader picking between options.

ink's CHOICE_COUNT, and deliberately not the same as turns: an author asking "how much has this reader actually decided" is asking about agency, and continuing through a line is not a decision.

std::size_t ew::app::branching::StoryCounts::visitsOfNode(ew::core::foundation::BranchNodeId node) const

How many times node has been reached; zero when it never has.

std::size_t ew::app::branching::StoryCounts::visitsOfScene(ew::core::foundation::ContentId scene) const

How many times scene has been entered; zero when it never has.

Functions

QString ew::app::branching::countName(const QString &title)

The name a count is typed as inside an expression: title with each space replaced by an underscore, which is the convention a variable's name already follows (expressionName).