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

#1 2012-06-15 14:18:29

hart20
New Scratcher
Registered: 2012-06-12
Posts: 9

Saving data to text file

I'm trying to have my game save data to a text file out of a list for use later:  I've tried using Panther "write __ to __ file" but I can't find the txt file after I've run my scripts.  I've tried specifying the location (e.g. C:\scratch programs\data.txt) and I still can't find the .txt file.  Any thoughts would be appreciated.

Offline

 

#2 2012-06-15 15:07:55

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Saving data to text file

hart20 wrote:

I'm trying to have my game save data to a text file out of a list for use later:  I've tried using Panther "write __ to __ file" but I can't find the txt file after I've run my scripts.  I've tried specifying the location (e.g. C:\scratch programs\data.txt) and I still can't find the .txt file.  Any thoughts would be appreciated.

You can actually show a list on the stage, right click, and select import or export.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2012-06-15 15:44:55

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: Saving data to text file

Show the list on stage, right click the grey part of it and select "export" and save it to your desktop (:


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#4 2012-06-15 16:39:08

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Saving data to text file

^^ Both Zparx and AtomicBawm3 are right; but unfortunately, reading and writing to a file (as is a standard function of most modern programming languages) can't be performed at runtime, only manually by the user within Scratch.  It is useful if you have data stored in a list (for example, a series of numbers representing a level) and you want to move it into another project, or post it where other users can access it. 

That being said, you mentioned Panther...  I believe there's more flexibility involving reading/writing to files with that mod, as well as some others.  If I were you, I'd ask sparks, who seems to be in charge of Panther at the moment.  He'll be sure to answer your question.

Offline

 

Board footer