Discuss Scratch
- DylanSearch
-
50 posts
A LocalStorage Variable type
This is a cool idea that could be used to save progress in games. A variable that saves data in itself so that when that same user visits the project again, the variable is still how it was. It could use the LocalStorage feature in Javascript. Other users will not see the same data (Which makes this different to Cloud Variables). Does anyone support the idea?
Last edited by DylanSearch (Jan. 7, 2019 23:59:00)
- DANISON
-
100+ posts
A LocalStorage Variable type
Support! They should also add a way for the player to reset them if he wants to. 

- epicRedHot
-
500+ posts
A LocalStorage Variable type
Support, they could be saved as cookies to the user's computer as something like: “project number|variable name|variable value”.
Edit: Maybe you could add this to the original post, so that there won't be any confusion on how it would be implemented?
Edit: Maybe you could add this to the original post, so that there won't be any confusion on how it would be implemented?
Last edited by epicRedHot (Jan. 7, 2019 18:09:53)
- bybb
-
1000+ posts
A LocalStorage Variable type
No, LocalStorage. It's a better way to store this data within the browser. Support, they could be saved as cookies to the user's computer as something like: “project number|variable name|variable value”.
Edit: Maybe you could add this to the original post, so that there won't be any confusion on how it would be implemented?
Edit: My reasoning
Setting a cookie would be a bad way to do this, since cookies aren't really built to store save data for many projects, but localStorage gives you at least 5MB, so this could give 1kb of Storage to 5000 projects which is plenty. Cookies however, are much more limited and vary wildly by browser.
Last edited by bybb (Jan. 7, 2019 20:04:14)
- hunter601
-
27 posts
A LocalStorage Variable type
I SUPPORT THE IDEA
Good stuff means good inspiration
Good stuff means good inspiration
- DylanSearch
-
50 posts
A LocalStorage Variable type
That is what I was thinking of.No, LocalStorage. It's a better way to store this data within the browser. Support, they could be saved as cookies to the user's computer as something like: “project number|variable name|variable value”.
Edit: Maybe you could add this to the original post, so that there won't be any confusion on how it would be implemented?
Edit: My reasoning
Setting a cookie would be a bad way to do this, since cookies aren't really built to store save data for many projects, but localStorage gives you at least 5MB, so this could give 1kb of Storage to 5000 projects which is plenty. Cookies however, are much more limited and vary wildly by browser.
- BFDISuperFan
-
100+ posts
A LocalStorage Variable type
If this gets added, then I could definitely make something like a account based login screen on a game that actually works, it sounds cool.
I definitely support this.
I definitely support this.
- CalculatorFun
-
94 posts
A LocalStorage Variable type
Support.
There shouldn't be much of a debate whether to or not to add a locally stored variable, there's no way to add chat rooms as it's local.
There are many ways to store a local variable I think the OP's method would work the best in my opinion. (LocalStorage from JS)
☁️ A cloud variable would have the cloud emoji indicating that it's stored on the cloud
(Emoji breaks post idk) Floppy disk emoji if it's locally stored.
Half of the message deleted itself but adding this would allow for more extensive projects to be played till the end by a viewer.
There shouldn't be much of a debate whether to or not to add a locally stored variable, there's no way to add chat rooms as it's local.
There are many ways to store a local variable I think the OP's method would work the best in my opinion. (LocalStorage from JS)
☁️ A cloud variable would have the cloud emoji indicating that it's stored on the cloud
(Emoji breaks post idk) Floppy disk emoji if it's locally stored.
Half of the message deleted itself but adding this would allow for more extensive projects to be played till the end by a viewer.
Last edited by CalculatorFun (Jan. 8, 2019 06:13:29)
- DylanSearch
-
50 posts
A LocalStorage Variable type
But wouldn't you just be able to do: Support! They should also add a way for the player to reset them if he wants to.
set [Variable v] to []
- CalculatorFun
-
94 posts
A LocalStorage Variable type
He might mean manually reset and clear specific data, not the project resetting them.But wouldn't you just be able to do: Support! They should also add a way for the player to reset them if he wants to.set [Variable v] to []
- Luvexina
-
500+ posts
A LocalStorage Variable type
Support! Some games are really long and have complicated save codes.
- miniepicness
-
1000+ posts
A LocalStorage Variable type
This is way better than making tons of cloud variables as a workaround. Support
Last edited by miniepicness (April 24, 2019 00:39:38)
- CalculatorFun
-
94 posts
A LocalStorage Variable type
DuplicateI don't know if this would exactly qualify as a duplicate, the linked topic talks about a variable stored on the server, because it describes using it on 2 seperate computers- but this one is for variables (string) kept in js LocalStorage (Not in the server, but the browser, meaning you can't just switch computers)
Edit:
user variables = on server, only edited by user
LocalStorage variables = browser, only edited by user, already in js
Last edited by CalculatorFun (April 24, 2019 01:35:31)
- -Accio-
-
1000+ posts
A LocalStorage Variable type
Yes, but it's the same general idea.DuplicateI don't know if this would exactly qualify as a duplicate, the linked topic talks about a variable stored on the server, because it describes using it on 2 seperate computers, but this one is for variables kept in js LocalStorage (Not in the server, but the browser, meaning you can't just switch computers)
- miniepicness
-
1000+ posts
A LocalStorage Variable type
Same result isn’t same idea. Not really a duplicate. Don’t close this.Yes, but it's the same general idea.DuplicateI don't know if this would exactly qualify as a duplicate, the linked topic talks about a variable stored on the server, because it describes using it on 2 seperate computers, but this one is for variables kept in js LocalStorage (Not in the server, but the browser, meaning you can't just switch computers)
Last edited by miniepicness (April 24, 2019 03:01:03)