I'm using RenPy 7.3.5
I'm trying to diagnose a stats screen which has been added to the main game menu. Though I've recreated the same problem by adding variables fields to the "About" screen too.
Essentially, I have this code.
Code: Select all
# Part of screens.rpy...
screen navigation():
# [snip]
if not main_menu:
textbutton _("Stats") action ShowMenu("stats")
# [snip]
Code: Select all
default my_var_1 = 0
default my_var_2 = 2
default my_var_3 = 0
screen stats():
tag menu
use game_menu(_("Stats"), scroll="viewport"):
vbox:
label "Value 1: [my_var_1]"
label "Value 2: [my_var_2]"
label "Value 3: [my_var_3]"
label start:
"*** START ****"
"Check the stats page now."
$ my_var_1 += 1
$ my_var_2 += 4
$ my_var_3 += 3
"Okay. Now check the stats page again."
"*** THE END ***"
return
What happens is that the stats screen seems to show cached values of the variables rather than their latest current values. Sometimes on the 2nd check of the values, the values can either be "0, 2, 0" or "1, 6, 3" depend on what has previously been shown. Flipping to another game menu screen (like About or Preferences) and then back to the Stats page refreshes the values and you see the actual current values.
I've tried referencing the values as store.my_var_1, etc - just in case it was a local/global thing with the same results.
I've tried using "text" fields instead of "label". Still no luck.