so I have a value that constantly changes, but I’d like to display it so the reader can reference the vale at any time during the stat sheet. I want to make another value that is a copy of that value but only updates to the current value at certain points, and use that as kind of a “The last known value for this” type of thing.
*set showtemp 1 (This turns on the stat showing up in the stat sheet)
*set copyvalue ${value}
and in the sheet we have
*if showtemp = 1
value: ${copyvalue}
this way “value” is constantly changing but you only see “copyvalue” which will update periodically.
You only need the $ in front of the value reference in curly brackets when you want to print it and you only want to put the variable name inside curly brackets if it’s a reference to another variable.
If you intend to set ‘copyvalue’ to the variable referenced in ‘value’, try something like:
*set copyvalue {value}
If you’re setting variables on the stats sheet though, you need to be aware that they get reverted back to the previous value when you return from that page.
That only applies to *temp variables that get created in the choicescript_stats.txt file. If you make the variable in the startup.txt file, it won’t get reset when opening the stat screen and can be displayed directly.
I’ll try to show an example using checkpoints which is spread across your story, during which when the story enters the CP, the visible stats get updated.
I’m still not sure why they’d need the second variable. They can just display var directly by writing it as ${var} on the stats screen. Any change made to it will reflect on the stats screen.
I guess that makes more sense, but I don’t see why the variable needs to update constantly if the player only sees information from it at a certain point. Why not just update the variable only when the display is meant to change?
I still don’t understand exactly how this requires a second variable but I guess you’re seeing something I’m missing so I’ll just let you handle it haha.
Um, that’s not what I meant. If you change a variable in choicescript_stats.txt, that change is lost when you exit the stats page and return to the game.
You can create a subroutine to call when you want to update stats or just update them inline whenever you feel like it but, as I understand it, if you call that subroutine from the stats screen or update the variable from within the stats screen, the changes you made to that variable are lost.
You can change variables in the stats screen, and as long as it’s not a temp, changes are preserved. However, changes don’t display immediately unless you reload the scene.