Custom cap blocks

When making a custom stack block holding down on the hat block to open the context menu (the one where you make block variables and whatnot) would have a new option to turn the block into a cap

This would also work with c blocks

That’s it, this really shouldn’t be too hard to implement because the functionality of changing a block between a cap and stack is already in snap 10. if you use the “primitive” block and set the block to be one that has a cap on it in the pallete it will make the custom block into a cap as well
untitled script pic 123
Sadly the “primitive” block stops the script below it whenever it’s run and runs the vanilla function meaning you can’t make any custom cap blocks that don’t function identically to the vinnilla ones. But this shows the functionality isn’t hard coded and could easily be implemented

Yes, I agree about the "could easily be implemented" part, and I'm guessing we'll get around to it eventually, but it's not high priority because cap blocks don't add functionality; they're basically a form of program documentation.

What happens if you turn off the Boolean?

I actually looked at the code for cap blocks; they're just commands with special code to change them look of them and make them unable to be stacked.

CommandBlockMorph.prototype.isStop = function () {
    var choice;
    if (this.selector === 'doStopThis') { // this could be cached...
        choice = this.inputs()[0].evaluate();
        return choice instanceof Array && choice[0].length < 12;
    }
    return ([ // list of blocks to be capped
        'doForever',
        'doReport',
        'removeClone',
        'doSwitchToScene'
    ].indexOf(this.selector) > -1);
};

since custom blocks dont have a function name like first class blocks do, it would be hard to implement this

really not sure what you mean by that considering its functional,
image


untitled script pic (21)
untitled script pic (20)

Remember that Super-Snap! does the work. Just press the Apply/OK buttons to reflect the changes.


you're asking for custom cap blocks. Not the functionality of the custom cap blocks.

i dont,
those also have the functionality of a custom cap block when you do that

i dont understand what you are talking about

wait; what?
this is real? how did you do that?

Wait its the primitive block that makes it a cap? Thats freaking weird

my brain just exploded

i showed, it just makes it work like a "delete this clone" block

the primitive block turns it into a cap, bnut no matter what theres no way to keep it that way with any other code but just the block

Im pretty sure this works differently than it would just making a custom cap.
It probably just sees that it has the definition of a pre-existing one and interprets it as one.

im just using that to say the functionality of turning a block into a cap and into a normal block exists so its at least possible and theres a base to how it would work

Hm, curious. Honestly, even though the source isn't on github yet, I want to view-source: the dev and take the scripts their and examine it

Interesting, but to be expected i guess


it only turns it into a cap if the function selected in the "primitive" block is one of a block in the pallete that has a dropdown

No I meant the primitive block in picture one doesnt exist in picture two

yeah because its the extension block in 10.0 the names dont match

true

untitled script pic
how are you getting it to work?

you have to load the block in 10.0 because editing primitives is a 10.0 feature