inkcpp_py
Python bindings for InkCPP https://github.com/JBenda/inkcpp
Converts string into hash used inside inkcpp as representation.
Allows reading and editing inkcpp lists. !Only valid until next choose ore getline a runner referncing the corresponding global
A list flag containing the name of the flag and the corresponding list
How runs of whitespace inside a line are treated
__init__(self: inkcpp_py.WhitespaceMode, value: typing.SupportsInt | typing.SupportsIndex) -> None
A Value of a Ink Variable
__init__(*args, **kwargs) Overloaded function.
__init__(self: inkcpp_py.Value, value: bool) -> None
__init__(self: inkcpp_py.Value, value: typing.SupportsInt | typing.SupportsIndex, type: inkcpp_py.Value.Type) -> None
Used to explicit set a Uint32 value. Type must be inkcpp_py.Value.Type.Uint32!
__init__(self: inkcpp_py.Value, value: typing.SupportsInt | typing.SupportsIndex) -> None
__init__(self: inkcpp_py.Value, value: typing.SupportsFloat | typing.SupportsIndex) -> None
__init__(self: inkcpp_py.Value, value: inkcpp_py.IList) -> None
__init__(self: inkcpp_py.Value, value: str) -> None
If it contains a inkcpp_py.Value.Type.List, return it. Else throws AttributeError.
If value contains a inkcpp_py.Value.Type.Int32 or inkcpp_py.Value.Type.Uint32 return the int value. Else throws AttributeError
If value contains a inkcpp_py.Value.Type.Bool, return it. Else throws a AttributeError.
If value contains a inkcpp_py.Value.Type.String, return it. Else throws an AttributeError.
If you want convert it to a string use: str(value).
If value contains a inkcpp_py.Value.Type.Float, return it. Else throws an AttributeError.
__init__(self: inkcpp_py.Value.Type, value: typing.SupportsInt | typing.SupportsIndex) -> None
Globals and all assoziatet runner stored for later restoration
Converts a story.json file to a story.bin file used by inkcpp
Global variable store. Use globals[var_name] to read/write them.
Runtime logic for a story.
Creates a snapshot from the current state for later usage.
This snapshot will also contain the global state. To reload:
>>> snapshot = old_runner.create_snapshot()
>>> story = Story.from_file("story.bin")
>>> runner = story.new_runner_from_snapshot(snapshot)
Get knot/stitch tag stored at index.
Get global tag stored at index.
Get current choice at index.
iter(inkcpp_py.Runner) returns a iterator over all current choices.
Set the seed for the PRNG used by this runner. At creation the runner is seeded with the current time.
Set how runs of whitespace inside a line are treated.
Affects all text produced after this call: lines, variables, choice text and tags, so set it before reading the first line.
>>> runner.set_whitespace_mode(inkcpp_py.WhitespaceMode.KeepRuns)
Bind function with void result
Ceates a new runner.
Arguments:
- globals: pass a global to use, else use a new inetrnal one.
Returns:
inkcpp_py.Runner: a newly created runner, initelized at start of story
Loads a global store from a snapshot.
Returns:
inkcpp_py.Globals: a new global store with the same state then stored in the snapshot.
Reconstructs a runner from a snapshot.
Arguments:
- snapshot: snapshot to load runner from.
- globals: store used by this runner, else load the store from the file and use it. (created with inkcpp_py.Story.new_runner_from_snapshot)
- runner_id: if multiple runners are stored in the snapshot, id of runner to reconstruct. (ids start at 0 and are dense)
Returns:
inkcpp_py.Runner: at same state as before