Ink: can I reset the read count of a knot or stitch? What about non-repeatable choices?

Hello again :slight_smile:

TL;DR In Ink, is it possible to globally wipe the read count integers attached to any given knot or stitch while still keeping values for other variables, lists, etc. Can I also reset once-only decisions?

I’m authoring an IF in Ink that depends on multiple playthroughs, otome game-style. So I want do be able to remember some things from past playthroughs (e.g. which routes you’ve completed, how many times you’ve met a certain character or been to a specific location—all as list or variable values.) But in a 2nd or 3rd playthrough, when showing up at a location that is new to this playthrough but visited in a previous one, I don’t want it the read count to start at a non-zero value, since I often test that to determine what text to show etc.

Along the same lines, on that > 1 playthrough I also don’t want it to remember past choices, as this causes those choices to not be shown as options in the list (assuming I did once-only choices:

*   [A choice text] A' post-choice text
*   [B choice text] B' post-choice text
*   [C choice text] C' post-choice text

However, I don’t want to be forced to use sticky choices, a la

+   [choice text] post-choice text
+   etc

because within a given playthrough I generally do want choices, once made, to not be re-selectable.

[EDITED because I managed to not mention I was using Ink…]

2 Likes

To the best of my knowledge there’s no built-in way to reset the choices or knot visit counts. Your options are either to do it manually (i.e. create variables yourself to track whether a specific choice has been selected), or reset the entire story but save certain information somewhere outside of the ink story (e.g. using some custom JavaScript if you’re using the Inky web export, or Unity code if you’re using Unity). The former sounds annoying to do, but can be done entirely in ink, the latter is not too bad but requires a little programming outside of ink.

3 Likes

Additionally to what Avery said, there should be a third approach: you can actually manipulate the internal variables of an Ink story at runtime. For example, the knot count of a story should be inside story._state._visitCounts and it’s just a JavaScript map you can manipulate. (And if you are using C# it’s probably some equivalent thing.)

However, I am not 100% sure if manipulating internal variables has some caveats, so to be sure I would ask on Ink’s Discord.

3 Likes

I re-read your question and there might be an easier solution. You want to remember things from past playthroughs. Can you limit all the things you remember from past playthroughs to VARs? So knot counts, choice counts etc. would be reset between replays and only some global VARs would persist. If so, all you need is _inkStory.variablesState. Grab the variables you are interested in from there, save them to a persistent storage, then on game restart load them from persistent storage and overwrite the corresponding values inside _inkStory.variablesState.

3 Likes

Yes, I think custom JavaScript (or Unity or Unreal or…) code is your best bet here. Save a few particular variables to local storage, restart the game, then restore those variables again.

2 Likes

Thank you all for your responses—I will try them all as needed, maybe starting with Daniel’s suggestion about using _inkStory.variablesState.

I’ll report back with and update when I have it :slight_smile:

David

2 Likes