inkle / inkle/ink

Variable not found

Open
#463 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.9k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm getting the following error after loading the story state json from a previous save, and selecting a choice:

` Variable not found: 'characterId'. Using default value of 0 (false). This can happen with temporary variables if the declaration hasn't yet been hit.`

The relevant ink section is:

```
= show_item_action_with_single_target(characterId, itemId, actionId, actionName, targetCharacterId)
+ [{format_item_option(characterId, itemId, actionId, format_choice_nodes_with_target(actionName, targetCharacterId))}]
-> apply_item_action_to_single_target(characterId, itemId, actionId, targetCharacterId, "") ->
->->

```

characterId is a temporary variable from an earlier chunk of ink, and was passed in. So I don't think it was the case that the "declaration hasn't yet been hit". The json value for the key "variablesState" is empty, and that seems to be the issue. I would've expected local variables from the callstack to be saved when we call state.ToJson()?

When we save out the json state, we empty out the "visitCounts" and "turnIndices" values, as we do not use the related features, and to keep the save state small. Other than that, there are no modifications. But could those changes to the json have caused the issue?

Would appreciate any help!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.