This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-01-20 17:26:55

beefrocks
Scratcher
Registered: 2008-06-27
Posts: 18

Variable saving via cookie

The story: Recently I just fell in love with a new flash game, and I've been wanting to recreate it in scratch. However, I have come upon a very large problem with recreating it in scratch. The problem is that this flash game strongly relies on its ability to save game progress. Without this ability, defeating the game would be a very tedious task and would be a large inconvienience to the player.

What I want: As scratch can't do this, the game would be boring and almost pointless. So, I'm suggesting that scratch be updated to allow the saving of variables in the form of a system cookie. All this cookie would need to contain is information reguarding the names and values of variables and lists.

What you might be concerned about: You might think that this new feature in scratch may be modified to contain a malicious file onto one's computer. However, all this would need is variable-saving power, so a simple file that could not be used for any other purpose would suffice.

Why you should meet my desire: The scratch community is always looking for new clay to fasion into bigger and better things. Anytime they are given more, they immediately pounce upon it and begin to mold amazing and marvelous works. This could be a very large peice of clay, and would make people all over the community happy. This would include people as low and unheard-of (and make such low-quality projects) that I couldn't tell you their names, to people who make the mediocre projects but are still unheard-of (like me), to the big people who make projects that always make the homepage like Archknight or M44.

Offline

 

#2 2009-01-20 17:57:57

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Variable saving via cookie

Yes this has been brought up before. I think thats its a good idea but like with everything in scratch is has to be super easy to use.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#3 2009-01-20 18:11:52

beefrocks
Scratcher
Registered: 2008-06-27
Posts: 18

Re: Variable saving via cookie

archmage wrote:

Yes this has been brought up before. I think thats its a good idea but like with everything in scratch is has to be super easy to use.

Well, I don't see why this can't be easy to use. All the user interface needs to be is two blocks: Save variables and load variables.

For instance, if you say
When Sprite1 clicked
Load variables

and somewhere else...
When Sprite2 clicked
Save variables

then all the player would need to is click Sprite1 to load saved data, and click Sprite2 to save the data. Easy!

No, strike that. Super easy!

Last edited by beefrocks (2009-01-20 18:15:19)

Offline

 

#4 2009-01-20 18:15:57

boinoinoi
Scratcher
Registered: 2007-06-05
Posts: 500+

Re: Variable saving via cookie

Actually, it might just be save variables because loading the variables should happen at the click of the flag.

No, wait. even better: a section of variables that's "web variables" which would make it easier to understand. it'd just be like the other variables with "set" and "change by" except it would be saved on a cookie.

There we go.


http://i30.tinypic.com/335fpxx.jpg
"Boinoinoi is the only person on the forums that I expect to be wearing a monocle all the time behind that screen, so I'm sure being as classy as he is, he knows what he's doing"        http://myfastcounter.com/count.php?c_style=88&id=1284259111http://myfastcounter.com/count.php?c_style=88&id=1286068127

Offline

 

#5 2009-01-20 18:34:19

EveningSage
Scratcher
Registered: 2009-01-10
Posts: 65

Re: Variable saving via cookie

Yeah that would be cool to have Save Variables. You can do this right now with what we have now by making save codes. like the first number is the level the second is the wapon etc.

Offline

 

#6 2009-01-20 18:53:43

techy
Scratcher
Registered: 2008-12-17
Posts: 100+

Re: Variable saving via cookie

Great idea! I think java can set cookies like in this demo : http://www.cookiecentral.com/code/javacook2.htm


Guppy Inc. making projects famous!
http://web-geeks.com/techy.gifhttp://web-geeks.com/grid.gifhttp://web-geeks.com/challenge.gif

Offline

 

#7 2009-01-20 19:34:46

beefrocks
Scratcher
Registered: 2008-06-27
Posts: 18

Re: Variable saving via cookie

boinoinoi wrote:

Actually, it might just be save variables because loading the variables should happen at the click of the flag.

No, wait. even better: a section of variables that's "web variables" which would make it easier to understand. it'd just be like the other variables with "set" and "change by" except it would be saved on a cookie.

There we go.

I don't mean to shoot down a good idea, but variables that automatically load when you click the flag may represent a few restrictions. But "web variables" is a really good idea, because any time auto-loading variables could be a problem, you could instead say

When Sprite2 clicked
Set variable (health) to (web health)
Set variable (level) to (web level)
and so on....

I think that "web variables" is an improvement on my idea, as much as I hate to admit it.

Offline

 

#8 2009-01-20 19:36:07

boinoinoi
Scratcher
Registered: 2007-06-05
Posts: 500+

Re: Variable saving via cookie

beefrocks wrote:

I think that "web variables" is an improvement on my idea, as much as I hate to admit it.

Why thank you.


http://i30.tinypic.com/335fpxx.jpg
"Boinoinoi is the only person on the forums that I expect to be wearing a monocle all the time behind that screen, so I'm sure being as classy as he is, he knows what he's doing"        http://myfastcounter.com/count.php?c_style=88&id=1284259111http://myfastcounter.com/count.php?c_style=88&id=1286068127

Offline

 

#9 2009-01-20 22:29:53

Buddy_ca111
Scratcher
Registered: 2008-08-30
Posts: 100+

Re: Variable saving via cookie

This would be a good idea


By reading this you agree to giving me your soul, money, passwords, projects, abiltys and your bases

Offline

 

#10 2009-01-23 19:46:15

Kezio
Scratcher
Registered: 2008-11-26
Posts: 100+

Re: Variable saving via cookie

i got a block idea for this.

Blocks

Set Cookie (Health) Value: (100)
Get Cookie (Health)
Delete Cookie (Health)
Replace Cookie Name (Health) With (HP)
Replace Cookie Value (Health) With (100)

Script

Set a variable to a Cookie value

<when green flag clicked>
<set{ MyHealth }to( [Get Cookie (Health)]

Get a cookie value and then see if the cookie variable is 0 if so it'll broadcast a message call Dead

<when green flag clicked>
<if> <( [Get Cookie (Health)] <=> 0 )>
<broadcast[ Dead

How will this work

at first start of a new project you'll start with no cookies. when you use the set cookie block you'll store it in to the scratch program. when you upload it to scratch it'll transfer the Cookie to the scratch server when it is uploaded online.

Last edited by Kezio (2009-01-23 19:54:02)

Offline

 

#11 2009-01-23 20:57:35

mrweston
Scratcher
Registered: 2007-12-13
Posts: 100+

Re: Variable saving via cookie

I feel your pain, beefrocks. I'm working on a pretty epic game right now with a bunch of students, and the inability to save progress is... limiting, to say the least.

I'm going to try to work around it by providing a means of saving/loading game states using alphanumerical codes (see my current draft approach here). Kinda tedious, but it might have to do for now.

Love the idea of web variables, though.

Offline

 

#12 2010-07-17 11:13:55

xt449
Scratcher
Registered: 2010-04-18
Posts: 65

Re: Variable saving via cookie

I think this should be a block
[blocks]
<forever if>
<else>
<end>
[/blocks]


Check Out My Newest Project: http://blocks.scratchr.org/API.php?user=xt449&amp;action=projects&amp;type=newest&amp;return=text&amp;num=1
I LIVE on my iPod Touch

Offline

 

#13 2010-07-17 11:22:02

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Variable saving via cookie

xt449 wrote:

I think this should be a block
[blocks]
<forever if>
<else>
<end>
[/blocks]

Thanks for trying to help out! If you want to make a suggestion, make your own topic about it, don't post in really old, irrelevant topics. Thanks!

I'll close this thread because it's pretty old.

Offline

 

Board footer