in a js block
you made that in the
that reports all the scripts, not all the blocks in the block pallet.
Oh!You want all of the functions!
this.parentThatIsA(StageMorph).globalBlocks
returns all the definitions
only for custom blocks no primitives
did you mis copy?
dont do parens after globalblocks
Type it in the console then
Or add new List()
Just like sathvikrias
where do I put new List()
return new List(this.parentThatIsA(StageMorph).globalBlocks)
There is no need for those rings.
This project was the first iteration implementing the @cymplecy idea to drop blocks from the local menu, not from the palette.
Blocks created this way
can be dragged to the script area without extra rings
I said that it is only for global blocks!
Each object is an CustomBlockDefinition.
but you're not telling me how to actually view the blocks.
@18001767679 @ego-lay_atman-bay to get all custom blocks:
return new List(this.parentThatIsA(StageMorph).globalBlocks.map(e => new Context(null, eval ('new Custom' + e.type[0].toUpperCase() + e.type.slice(1) + 'BlockMorph(e)'))));
there are probably parens errors but im too lazy to fix those fixed 'em
to get all primitive blocks:
var stage = this.parentThatIsA(StageMorph), array = this.categories.map( (cat) => (this.blockTemplates(cat))) .map(a => a.filter(e => e.constructor.name.includes( "BlockMorph")).map(f => new Context(null, f))); array.pop(); array.pop(); var evens = array.filter((x, y) => y % 2 == 0), odds = array.filter((x, y) => y % 2 != 0); return new List(evens.concat(odds).map(e => new List(e)))
;
note: the code to get primitives is kind of laggy, since it's trying to render lists of lists of tons of blocks
Wow!Great!
You need one more before the semicolon. An easy way to figure out if your parentheses match is to start at the beginning and have the number 0 in your head. At each (
, add 1. At each )
, subtract one. If your parentheses match, you will end with 0.
Thanks. That is so much more helpful.