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

#1 2010-12-29 06:57:45

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

scripts as script?

I noticed that when you save a Scratch project, and open it in a text editor, the scripts can be "read" here and there throughout all the text that makes up the project. Can anyone thing of a way to export a script as text, and then run it with a block?

One option would be to convert the entire script into smalltalk and then run the smalltalk code with a custom block... Any thoughts?  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2 2010-12-29 09:19:55

developdood
Scratcher
Registered: 2009-04-16
Posts: 63

Re: scripts as script?

I think that what you have seen can probably not be typed because it is actually a binary formatted file which you have opened with what probably is utf-8 and some of the characters are titles of blocks, others are characters that aren't used. But I think you probably could serialise scripts to some sort of human readable text but that spoils the point of Scratch.


Have a look at some of my games. I made a cool physics game called "Physics Marble Cannon" which is really cool. I let anyone remix any of my projects without permission or credit necessary.

Offline

 

#3 2010-12-29 09:34:45

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: scripts as script?

Take a look at this: <xml> by Jens
This project tells you how to allow you to export/import scripts as xml. There isn't a way to specifically run a script with a block, but it should be simple enough.


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#4 2010-12-29 10:01:07

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: scripts as script?

Well the point of this would hopefully be so that a script could be stored as an external file, and read by a block when it's needed. (saves space and stops lag)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#5 2010-12-29 10:05:08

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: scripts as script?

Oh, I see. Well, the project I mentioned above could deal with the script I/O process, and I think the script reading and execution process should be fairly straightforwards. It also has the added bonus of being able to edit the script externally!


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#6 2010-12-29 10:22:30

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: scripts as script?

Do you think it would be worth me looking into this? I basically have a set of attacks for a game I'm making (about 3-400 attacks) and it's simply not possible to store all those scripts that animate and change all the correct variables on the project itself.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#7 2010-12-29 10:45:44

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: scripts as script?

I think it's worth a try, at least. You could try modifying the code to make Scratch read the scripts from the files once and then store the scripts in a dictionary, which could then be run with a block. This would remove possible lag from frequent file inquerry.


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#8 2010-12-29 11:06:18

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: scripts as script?

Interesting... Then again, I need to store images for each one, so it might be easier to store a load of sprites...


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer