Me and a friend are making Scratch MOD called atom for the UG and my friend has come accross this problem: How does the scratch's file I/O works and how to save two Arrays to the SB file and how to open them from the SB file. How do you do this?
Offline
*bump*
.:: In more detail ::.
I have two arrays called customBlocks and customActions. these can be accessed from any class by using a method i created in ScriptableScratch called customBlockArray and customBlocks: to get and set values (customActionArray and customActions: too).
these arrays need to be stored in the SB file when saving, and need to be read into the arrays when opening an SB file.
Any help (even little) is greatly appreciated.
Especially from pople who know what they're saying
thanks!
Offline
Hmm I dont know how Scratch saves stuff.
Offline
It uses ObjStream. If you add some instance variables to the stage (you might have done this already?) and modify ScratchStageMorph's #initFieldsFrom: and #storeFieldsOn: (add the symbol in the appropriate place) they will be stored and initialized in the Stage. You can also modify the ScratchFrameMorph method #installNewProject: (maybe....I forget what it's called) you can call something to initialize them to ScriptableScratchMorph.
Offline
nXIII wrote:
It uses ObjStream. If you add some instance variables to the stage (you might have done this already?) and modify ScratchStageMorph's #initFieldsFrom: and #storeFieldsOn: (add the symbol in the appropriate place) they will be stored and initialized in the Stage. You can also modify the ScratchFrameMorph method #installNewProject: (maybe....I forget what it's called) you can call something to initialize them to ScriptableScratchMorph.
so could i just put a couple methods on the StageMorph to get and set the arrays on ScriptableScratch and edit the init and store fields to make it work, right?
Offline
right?
Offline