Discuss Scratch

trollipop1
Scratcher
14 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

butterflygirl2 wrote:

That would help me a lot. Just one question, what is a cache? (I am not too good with computers.)
It is the place in your computer's memory that stores information about sites that you've been in. When youtube is able to continue right where you left off on a video you had watched before, that's because youtube saved the amount that you watched in the cache.
Websites with “remember my password” options also use the cache, they save your password to your cache and when you need to log in again, they just check what it is from the cache. It's basically a place for useful website variables in your memory.

when I receive [a great idea v]
say [Infinite Support!]
stop [this script v]

Last edited by trollipop1 (April 23, 2022 14:21:39)


forever
wait until <I have motivation::#00aaaa>
realise that I need to create the motivation::#ffaa33
actually start making content::#aaff33
slow down after a while::#aa33ff
end
What a cycle huh?
MagicCoder330
Scratcher
500+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Superdoggy wrote:

This can already be done, like through cloud variables.

See Ultimate Game Creator 5 by Yllie and Cloud Platformer Multiplayer Fun v1.11 by Griffpatch. As long as you do it right, cloud variables are a very effective method of saved games.

Actually, cloud variables are quite limited. What would happen if you had 10000 players playing your game, with their progress constantly saving. Eventually cloud runs out of space

Hello, this is my signature! it goes under every post I make and isn't part of it. shift control down and such to see more

Misconceptions about the Scratch Room

* Low floor: It should be easy to climb in and get started with Scratch - even for Scratchers who have no experience programming. - This does NOT mean complex things shouldn't be added. Making the ceiling higher or the walls wider doesn't make the floor harder to get on.
* Wide walls: Scratchers should be able to make all kinds of things with Scratch - not just animations and games, but news programs, science experiments, things we can't even imagine. - Wide walls means that some things that may be unconventional or odd or “useless” at first glance may still be worthwhile to add, because some people may find them useful for making new unique things.
* High Ceiling: Even though it's easy for someone who is new to programming to get started with Scratch, it should still be possible to make complex stuff. - Although the floor is there, many forumers just look up at the ceiling rather than thinking about the floor. They say “this would be too complicated, new Scratchers wouldn't understand it” without considering the fact that it can be worked up to with the handy floor we have.



((( OwO :: #DC381F) :: #FFCC00)  :: #FFCC00)
This is Georgie the evil grapefruit. He is much larger, stronger, more nutritious and scarier than a kumquat. Donate your soul to him at my profile to help him gain power to overthrow the kumquats and claim his position as the best signature eater!

This is a social experiment, comment and you MIGHT get curator

Get games off the other categories!
SciPiDilts
Scratcher
100+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Support. Without this, save data codes have to be used, and those could be faked if you look at the script closely. That means that people can fake save data codes to “prove” that they did something in a game that they actually didn't. This suggestion would eliminate that problem as well as making it more convenient to load a save game. However, there would have to be a limit on the number of cached variables in a project if it's stored with the account so that people don't spam the save data memory and so that they are encouraged to make their save data more concise. Also, it would also be nice to have an option to allow other projects to view (but not edit) the values of the cached variables in the project. This would be in the form of a checkbox for the cached variable creation menu, “Allow other projects to read this variable”. This would be helpful for doing things like the Wheel of Fate that used to be on Ninjakiwi. The option would affect all other projects, and reading the value would require a new sensing block:
(Cached variable [var name v] for project with ID (123456789) :: sensing)

when gf clicked
say hi :: pen

func _process_delta(delta_)
>| if Input.is_action_pressed(“Spoonification”)
>| >| Spoonification()

define spoonification
I am weird{
change x by (a number :: obsolete stack)
create clone of [a number v] :: grey
"a number" refers to a number :: sensing
EAT PEOPLE OM :: variables
say [you were yummy]
} :: operators
when <"a number" refers to a number :: list> :: sound
spoonification :: control

^– showing off with scratchblocks

ͤeͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤͤ
doge353
Scratcher
1 post

Cached Variables!! [Saved Games!] / Locally Saved Variables

trollipop1 wrote:

butterflygirl2 wrote:

That would help me a lot. Just one question, what is a cache? (I am not too good with computers.)
It is the place in your computer's memory that stores information about sites that you've been in. When youtube is able to continue right where you left off on a video you had watched before, that's because youtube saved the amount that you watched in the cache.
Websites with “remember my password” options also use the cache, they save your password to your cache and when you need to log in again, they just check what it is from the cache. It's basically a place for useful website variables in your memory.

when I receive [a great idea v]
say [Infinite Support!]
stop [this script v]
cool
guinea_girl-X
Scratcher
3 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Nice
guinea_girl-X
Scratcher
3 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Also what are “points” on scratch, and how do you get them?
guinea_girl-X
Scratcher
3 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Never mind I miss read.
BlueDragonKai
Scratcher
22 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Support.
waluigiregected
Scratcher
41 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

support, no context needed

welcome to my signature that will never have a good quote
lapisi
Scratcher
1000+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

waluigiregected wrote:

(#372)
support, no context needed
yes it is, please be constructive

don't forget

why are humans so meaty?
TheReal_BestGamer
Scratcher
33 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

epninja wrote:

( It seems like generally, people are in support of this!)

This is something I'd be very interested in.

Variables that would cache into the user's browser, so setting the variables, and the value that the variables contain is both written and read from the cache, meaning that they retain the same value to the user as they last time they went on it. This would be useful for projects such as games, for personal highscores and even saved games, so that players could continue from where they left off.

Other uses could be ideas like saved images in drawing/art programs, saved passwords and accounts in OS projects. There would be quite a lot of useful uses for cached variables.

In the end, they would just do exactly how flash games save your data, so you can continue later.

I do hope something like this is considered! Thanks Scratch team!

I believe that new locally saved variables would be very useful for the Scratcher community, as my friend LFOB said:

LFOB wrote:

It could mean saving games would become standard, making it possible for people like me to create larger games without having to worry about limiting the total play time.

Larger scale Scratch games can be very daunting projects to play, as they require time, hours perhaps, and not many have that time, meaning games go unfinished and the full experience is, well, not experienced. With saving you could play the game in short bursts, save your progress and continue at another time, this would encourage people to play the games and with accessibility encourage people to make more ambitious, bigger games, like my favourite genre, the RPG. Great games such as Evanescent, Spectrum 2, Kid's Quest and my own EPNinjaObjective suffer from this, as they all rely on the player having the dedication to sit down for at least an hour to play through the whole game. With saving, people would be encouraged to play more, and more Scratchers would be willing to make larger ambitious games knowing that people would actually play them.

Griffpatch's Github topic in support of this!

Note: THESE VARIABLES CANNOT BE USED TO HACK YOUR ACCOUNT OR YOUR COMPUTER. These locally saved variables will not be able to mess with your computer, all they will do keep a value for use within projects, like a normal variable, that is all. It could be the number 5, the name “Fred”, “Yes” or “No”, or whatever is needed for the project, it will not affect your computer or your browser. They would not be able to mess with your cache, just store things in them. So don't worry about projects deleting all your cookies for other sites, as they wouldn't be able to do that, or them doing anything else with it. It'll contain data useful for the project it's for only, nothing more.

Note 2: These cached variables are nothing like Cloud Variables. They are not used for communicative purposes, you will not be able to communicate with other Scratchers, so there is no way you can offend another Scratcher. All they will do is retain a value for use in the project, so they aren't reset every time you load the project. There is no need to moderate or restrict them, they're just normal variables. You could even use them without logging in, as it just concerns the project and the computer, not the Scratch account. They wouldn't be able to contain offensive words, otherwise it would be within the code of the project, which we can see with “SEE INSIDE”, just like a normal variable, and we can report that. We would still be able to see what's contained within the variable if we show it, just like a normal variable. If it were to ever contain an offensive word, it would be because the user/player entered the word themselves, in that case it's not the fault of the project but the user, but the SAME CAN BE DONE WITH NORMAL VARIABLES. If someone find swear words popping up in your computer's cookies, then it can only the fault of the user who put the swear word in!! Not the project's fault, or the person who made the project (As they cannot put swear words into the code of the project anyway), or the Scratch Team. It's on your own computer, so it's nobody else's responsibility than your own. Plus it's on the user's own computer, which is outside Scartch's responsibilities, no one can complain of finding inappropriate data they put on there themselves. Therefore I do not see the problem.

Note 3: there shouldn't be an issue of having to ask the user for permission to store data, as if a flash object can do that the flash player automatically prompts the user if it can store data, just like how it requests to use your microphone and webcam, of course if the Scratch Team wants extra security, they could put a second prompt in, but since it already prompts the user with the flash player, it shouldn't be necessary.

Note 4: Of course, there would be a limit to the amount of local variables you can have on a project, otherwise someone could make as many as they can, and users would find so many cookie files on their computers.

EDIT:
I know this can already be done with Cloud Variables, however it is extremely inefficient and difficult to do, especially for newer Scratchers. Also, internet connection aren't the most reliable for a lot of people, perhaps what if their internet goes down in the middle of playing? Plus the cloud variables themselves aren't the most reliable either, as many problems have occurred with my use of cloud variables in projects.

Cloud variables are also extremely limited, they have a max amount of characters they can store, and if they have to store the data for all Scratchers who go on, it's just impossible. And what if it was something like an RPG, where you'd be storing data like 100 characters per Scratcher, it all won't simply it into the cloud variables. With locally saved variables, you would only need to save data for one person, which is a lot more efficient. It also means you don't have to program all the complex Cloud List processes.

And what about those who can't use Cloud Variables like New Scratchers?

For something as small as just being to keep data, it's a very difficult task with cloud variables. It would be a lot more efficient and more easily accessible with locally saved variables.


Alternatively, here is another suggestion by another Scratcher:

MegaApuTurkUltra wrote:

I have a better idea, rather than storing cached vars as cookies (which makes people complain about spam), “cached” vars should actually be stored with each Scratch user's account info on the Scratch server. That way, Scratchers can continue playing games even on other computers. To prevent spam on the Scratch servers, the same New Scratcher policy should be applied, and of course there will be a size limit on cached vars. If the vars get out of hand, Scratch should notify you
Uh oh! It looks like your account is out of cached variable space! Delete some of your old cached variables to continue:

[ ] [ Derp project 1 ]
[ X ] [ Epic game ]
[ ] [ Derp Swag ]
____________________________________________________________________
[ Delete and continue ] [ Don't delete and disable cached variables for now ]

And I also think Scratch should notify you about cloud data and cached variables just like it does for the username block
Warning: This project uses cloud data, which means it can communicate with Scratch servers. This may be useful for multiplayer games, opinion polls, and some other things. If you want this feature disabled, click the button below.
[ Dismiss ] [ Disable cloud data for this session ]
Warning: This project uses cached variables, which means it store data (such as save games) that it can access when you visit this project again. If you don't want this feature, click the button below.
[ Dismiss ] [ Disable cached variables for this session ]
Warning: This project uses the username block, which means it can see what your username is. It cannot see any other information about you, other than your your username. However, if you want this feature disabled, click the button below.
[ Dismiss ] [ Replace my username with ‘Anonymous’ for this session ]
You could do this by creating save codes, which is personally my favorite method of saving games.
LionOte
Scratcher
37 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Full support. How have we not gotten this yet? It's an essential in Scratch projects, especially the larger ones like you said.

if it is [atomic v] time {
disentegrate due to atomic energy :: looks
atomic energy destroye you :: sensing
set [stuff i learned today v] to (3928958)
}:: events
free revive :: event
if <Scratchy hates free revive? :: sensing> then
say [nononononononononononononono waaaaaaaaa]
be grounded for (5882) [universe lifecycles v] :: sensing
end
thats it :: motion cap
//or is it?


//this is my cat willow
::cat

i love willow :: variables
if <<[willow v] [hates v] [me v]? :: sensing> or <(style) = [2.0]>> then
set [willow v] to [gone]
cri :: looks
end
Adam-basha_tutorial
Scratcher
37 posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

epninja wrote:

( It seems like generally, people are in support of this!)

This is something I'd be very interested in.

Variables that would cache into the user's browser, so setting the variables, and the value that the variables contain is both written and read from the cache, meaning that they retain the same value to the user as they last time they went on it. This would be useful for projects such as games, for personal highscores and even saved games, so that players could continue from where they left off.

Other uses could be ideas like saved images in drawing/art programs, saved passwords and accounts in OS projects. There would be quite a lot of useful uses for cached variables.

In the end, they would just do exactly how flash games save your data, so you can continue later.

I do hope something like this is considered! Thanks Scratch team!

I believe that new locally saved variables would be very useful for the Scratcher community, as my friend LFOB said:

LFOB wrote:

It could mean saving games would become standard, making it possible for people like me to create larger games without having to worry about limiting the total play time.

Larger scale Scratch games can be very daunting projects to play, as they require time, hours perhaps, and not many have that time, meaning games go unfinished and the full experience is, well, not experienced. With saving you could play the game in short bursts, save your progress and continue at another time, this would encourage people to play the games and with accessibility encourage people to make more ambitious, bigger games, like my favourite genre, the RPG. Great games such as Evanescent, Spectrum 2, Kid's Quest and my own EPNinjaObjective suffer from this, as they all rely on the player having the dedication to sit down for at least an hour to play through the whole game. With saving, people would be encouraged to play more, and more Scratchers would be willing to make larger ambitious games knowing that people would actually play them.

Griffpatch's Github topic in support of this!

Note: THESE VARIABLES CANNOT BE USED TO HACK YOUR ACCOUNT OR YOUR COMPUTER. These locally saved variables will not be able to mess with your computer, all they will do keep a value for use within projects, like a normal variable, that is all. It could be the number 5, the name “Fred”, “Yes” or “No”, or whatever is needed for the project, it will not affect your computer or your browser. They would not be able to mess with your cache, just store things in them. So don't worry about projects deleting all your cookies for other sites, as they wouldn't be able to do that, or them doing anything else with it. It'll contain data useful for the project it's for only, nothing more.

Note 2: These cached variables are nothing like Cloud Variables. They are not used for communicative purposes, you will not be able to communicate with other Scratchers, so there is no way you can offend another Scratcher. All they will do is retain a value for use in the project, so they aren't reset every time you load the project. There is no need to moderate or restrict them, they're just normal variables. You could even use them without logging in, as it just concerns the project and the computer, not the Scratch account. They wouldn't be able to contain offensive words, otherwise it would be within the code of the project, which we can see with “SEE INSIDE”, just like a normal variable, and we can report that. We would still be able to see what's contained within the variable if we show it, just like a normal variable. If it were to ever contain an offensive word, it would be because the user/player entered the word themselves, in that case it's not the fault of the project but the user, but the SAME CAN BE DONE WITH NORMAL VARIABLES. If someone find swear words popping up in your computer's cookies, then it can only the fault of the user who put the swear word in!! Not the project's fault, or the person who made the project (As they cannot put swear words into the code of the project anyway), or the Scratch Team. It's on your own computer, so it's nobody else's responsibility than your own. Plus it's on the user's own computer, which is outside Scartch's responsibilities, no one can complain of finding inappropriate data they put on there themselves. Therefore I do not see the problem.

Note 3: there shouldn't be an issue of having to ask the user for permission to store data, as if a flash object can do that the flash player automatically prompts the user if it can store data, just like how it requests to use your microphone and webcam, of course if the Scratch Team wants extra security, they could put a second prompt in, but since it already prompts the user with the flash player, it shouldn't be necessary.

Note 4: Of course, there would be a limit to the amount of local variables you can have on a project, otherwise someone could make as many as they can, and users would find so many cookie files on their computers.

EDIT:
I know this can already be done with Cloud Variables, however it is extremely inefficient and difficult to do, especially for newer Scratchers. Also, internet connection aren't the most reliable for a lot of people, perhaps what if their internet goes down in the middle of playing? Plus the cloud variables themselves aren't the most reliable either, as many problems have occurred with my use of cloud variables in projects.

Cloud variables are also extremely limited, they have a max amount of characters they can store, and if they have to store the data for all Scratchers who go on, it's just impossible. And what if it was something like an RPG, where you'd be storing data like 100 characters per Scratcher, it all won't simply it into the cloud variables. With locally saved variables, you would only need to save data for one person, which is a lot more efficient. It also means you don't have to program all the complex Cloud List processes.

And what about those who can't use Cloud Variables like New Scratchers?

For something as small as just being to keep data, it's a very difficult task with cloud variables. It would be a lot more efficient and more easily accessible with locally saved variables.


Alternatively, here is another suggestion by another Scratcher:

MegaApuTurkUltra wrote:

I have a better idea, rather than storing cached vars as cookies (which makes people complain about spam), “cached” vars should actually be stored with each Scratch user's account info on the Scratch server. That way, Scratchers can continue playing games even on other computers. To prevent spam on the Scratch servers, the same New Scratcher policy should be applied, and of course there will be a size limit on cached vars. If the vars get out of hand, Scratch should notify you
Uh oh! It looks like your account is out of cached variable space! Delete some of your old cached variables to continue:

[ ] [ Derp project 1 ]
[ X ] [ Epic game ]
[ ] [ Derp Swag ]
____________________________________________________________________
[ Delete and continue ] [ Don't delete and disable cached variables for now ]

And I also think Scratch should notify you about cloud data and cached variables just like it does for the username block
Warning: This project uses cloud data, which means it can communicate with Scratch servers. This may be useful for multiplayer games, opinion polls, and some other things. If you want this feature disabled, click the button below.
[ Dismiss ] [ Disable cloud data for this session ]
Warning: This project uses cached variables, which means it store data (such as save games) that it can access when you visit this project again. If you don't want this feature, click the button below.
[ Dismiss ] [ Disable cached variables for this session ]
Warning: This project uses the username block, which means it can see what your username is. It cannot see any other information about you, other than your your username. However, if you want this feature disabled, click the button below.
[ Dismiss ] [ Replace my username with ‘Anonymous’ for this session ]
Scratch team already did that, but by using Cloud Variables
Read more…

Hey
I am trying to help new scratches, and I make tutorials.
RedMonster12
Scratcher
100+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

raging support, although in the meantime, this effect can be achieved using the Turbowarp Packager! There is a setting to make cloud variables store locally to your computer for saving.

Last edited by RedMonster12 (July 5, 2022 16:49:03)


Upcoming Game:


musicROCKS013
Scratcher
1000+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

RedMonster12 wrote:

raging support, although in the meantime, this effect can be achieved using the Turbowarp Packager! There is a setting to make cloud variables store locally to your computer for saving.
Turbowarp is blocked on some school computers, but thanks for the tip! Turbowarp is honestly amazing.


Shift + Down arrow to see the rest of my signature

Hello Scratch Team. You have been pushing a liberal political agenda on this site for far too long. This site should stay out of politics. People should be able to still post their political opinions, but there shouldn’t be any “official” political stance or Scratch. The ST is not going to change this on their own, and shoot down any attempts asking them to change. Please put this in your signature if you agree that

Scratch should be politically neutral.

The ST’s biggest defense is that they’re being welcoming, but they can be perfectly welcoming of all people and stay out of politics. Scratch is about coding, and that should be the Scratch Team’s biggest concern to maintain.






This is my signature. I am allowed to adertize here.

_______________\/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
Please Click —> This project is literally my life's work. <— Please Click
_______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Jenny LeClue is the best
AHypnoman
Scratcher
1000+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Full support.

An alternative to Scratch called Hopscotch did this and it was a very well-received update, although one thing they didn't do (and that I couldn't find mentioned in the OP) was add some way to clear data for specific projects which is important as it allows users to reset certain projects that don't give the option to clear it internally.

Also maybe using Local Storage would be a be a better idea than using cookies as from my experience cookies greatly are limited in size. Cookies also are things that people often clear globally, whereas local storage is harder to clear. Wow that is the worst post I've ever written

~ AHypnoman (Use Shift+Down Arrow to see the rest of my signature)







I am an evil kumquat, and your siggy looks tasty…
Hello there, I'm AHypnoman, If you write my name remember to capitalize the “H”. “When you don't create things, you become defined by your tastes rather than ability. your tastes only narrow & exclude people. so create.” I write though as tho.
According to the Chrome Console, my viewbox attribute is “Garbage”. Very nice, Chrome.
#TrendyHashtag
Gib internneeet

Play Retorquebit!


jbthepig
Scratcher
500+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

Support! This is one of the features that I've most wanted to be added to Scratch!

Last edited by kaj (Tomorrow, 27:09:07)


To scroll through a signature, highlight some text in the signature, then use:
((shift) + (up/down arrow))

To add a signature, go to the bottom of Discussion Home and click “Change your signature.”

I had a bigger signature, but it was eaten by an Evil Kumquat.

<´・ω・` :: sensing> //This is Sam. He will protect my signature from future attacks.
lapisi
Scratcher
1000+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

jbthepig wrote:

(#380)
Support! This is one of the features that I've most wanted to be added to Scratch!
please be constructive and say why you support or don't say it at all

don't forget

why are humans so meaty?
andriydzundz24
Scratcher
1 post

Cached Variables!! [Saved Games!] / Locally Saved Variables

what
bsteichman
Scratcher
100+ posts

Cached Variables!! [Saved Games!] / Locally Saved Variables

i was thinking they were stored as cookies on your computer, you can choose to have them or not. many other sites have cookies. and scratch doesn't have to store it on their servers. which is one of the main reasons there is a char limit (lack of server space)

Woah, a signature! :: control

Powered by DjangoBB