Allowing variable changes in stats screens?


Does anyone know if it is possible to allow choices made on a stat screen to affect variables in game. I have been playing around with *choice inside a stat screen, and eventually figured out that the changes I was making were not carrying over into my scenes. Anyone know a way around this?


I am not alone! I tried that a bit ago, but it doesn’t seem to be possible. You can make changes to variables in the stats screen, and even test if the changes happened by displaying the changed variables there. The issue is that when you leave that screen, all changes are reverted. Not sure how or why. Theoretically, you can use the *goto_scene while in the stat page, and it will “remember” the variable… except that’s only because it doesn’t think you left the page. Since there isn’t supposed to be a button to get to the stat page when you’re in the stat page, that means you lose the button to return. If you do go back to your stat page and let it leave the page normally to get your button back, any changes to any variables in the game that happened since you entered the stat screen will go away.

Not sure what you’re trying to do. If you’re trying to do something like make a crafting page, you might have to make a separate button for that everywhere where you want someone able to craft. Same with potion-using and such. If it is for a secret, then you might have to put a secret code there instead, and put the thing that activates the secret somewhere else.


Yea imagine my surprise after many late nights getting this to ‘work’ this week and then finding out that the changes I made in my stats screen weren’t saving and were reverting to their previous states…sigh. I think it has to do with choicescript ‘saving’ the page the page (with variable states along with it) so that when you hit next you go back to the same page. I was checking out ui.js because when I was creating my three stat buttons I remembered seeing a line in there about stat screen state = function(callback) {if (callback);}; // Don’t save state in stats screen, issue #70

But when I delete this line and try to return to my scene after leave my stat screen I get a blank screen because the page wasn’t saved so stat screen doesn’t know where to go back to…I guess.