StoryState class

All story state information is included in the StoryState class, including global variables, read counts, the pointer to the current point in the story, the call stack (for tunnels, functions, etc), and a few other smaller bits and pieces. You can save the current state using the json serialisation functions ToJson and LoadJson.

Constructors

StoryState(Story story)

Properties

aliveFlowNames List<String>
no setter
callStack CallStack
no setter
callstackDepth int
no setter
canContinue bool
no setter
currentChoices List<Choice>
no setter
currentErrors List<String>?
no setter
currentFlowIsDefaultFlow bool
no setter
currentFlowName String
no setter
currentPathString String?
String representation of the location where the story currently is.
no setter
currentPointer ↔ Pointer
getter/setter pair
currentTags List<String>
no setter
currentText String?
no setter
currentTurnIndex int
no setter
currentWarnings List<String>?
no setter
didSafeExit bool
getter/setter pair
divertedPointer ↔ Pointer
getter/setter pair
evaluationStack List<RuntimeObject>
no setter
generatedChoices List<Choice>
no setter
hasError bool
no setter
hashCode int
The hash code for this object.
no setterinherited
hasWarning bool
no setter
inExpressionEvaluation bool
getter/setter pair
inStringEvaluation bool
no setter
onDidLoadState Function?
Callback for when a state is loaded
getter/setter pair
outputStream List<RuntimeObject>
no setter
outputStreamContainsContent bool
no setter
outputStreamEndsInNewline bool
no setter
previousPointer ↔ Pointer
getter/setter pair
previousRandom int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
story Story
getter/setter pair
storySeed int
getter/setter pair
variablesState VariablesState
no setter

Methods

addError(String message, bool isWarning) → void
applyAnyPatch() → void
applyCountChanges(Container container, int newCount, {required bool isVisit}) → void
cleanOutputWhitespace(String str) String
completeFunctionEvaluationFromGame() → dynamic
CompleteFunctionEvaluationFromGame() → dynamic
copyAndStartPatching() StoryState
Warning: Any Runtime.Object content referenced within the StoryState will be re-referenced rather than cloned. This is generally okay though since Runtime.Objects are treated as immutable after they've been set up. (e.g. we don't edit a Runtime.StringValue after it's been created an added.) I wonder if there's a sensible way to enforce that..??
ForceEnd() → void
Ends the current ink flow, unwrapping the callstack but without affecting any variables. Useful if the ink is (say) in the middle a nested tunnel, and you want it to reset so that you can divert elsewhere using ChoosePathString(). Otherwise, after finishing the content you diverted to, it would continue where it left off. Calling this is equivalent to calling -> END in ink.
goToStart() → void
incrementVisitCountForContainer(Container container) → void
https://github.com/inkle/ink/blob/01898140be43d29baac70c1cb6544bdb10164209/ink-engine-runtime/StoryState.cs#L101 internal void IncrementVisitCountForContainer(Container container)
LoadJson(String json) → void
LoadJsonObj(Map<String, dynamic> json) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outputStreamDirty() → void
PassArgumentsToEvaluationStack(List? arguments) → void
passArgumentsToEvaluationStack(List? arguments) → void
peekEvaluationStack() RuntimeObject
popCallstack([PushPopType? popType]) → void
popEvaluationStack() RuntimeObject
PopEvaluationStack(int numberOfObjects) List<RuntimeObject>
PopFromOutputStream(int count) → void
pushEvaluationStack(RuntimeObject? obj) → void
PushToOutputStream(RuntimeObject obj) → void
pushToOutputStreamIndividual(RuntimeObject obj) → void
recordTurnIndexVisitToContainer(Container container) → void
removeExistingGlue() → void
RemoveFlow_Internal(String? flowName) → void
resetErrors() → void
resetOutput([List<RuntimeObject>? objs]) → void
ResetOutput([List<RuntimeObject>? objs]) → void
restoreAfterPatch() → void
SetChosenPath(Path path, bool incrementingTurnIndex) → void
startFunctionEvaluationFromGame(Container funcContainer, List? arguments) → void
StartFunctionEvaluationFromGame(Container funcContainer, List<Object> arguments) → void
SwitchFlow_Internal(String? flowName) → void
SwitchToDefaultFlow_Internal() → void
ToJson() String
Exports the current state to json format, in order to save the game.
toJson() Map<String, dynamic>
Exports the current state to json format, in order to save the game.
toString() String
A string representation of this object.
inherited
trimNewlinesFromOutputStream() → void
trimWhitespaceFromFunctionEnd() → void
tryExitFunctionEvaluationFromGame() bool
trySplittingHeadTailWhitespace(StringValue single) List<StringValue>?
turnsSinceForContainer(Container container) int
VisitCountAtPathString(String pathString) int
visitCountAtPathString(String pathString) int
Gets the visit/read count of a particular Container at the given path. For a knot or stitch, that path string will be in the form:
visitCountForContainer(Container? container) int
WriteJson(SimpleJsonWriter writer) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

kDefaultFlowName → const String
kInkSaveStateVersion → const int
The current version of the state save file JSON-based format.
kMinCompatibleLoadVersion → const int