Choicescript stats resetting to default repeatedly


#1

Choicescript_stats.txt keeps resetting to default variables.

The default name, for example, is John Doe. When you first load the stats window, after picking a new name, say James Kiser, it says the new name at first, but after hitting return, then the stats window again, it says John Doe again. Why do the variables in mygame.js keep resetting to the default?


Stats screen resets the scene
#2

Apparently the problem is that you can’t change variables inside the stats .txt file. As soon as you hit return, any changes made to mygame.js from a *choice in choicescript_stats.txt, are undone, but changes from other .txt files are retained.

Anyone know a way to make changes to mygame.js from the choicesceipt_stats file permanent?


#3

I don’t think its possible. What choice is in your stats screen?


#4

Sadly, I don’t think so. The way it’s coded, I believe Show Stats saves all your variables, including your place in the game, and let’s you view them in a separate scene. After returning it loads those exact same variables - which means any changes made in choicescript_stats.txt aren’t applied.

That’s what I think it looks like when I look at the code.

EDIT: I no is not a sentence. Hehehe.


#5

Not exactly an answer, but a possible substitute maybe?

Perhaps once you hit a choice in the stats screen, it redirects you to another scene where you would then enter your choices/variables, which will then show up in the stats screen. And once you are done, you would then be re-directed back to the stats screen.

Not sure if this can work, but this is what I came up just now. Anyone think it might be able to work?


#6

@Random The main problem with that is that the game would then need to remember when you hit the stats button so it could return you to the exact place. I don’t think there’s a way of tracking when you hit the stats button. Would the stats screen return you to the redirected screen and stick you in an endless loop? There’s work arounds but not very easy and definitely not for a long game. Someone else might know a way though.


#7

I’ll try dropping all the code into another scene file that goes from stats, but I doubt it’ll remember the original spot.


#8

–and that ends in a 404 or the same revert-to-default. There goes making the pocket plane accessible from stats. It’ll have to be used at scene transitions only.


#9

It’s not possible without editing the interpreter code, and even that’s difficult - I’ve tried.
It’s designed like that deliberatly as changing things in a stat screen can cause a lot of issues, as they’re not treated quite like how normal scenes are.