Discuss Scratch

Advantage_coding
Scratcher
90 posts

How do you use cloud variables?

I want to make a save system, and apparently you can use cloud variables.
I haven't done anything to my game in case I mess it up, but do you just press “cloud variable” and then it will save, or is it more complex?
Advantage_coding
Scratcher
90 posts

How do you use cloud variables?

Any help appreciated a lot!
deck26
Scratcher
1000+ posts

How do you use cloud variables?

Cloud variables are the same for each user of your project - so if you have a cloud variable CV and user A changes the value then user B sees the value for CV change.

Cloud variables only hold numeric digits and are limited to 256 digits each. You have max 10 cloud variables so this means a max of 2560 digits can be stored. This also means usernames and other text needs to be encoded (eg using 01 for A, 02 for B etc) so a username will usually need twice as many digits as its length.

You shouldn't write to the cloud more than once per 0.1 seconds even to different variables - so writing to var1, then var2 immediately will cause problems and generally lose at least one of the updates.

Otherwise you just create cloud variables and use them as normal variables. So writing to the cloud is just a case of setting or changing the cloud variable.

Last edited by deck26 (Sept. 8, 2022 09:19:05)

Advantage_coding
Scratcher
90 posts

How do you use cloud variables?

Thank you!

Does that mean it is impossible to create a save system?
deck26
Scratcher
1000+ posts

How do you use cloud variables?

Advantage_coding wrote:

Thank you!

Does that mean it is impossible to create a save system?
No, just that you have limited space since you need to store the username and data together which is likely to mean more than 30 digits per user. If you can keep it down to 48 digits on average (username lengths vary) per user you can still store data for around 50 users.
Advantage_coding
Scratcher
90 posts

How do you use cloud variables?

Ok. Thank you!

Powered by DjangoBB