Cloud Variable reset to old value when browser is refreshed. [CLOSED]

id: 751588

category: Help with Scripts

posts: 21

Helmentloo Helmentloo loading
Why is the cloud variable of my game kept getting reset to old values when the game is reloaded by browser reset?

https://scratch.mit.edu/projects/992150436/

Update: The issue has been resolved. With the assistance of MrKingofScratch, we identified that the introduction of the new cloud variable feature more than 12 days ago has altered the behavior of cloud variables. Specifically, cloud variables can no longer retrieve values stored by the last record. Instead, when a project is reloaded, it reverts to the cloud value saved at the last save point. This change impacts the functionality of high score features in Scratch projects, rendering them inoperative.
deck26 deck26 loading
Assuming you're not resetting the cloud variable you may be trying to access the cloud variable too soon after the project starts. The project holds another version of the cloud variable which is used if there is no cloud link or the person running the project does not have Scratcher status.

I would allow at least half a second before asking the project to access the cloud variable and certainly before trying to update it.
Helmentloo Helmentloo loading
Hi deck26, thank you for the help. Unfortunately, I added wait even up to 10 seconds and it is still not working. The project still always use its saved cloud variable value. I continuously read the cloud variable still and can’t access to the cloud’s latest value like forever during first game after browser reload.
deck26 deck26 loading
Are you checking the cloud data log? One variable is certainly being set frequently (check you're not doing that without allowing 0.1 seconds between cloud variable updates, even to different variables) but another cloud variable far less often - I haven't checked to see how many you have.
There's only one and it maxes out at 77 chars. I checked the project and can only find two times that the cloud var is set. So it would have to be issues with the encoding or smth.
Really strange… check out https://scratch.mit.edu/projects/992675590/ where I added a test cloud variable. use left and right arrows to change it. however, when you reload the page, it doesn't save. Are any cloud vars working at the moment?
rename the cloud variable(s)
Strange thing is that when duplicating the tab the cloud var will start a 0 but will update when it gets changed on another tab so ig it just has to be constantly updated? (this would make it so that when there's no players on the cloud var will be reset)
Malicondi Malicondi loading

MrKingofScratch wrote:

Strange thing is that when duplicating the tab the cloud var will start a 0 but will update when it gets changed on another tab so ig it just has to be constantly updated? (this would make it so that when there's no players on the cloud var will be reset)
renaming the cloud variable(s) then saving the project fixes the problem.
Helmentloo Helmentloo loading
Thanks everyone for trying to help! I tried renaming it to “Troubled_Cloud” and the problem is still there.
Helmentloo Helmentloo loading
It looks like it is a bug. It is in this bug report forum: https://scratch.mit.edu/discuss/topic/469469/?page=1
Helmentloo Helmentloo loading
Thanks to MrKingofScratch's help. This issue has been resolved. We identified that the introduction of the new cloud variable feature more than 12 days ago has altered the behavior of cloud variables. Specifically, cloud variables can no longer retrieve values stored by the last record. Instead, when a project is reloaded, it reverts to the cloud value saved at the last save point. This change impacts the functionality of high score features in Scratch projects, rendering them inoperative.
-stxllxr -stxllxr loading

Helmentloo wrote:

Thanks to MrKingofScratch's help. This issue has been resolved. We identified that the introduction of the new cloud variable feature more than 12 days ago has altered the behavior of cloud variables. Specifically, cloud variables can no longer retrieve values stored by the last record. Instead, when a project is reloaded, it reverts to the cloud value saved at the last save point. This change impacts the functionality of high score features in Scratch projects, rendering them inoperative.
Thou is stating false.
(This isn't true, there are various cloud variable projects still working, new and old. Certain projects have issues where their cloud variables aren't saving their updates properly, and can be solved by renaming the variable and saving the project, repeating as necessary.)
Helmentloo Helmentloo loading
@Stxllxr, please show me one project that still can record high score. I would like to find out too.
TLDR: rename it like 3 times
So I tried renaming once and it didn't work. However, I kept renaming it until eventually it worked! Thanks to everyone who suggested renaming, and special thanks to @-stxllxr who pointed out that we should try it multiple times!
Helmentloo Helmentloo loading
@MrKingofScratch

If you have a project that has successfully renamed and work. Please do share it here. I would like to see it.

Thank you.
medians medians loading

-stxllxr wrote:

Helmentloo wrote:

Thanks to MrKingofScratch's help. This issue has been resolved. We identified that the introduction of the new cloud variable feature more than 12 days ago has altered the behavior of cloud variables. Specifically, cloud variables can no longer retrieve values stored by the last record. Instead, when a project is reloaded, it reverts to the cloud value saved at the last save point. This change impacts the functionality of high score features in Scratch projects, rendering them inoperative.
Thou is stating false.
(This isn't true, there are various cloud variable projects still working, new and old. Certain projects have issues where their cloud variables aren't saving their updates properly, and can be solved by renaming the variable and saving the project, repeating as necessary.)
No, it has happened to new projects as well. I'm trying to make a test project right now to see
Edit: It still happens:
https://scratch.mit.edu/projects/993179455/
-stxllxr -stxllxr loading

medians wrote:

No, it has happened to new projects as well. I'm trying to make a test project right now to see
Thou hath stated all projects doeth not function, this is false.
(They said all projects don't work with cloud variables, which is what i was correcting. Only certain projects (most new ones, also some old) cloud don't have their cloud variables updates being saved, and can be fixed by renaming them until they work (usually).)
medians medians loading

-stxllxr wrote:

medians wrote:

No, it has happened to new projects as well. I'm trying to make a test project right now to see
Thou hath stated all projects doeth not function, this is false.
(They said all projects don't work with cloud variables, which is what i was correcting. Only certain projects (most new ones, also some old) cloud don't have their cloud variables updates being saved, and can be fixed by renaming them until they work (usually).)
Do you care when people do not end their sentences with a period online xD
Anyways, I was referring to
Certain projects have issues where their cloud variables aren't saving their updates properly, and can be solved by renaming the variable and saving the project, repeating as necessary.)
Helmentloo Helmentloo loading

-stxllxr wrote:

medians wrote:

No, it has happened to new projects as well. I'm trying to make a test project right now to see
Thou hath stated all projects doeth not function, this is false.
(They said all projects don't work with cloud variables, which is what i was correcting. Only certain projects (most new ones, also some old) cloud don't have their cloud variables updates being saved, and can be fixed by renaming them until they work (usually).)
So far all projects don't work. I have not seen one that does work.
-stxllxr -stxllxr loading

medians wrote:

Anyways, I was referring to
Certain projects have issues where their cloud variables aren't saving their updates properly, and can be solved by renaming the variable and saving the project, repeating as necessary.)
Ah, i have been mistaken.
(If i wasn't being clear, i was referring to old and new projects alike which have the problem (sometimes, almost as unpredictable as the digits of pi.) .)