Is there a way to export a list containing costumes?

I can export single costumes and lists but not lists containing costumes. Yet clearly Snap! has that ability since it can save and restore projects containing such lists.

Is there a short snippet of JavaScript that will do this?

you have to export the pixels of the costume...

Thanks. Just exporting the pixels as a list of lists results in a file 9x the PNG. One could encode the pixels and reduce that substantially. But it is unclear to me why lists containing costumes can't be exported.

A local variable exported with sprite has less overhead (Base64 encoded PNG).
Do you want a format for further processing by external tools?
Or XML to reimport list content into :snap:?

This way "raw" XML can be created (when dropped plain text variable is created)

My use case is that one Snap! project is generating a list containing costumes (and other things) and I want an easy way to import it as a list in another Snap! project. I ended up converting the costume to Base64 PNG (using JavaScript) and some JavaScript at the receiving end to turn the Base64 back into costumes.

I hadn't thought about a local variable of a sprite - that clearly should work - though it is a bit clumsy to copy the list from the main program to the sprite's variable and then exporting that sprite. I suppose with broadcasting with a data argument it shouldn't be too hard to move the lists around.

Is there a way to run a script when a sprite is imported?

Check it out, maybe it could help you...

these blocks:
image

example:
image

you can drop a costume directly into the block, it will be save into the browser...

you can easily restore the value in an another project...

the 1st time you run the project, name your project and use the same name in the second project...

Interesting idea but web storage is limited to 5 or 10 MB which is not very many large costumes.

maybe saving on your local drive (or google drive) instead of the browser

you can save the costume with this block:
untitled script pic
and this one for sound:
untitled script pic
(thk @pumpkinhead )

for larger storage you can use IndexedDB. From a quick Google search, after some amount of GB has been used, the browser asks the user if the site can have unlimited storage.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.