y-lohse / inkjs

A javascript port of inkle's ink scripting language.
http://www.inklestudios.com/ink/
MIT License
507 stars 104 forks source link

Choice tags are not loaded from state #1070

Closed vasily-polonsky closed 2 months ago

vasily-polonsky commented 4 months ago

First of all, I would like to thank you for this amazing library.

Describe the bug

I have choices with tags, when I save state to json and then later I load state the tags for the choices are gone.

To Reproduce

const storyComplied = new inkjs.Compiler(`* #choice: A [A text]
 * #choice: B [B text]
-> END
`).Compile()
const storyJson = storyComplied.ToJson() as string
const story = new inkjs.Story(storyJson)
story.Continue()
// at this point choices have tags
const state = story.state.ToJson()
const storyLoaded = story.state.LoadJson(state);
// at this point choices dont have tags

https://codesandbox.io/p/sandbox/inkjs-forked-fzg8jf?file=%2Fstory.js

Expected behavior

Choice tags are present after LoadJson

Environment

Additional context

maybe there is a workaround, go prev step, go next, or smt else? Havent figured out how it can be fixed

smwhr commented 3 months ago

This is a fix in ink 1.2.0 and will be adressed as part of the 2.3.0 update, stay tuned !

vasily-polonsky commented 2 months ago

@smwhr Thanks for the fix!