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?
Offline
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.
Offline
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.
Offline
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!
Offline
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.
Offline
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.
Offline