Cookie Blocks

One thing Scratch has always been lacking in is variables that persist between reloads but aren't the same for everybody. Basically, cookies. I hope Snap will fill the gap.
The blocks would be the read and write blocks, just like with variables.
The main usage for this would be in save files for video games, obviously.


(It doesn't have to be implemented using actual browser cookies, in fact, I'd recommend the variables to be stored per account rather than per computer. If you can't make it that way, however, per-computer saves would still Scratch the itch.)
(P.S. If this post was incomprehensible in some way, let me know so I can elaborate)

Cookies library

Now the cookies are deleted after closing the browser, but I am working on a better version

nice! A while ago @jadga and I made a library for localstorage based persistence. FWIW:

Cool! :slight_smile:

By now, I can set, read and delete cookies. After closing and reopening the tab, I can get the information out of the cookie. I can also read and set the cookie in different windows (yay, I can send data to myself).

BUT there is one thing I can't do: reading the cookie after restarting the whole browser. Is that because of my privacy settings? Can you access to them afterwards?

I just tried your blocks out in Chrome/Win10 and the value I set for SnapCookie survived browser restart


Thanks! How do I put it into my projects?

Depending on the web browser you are using, you can allow cookies to be kept after you close it.

Should one of these libraries be in Libraries? If so, which?

the localstore Database library will be in 6.2, it's already in dev

Nobody tells me anything...

check our Telegram group :wink:

var output = document.cookie; return output;

That can be just return document.cookie;

Account based variables are like cloud variables, containing a hashtable of usernames and values, but better secured. I think that these will actually fix anything about security, except for one thing: a block to check who last edited a cloud variable, or who sent a message. Encryption can still be banned, and you won't need to sign a message because snap will tell you if the sender was legit.
Cookie variables can be made already, but a standardised system is good because there won't be a whole bunch of projects using the same set of cookie variables, and overwriting each other.

but cookie variables or variables saved on your account are not visible to anyone, but the viewer, so online multiplayer is not possible.

Yes. Account based variables should come after cloud variables if at all. If cloud variables do exist though, account variables should fix other users breaking it.