How to modify Snap<i>!</i>

I tried to make a Snap! mod before. (https://splash-snap.github.io/editor/) I couldn't add categories or datatypes, both of which I tried to do.
Does anyone know how to do any of those?

Hi Russell,

  • Adding categories is easy.
    • Go to objects.js
    • SpriteMorph.prototype.categories is an array. You can add, delete or rename categories.
    • You must define category colors. You will see SpriteMorph.prototype.blockColor. Is an object and you must define each category as a property with its color defined.
    • That's all. Blocks, inside the SpriteMorph.prototype.blocks object, has its category defined.

And for datatypes, what do you mean? Inside blocks.js you can add more slot options for your primitives. Is this? Or you can create your own morphs as new kind of first class data.

Joan

For datatypes I mean the dictionaries. I couldn't figure out how to make them display as anything other than "[object Object]".

How did you find my name?

Hi!

Oh, your name... As you requested, I visited your github project, and there is your profile, with the same elephant as your profile picture. :smile:

And about the "[object][object]" representation... You can create your own Morph, or create a textual representation of your object... Some details:

  • Visit blocks.js and look at SyntaxElementMorph.prototype.showBubble function. You will see different values make different morphToShow
  • Your value is a JS object. Followin the code you will see that your [object][object] is the value.toString() result.
  • You can add a toString() method for your objects. Or you can create a new Morph and define a thumbnail method to show what you
    want...

Ok. I guess this will help you...

Joan