ink icon indicating copy to clipboard operation
ink copied to clipboard

Add a method to force a recheck of available choices in a Story

Open AndrewKaninchen opened this issue 4 years ago • 3 comments

Once you get into a choice point, currentChoices are locked even if you set a relevant global variable externally.

e.g.:

*{myVariable} choice1 *choice2

would only return choice2 if you checked it, even if myVariable is global and you set it before checking, but after having the story continue up to the choice point.

In the game I'm currently making, we "solved" this by always saving the last storypath a Story was at before a choice and, in the cases where it matters, going back to it and continuing untill we're back to it. This solves the problem, but it breaks Tunnels, which kinda sucks.

I've also tried solving it with LoadStoryState, but it didn't seem to work as well (tbh I don't really remember why, maybe it just does the same exact thing and we didn't realize at the time the problem were the tunnels).

Anyway, that's all to say, something like a RefreshCurrentChoices that could rerun the check for available choices would be great.

I considered going into the Ink sourcecode and doing it myself, haven't done it just because we're on a short time limit for this project and I didn't want to risk it.

AndrewKaninchen avatar Apr 25 '21 18:04 AndrewKaninchen

So one thing that makes this hard is that while most ink is text-then-choices, in reality choices are gathered up as the ink is processed. So regathering choices is really re-running the entire previous ink block.

one good solution is to put volatile conditionals into the choice text via some kind of markup and handle them entirely on the game side. (So from inks POV the choice is always valid, but the game vetoes choices it considers not applicable)

joningold avatar Apr 25 '21 19:04 joningold

So one thing that makes this hard is that while most ink is text-then-choices, in reality choices are gathered up as the ink is processed. So regathering choices is really re-running the entire previous ink block.

one good solution is to put volatile conditionals into the choice text via some kind of markup and handle them entirely on the game side. (So from inks POV the choice is always valid, but the game vetoes choices it considers not applicable)

Yeah, that would indeed be a better solution. Kind of sad I didn't think of it before.

AndrewKaninchen avatar Apr 25 '21 19:04 AndrewKaninchen

one good solution is to put volatile conditionals into the choice text via some kind of markup and handle them entirely on the game side. (So from inks POV the choice is always valid, but the game vetoes choices it considers not applicable)

Is there a clean way of handling fallback choices using this method? Does ink support some sort of ChooseFallbackChoice() function? Or would you need to implement markup to hide a choice, and then automatically choose it, if no other choice is available?

elliotherriman avatar May 10 '21 12:05 elliotherriman