Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get INCLUDEd variables to be written by state.ToJson #856

Open
lhughes41 opened this issue Jul 28, 2023 · 6 comments
Open

How to get INCLUDEd variables to be written by state.ToJson #856

lhughes41 opened this issue Jul 28, 2023 · 6 comments

Comments

@lhughes41
Copy link

lhughes41 commented Jul 28, 2023

Greetings,
I understand the basic idea of how to write/save a Story state. Namely:
...state.ToJson()

However I just discovered that variable brought into the Story object via an INCLUDE do not seem to get saved! I looked at the json produced to confirm this. Variables coming from the master file that called the INCLUDE do get written. Just not the ones in the INCLUDE. This is extremely unfortunate as we isolated all our variables across multiple Story(ies) in an INCLUDE. Is there some way to signal to 'To.Json' to include all variables? Namely and especially the INCLUDEd ones?

Thanks in advance.
Luke Hughes
lead (Burden of Command)

Copy link
Member

They absolutely do. Includes have no meaning to the compiler; the files are stuck together into one big blob. What you might be seeing is that until a variable changes it isn’t in the save data as we save a diff of the state against the initial state

@lhughes41
Copy link
Author

Thanks for the rapid response Jon. That was my understanding of how INCLUDE worked too. So was surprised.
But perhaps it is the delta aspect as you say.
Let me dig on that basis.

this overall is good news though if plays out way you say. Whew!
Luke

@joningold
Copy link
Member

joningold commented Jul 29, 2023 via email

@lhughes41
Copy link
Author

lhughes41 commented Jul 29, 2023

Jon I believe you. But having too many learned lessons about not testing ...;-).. I tested. And I am happy to confirm you are right. So am closing out.

Impressed with the rapid Jon response team around here ;-)

p.s. minor comment for future. Had to do a lot of workarounds and scripts to rebuild all our independent inks everytime an INCLUDE file changes (because globbed into the main ink files as you say). Any plans for future for such includes not to be globbed in and instead dynamically imported? I come from a Python (and LISP of all things) world where files are imported on the fly and so there is not a lot of recompiling everything when an imported file is changed. More modular IMHO. But like I said I am naive for less interpreted worlds (been many a day since I did C etc).

And here I am harrassing up a kind programmer with yet more improvement suggestions LOL. I get so tired of being on the receiving end of those myself ;-) So apologies.

best,
Luke

@IFcoltransG
Copy link

@lhughes41 Is this issue ready to close?

@lhughes41
Copy link
Author

Yes thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants