Discuss Scratch

CyanCode
Scratcher
4 posts

Cloud variables

I opened the same project in 2 windows, but the same cloud variable in both windows were different?
Milton_Meowfur
Scratcher
16 posts

Cloud variables

ONly scratchers can use cloud varibles.
Onlyscratcherscanusecoudvaribles
CyanCode
Scratcher
4 posts

Cloud variables

both clients were scratcher accounts???
imfh
Scratcher
1000+ posts

Cloud variables

Try checking out the cloud log. If you go to a projects page (not the editor or fullscreen), and look below the project, there should be an icon that says “Cloud Variables.” On that icon, press the arrow that says “See Data.”

The cloud log will let you see if the cloud variables are actually changing. Doing certain things (like setting a cloud variable to a letter), can make them act like a regular variable.

If you are still having trouble, could you share the link to the project you were having trouble with?
CyanCode
Scratcher
4 posts

Cloud variables

imfh wrote:

Try checking out the cloud log. If you go to a projects page (not the editor or fullscreen), and look below the project, there should be an icon that says “Cloud Variables.” On that icon, press the arrow that says “See Data.”

The cloud log will let you see if the cloud variables are actually changing. Doing certain things (like setting a cloud variable to a letter), can make them act like a regular variable.

If you are still having trouble, could you share the link to the project you were having trouble with?
The link is https://scratch.mit.edu/projects/580307083
CyanCode
Scratcher
4 posts

Cloud variables

Also, what things can turn a cloud variable into a normal variable?
oppooo
Scratcher
63 posts

Cloud variables

CyanCode wrote:

imfh wrote:

Try checking out the cloud log. If you go to a projects page (not the editor or fullscreen), and look below the project, there should be an icon that says “Cloud Variables.” On that icon, press the arrow that says “See Data.”

The cloud log will let you see if the cloud variables are actually changing. Doing certain things (like setting a cloud variable to a letter), can make them act like a regular variable.

If you are still having trouble, could you share the link to the project you were having trouble with?
The link is https://scratch.mit.edu/projects/580307083
Apparently, you are setting your cloud variable multiple times in the same loop. In this case, it will only do the first block. For example:
foreverset☁ player datato1set☁ player datato2set☁ player datato3

This will only set it to 1, never 2 and 3. This is because cloud variables require a 0.1 second cooldown, which means you need an interval of 0.1 in the middle of your sets. Ex:

foreverset☁ player datato1wait0.1secsset☁ player datato2wait0.1secsset☁ player datato3wait0.1secs

This will set it to 1, 2, and 3 continuously. But since you have a wait, you should probably make the cloud code separate from your game mechanincs code.

However, when you read the cloud variable for other peoples' values, you don't wait. You check if it is the x, y, direction, etc. that is being sent, and decode it all to the clones/stamps.

This method may cause overriding for 3+ people, though. The more people that play, the more likely it is that two players sent in their data at the same time, ignoring one of the inputs. For this reason, you might want to use 10 cloud variables, and randomly insert your data every 0.1 seconds into one of them, while reading all of them once per loop. Although an override could still happen, this mostly clears up the risk.

Does this help?
supergamer10000
Scratcher
1000+ posts

Cloud variables

oppooo wrote:

CyanCode wrote:

imfh wrote:

Try checking out the cloud log. If you go to a projects page (not the editor or fullscreen), and look below the project, there should be an icon that says “Cloud Variables.” On that icon, press the arrow that says “See Data.”

The cloud log will let you see if the cloud variables are actually changing. Doing certain things (like setting a cloud variable to a letter), can make them act like a regular variable.

If you are still having trouble, could you share the link to the project you were having trouble with?
The link is https://scratch.mit.edu/projects/580307083
Apparently, you are setting your cloud variable multiple times in the same loop. In this case, it will only do the first block. For example:
foreverset☁ player datato1set☁ player datato2set☁ player datato3

This will only set it to 1, never 2 and 3. This is because cloud variables require a 0.1 second cooldown, which means you need an interval of 0.1 in the middle of your sets. Ex:

foreverset☁ player datato1wait0.1secsset☁ player datato2wait0.1secsset☁ player datato3wait0.1secs

This will set it to 1, 2, and 3 continuously. But since you have a wait, you should probably make the cloud code separate from your game mechanincs code.

However, when you read the cloud variable for other peoples' values, you don't wait. You check if it is the x, y, direction, etc. that is being sent, and decode it all to the clones/stamps.

This method may cause overriding for 3+ people, though. The more people that play, the more likely it is that two players sent in their data at the same time, ignoring one of the inputs. For this reason, you might want to use 10 cloud variables, and randomly insert your data every 0.1 seconds into one of them, while reading all of them once per loop. Although an override could still happen, this mostly clears up the risk.

Does this help?
Yes try that
imfh
Scratcher
1000+ posts

Cloud variables

Another thing which can turn a cloud variable into a regular variable is if you press see inside. If you press see inside on a project that isn't owned by the account you are on, cloud variables will be disabled for that user until you refresh the page.

Your issue could also caused by what @oppooo explained above, however. Even if pressing see inside is the cause of your issue, you should be careful about setting cloud variables too quickly.

Powered by DjangoBB